Mercurial > libervia-backend
diff libervia/backend/plugins/plugin_xep_0343.py @ 4240:79c8a70e1813
backend, frontend: prepare remote control:
This is a series of changes necessary to prepare the implementation of remote control
feature:
- XEP-0166: add a `priority` attribute to `ApplicationData`: this is needed when several
applications are working in a same session, to know which one must be handled first.
Will be used to make Remote Control have precedence over Call content.
- XEP-0166: `_call_plugins` is now async and is not used with `DeferredList` anymore: the
benefit to have methods called in parallels is very low, and it cause a lot of trouble
as we can't predict order. Methods are now called sequentially so workflow can be
predicted.
- XEP-0167: fix `senders` XMPP attribute <=> SDP mapping
- XEP-0234: preflight acceptance key is now `pre-accepted` instead of `file-accepted`, so
the same key can be used with other jingle applications.
- XEP-0167, XEP-0343: move some method to XEP-0167
- XEP-0353: use new `priority` feature to call preflight methods of applications according
to it.
- frontend (webrtc): refactor the sources/sink handling with a more flexible mechanism
based on Pydantic models. It is now possible to have has many Data Channel as necessary,
to have them in addition to A/V streams, to specify manually GStreamer sources and
sinks, etc.
- frontend (webrtc): rework of the pipeline to reduce latency.
- frontend: new `portal_desktop` method. Screenshare portal handling has been moved there,
and RemoteDesktop portal has been added.
- frontend (webrtc): fix `extract_ufrag_pwd` method.
rel 436
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 11 May 2024 13:52:41 +0200 |
parents | e11b13418ba6 |
children | 0d7bb4df2343 |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0343.py Sat May 11 13:25:45 2024 +0200 +++ b/libervia/backend/plugins/plugin_xep_0343.py Sat May 11 13:52:41 2024 +0200 @@ -290,10 +290,7 @@ f"Invalid datachannel signaling element: {transport_elt.toXml()}" ) transport_data["webrtc"] = True - elif action in ( - self._j.A_PREPARE_CONFIRMATION, self._j.A_PREPARE_INITIATOR, - self._j.A_TRANSPORT_INFO - ): + elif action in (self._j.A_PREPARE_INITIATOR, self._j.A_TRANSPORT_INFO): await self._call_ice_udp_handler( client, action, session, content_name, transport_elt ) @@ -319,37 +316,19 @@ elif action == self._j.A_SESSION_INITIATE: # responder side - sdp = mapping.generate_sdp_from_session(session) + # answer_sdp_d is a deferred handled in XEP-0167: it is called when the + # frontend answers with its SDP. session["answer_sdp_d"] = answer_sdp_d = defer.Deferred() # we should have the answer long before 2 min answer_sdp_d.addTimeout(2 * 60, reactor) - self.host.bridge.call_setup( - session["id"], - data_format.serialise( - { - "role": session["role"], - "sdp": sdp, - } - ), - client.profile, - ) + self._rtp.send_answer_sdp(client, session) answer_sdp = await answer_sdp_d - parsed_answer = mapping.parse_sdp(answer_sdp) + parsed_answer = mapping.parse_sdp(answer_sdp, session["role"]) session["metadata"].update(parsed_answer["metadata"]) - contents = session["contents"] - if len(contents) != 1: - raise NotImplementedError( - "Only a singlecontent is supported at the moment." - ) - content = next(iter(contents.values())) - media_data = parsed_answer["application"] - application_data = content["application_data"] - application_data["local_data"] = media_data["application_data"] - transport_data = content["transport_data"] - local_ice_data = media_data["transport_data"] - transport_data["local_ice_data"] = local_ice_data + self._rtp.propagate_data(session, parsed_answer) + transport_elt.children.clear() ice_transport_elt = await self._ice_udp.jingle_handler( client, action, session, content_name, transport_elt