1
- From 8edcb3957601ba1237d3f60bbfc0f115a614aa75 Mon Sep 17 00:00:00 2001
1
+ From e194b6bb173a95dcfb84c328fff426e60e6ab8f9 Mon Sep 17 00:00:00 2001
2
2
From: Carlos Bentzen <
[email protected] >
3
3
Date: Wed, 10 Jul 2024 10:34:19 +0200
4
- Subject: [PATCH 1/9 ] webrtcbin: create and associate transceivers earlier in
4
+ Subject: [PATCH 1/8 ] webrtcbin: create and associate transceivers earlier in
5
5
negotation
6
6
7
7
According to https://w3c.github.io/webrtc-pc/#set-the-session-description
@@ -24,14 +24,14 @@ associated after every session description is set.
24
24
25
25
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7156>
26
26
---
27
- .../gst-plugins-bad/ext/webrtc/gstwebrtcbin.c | 495 ++++++++++- -------
27
+ .../gst-plugins-bad/ext/webrtc/gstwebrtcbin.c | 477 +++++++++++ -------
28
28
.../gst-plugins-bad/ext/webrtc/webrtcsdp.c | 11 +
29
29
.../gst-plugins-bad/ext/webrtc/webrtcsdp.h | 2 +
30
30
.../tests/check/elements/webrtcbin.c | 120 ++++-
31
- 4 files changed, 388 insertions(+), 240 deletions(-)
31
+ 4 files changed, 388 insertions(+), 222 deletions(-)
32
32
33
33
diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c
34
- index f170f512bf..b4196e3435 100644
34
+ index dce4820a6d..225d246576 100644
35
35
--- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c
36
36
+++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c
37
37
@@ -748,6 +748,13 @@ transceiver_match_for_mid (GstWebRTCRTPTransceiver * trans, const gchar * mid)
@@ -169,8 +169,8 @@ index f170f512bf..b4196e3435 100644
169
169
- }
170
170
- rtp_trans = NULL;
171
171
- }
172
- }
173
-
172
+ - }
173
+ -
174
174
- if (rtp_trans) {
175
175
- answer_dir = rtp_trans->direction;
176
176
- g_assert (answer_caps != NULL);
@@ -180,8 +180,8 @@ index f170f512bf..b4196e3435 100644
180
180
- answer_dir = GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY;
181
181
- GST_WARNING_OBJECT (webrtc, "did not find compatible transceiver for "
182
182
- "offer caps %" GST_PTR_FORMAT ", will only receive", offer_caps);
183
- - }
184
- -
183
+ }
184
+
185
185
- if (!rtp_trans) {
186
186
- GstCaps *trans_caps;
187
187
- GstWebRTCKind kind = GST_WEBRTC_KIND_UNKNOWN;
@@ -253,40 +253,15 @@ index f170f512bf..b4196e3435 100644
253
253
}
254
254
}
255
255
256
- @@ -6079,24 +6006,6 @@ _update_data_channel_from_sdp_media (GstWebRTCBin * webrtc,
257
- transport_receive_bin_set_receive_state (receive, RECEIVE_STATE_PASS);
258
- }
259
-
260
- - static gboolean
261
- - _find_compatible_unassociated_transceiver (GstWebRTCRTPTransceiver * p1,
262
- - gconstpointer data)
263
- - {
264
- - GstWebRTCKind kind = GPOINTER_TO_INT (data);
265
- -
266
- - if (p1->mid)
267
- - return FALSE;
268
- - if (p1->mline != -1)
269
- - return FALSE;
270
- - if (p1->stopped)
271
- - return FALSE;
272
- - if (p1->kind != GST_WEBRTC_KIND_UNKNOWN && p1->kind != kind)
273
- - return FALSE;
274
- -
275
- - return TRUE;
276
- - }
277
- -
278
- static void
279
- _connect_rtpfunnel (GstWebRTCBin * webrtc, guint session_id)
280
- {
281
- @@ -6179,7 +6088,6 @@ _update_transceivers_from_sdp (GstWebRTCBin * webrtc, SDPSource source,
256
+ @@ -6185,7 +6112,6 @@ _update_transceivers_from_sdp (GstWebRTCBin * webrtc, SDPSource source,
282
257
for (i = 0; i < gst_sdp_message_medias_len (sdp->sdp); i++) {
283
258
const GstSDPMedia *media = gst_sdp_message_get_media (sdp->sdp, i);
284
259
TransportStream *stream;
285
260
- GstWebRTCRTPTransceiver *trans;
286
261
guint transport_idx;
287
262
288
263
/* skip rejected media */
289
- @@ -6191 ,8 +6099 ,6 @@ _update_transceivers_from_sdp (GstWebRTCBin * webrtc, SDPSource source,
264
+ @@ -6197 ,8 +6123 ,6 @@ _update_transceivers_from_sdp (GstWebRTCBin * webrtc, SDPSource source,
290
265
else
291
266
transport_idx = i;
292
267
@@ -295,7 +270,7 @@ index f170f512bf..b4196e3435 100644
295
270
stream = _get_or_create_transport_stream (webrtc, transport_idx,
296
271
_message_media_is_datachannel (sdp->sdp, transport_idx));
297
272
if (!bundled) {
298
- @@ -6203 ,60 +6109 ,28 @@ _update_transceivers_from_sdp (GstWebRTCBin * webrtc, SDPSource source,
273
+ @@ -6209 ,60 +6133 ,28 @@ _update_transceivers_from_sdp (GstWebRTCBin * webrtc, SDPSource source,
299
274
ensure_rtx_hdr_ext (stream);
300
275
}
301
276
@@ -310,10 +285,7 @@ index f170f512bf..b4196e3435 100644
310
285
- if (g_strcmp0 (gst_sdp_media_get_media (media), "audio") == 0 ||
311
286
- g_strcmp0 (gst_sdp_media_get_media (media), "video") == 0) {
312
287
- GstWebRTCKind kind = GST_WEBRTC_KIND_UNKNOWN;
313
- + if (g_strcmp0 (gst_sdp_media_get_media (media), "audio") == 0 ||
314
- + g_strcmp0 (gst_sdp_media_get_media (media), "video") == 0) {
315
- + GstWebRTCRTPTransceiver *trans;
316
-
288
+ -
317
289
- /* No existing transceiver, find an unused one */
318
290
- if (!trans) {
319
291
- if (g_strcmp0 (gst_sdp_media_get_media (media), "audio") == 0)
@@ -343,7 +315,10 @@ index f170f512bf..b4196e3435 100644
343
315
- gst_webrtc_bin_signals[ON_NEW_TRANSCEIVER_SIGNAL], 0, trans);
344
316
- PC_LOCK (webrtc);
345
317
- }
346
- -
318
+ + if (g_strcmp0 (gst_sdp_media_get_media (media), "audio") == 0 ||
319
+ + g_strcmp0 (gst_sdp_media_get_media (media), "video") == 0) {
320
+ + GstWebRTCRTPTransceiver *trans;
321
+
347
322
- _update_transceiver_from_sdp_media (webrtc, sdp->sdp, i, stream,
348
323
- trans, bundled, bundle_idx, error);
349
324
- if (error && *error)
@@ -376,7 +351,7 @@ index f170f512bf..b4196e3435 100644
376
351
}
377
352
}
378
353
379
- @@ -6406 ,6 +6280 ,210 @@ get_last_generated_description (GstWebRTCBin * webrtc, SDPSource source,
354
+ @@ -6412 ,6 +6304 ,210 @@ get_last_generated_description (GstWebRTCBin * webrtc, SDPSource source,
380
355
return NULL;
381
356
}
382
357
@@ -587,7 +562,7 @@ index f170f512bf..b4196e3435 100644
587
562
588
563
/* http://w3c.github.io/webrtc-pc/#set-description */
589
564
static GstStructure *
590
- @@ -6568 ,21 +6646 ,8 @@ _set_description_task (GstWebRTCBin * webrtc, struct set_description *sd)
565
+ @@ -6574 ,21 +6670 ,8 @@ _set_description_task (GstWebRTCBin * webrtc, struct set_description *sd)
591
566
}
592
567
}
593
568
@@ -611,7 +586,7 @@ index f170f512bf..b4196e3435 100644
611
586
612
587
if (webrtc->signaling_state != new_signaling_state) {
613
588
webrtc->signaling_state = new_signaling_state;
614
- @@ -6642 ,6 +6707 ,12 @@ _set_description_task (GstWebRTCBin * webrtc, struct set_description *sd)
589
+ @@ -6648 ,6 +6731 ,12 @@ _set_description_task (GstWebRTCBin * webrtc, struct set_description *sd)
615
590
continue;
616
591
}
617
592
0 commit comments