From 97d83056b315c56834eaa6776ae4c6a0848b5ef9 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Tue, 9 Nov 2021 19:41:14 +0100 Subject: [PATCH] rtpfunnel: don't enforce twcc during upstream negotiation A previous patch has caused rtpfunnel to output twcc-related information downstream, however this leaked into upstream negotiation (through funnel->srccaps), causing payloader to negotiate twcc caps even when not prompted to do so by the user. Fix this by only enforcing that upstream sends us application/x-rtp caps as was the case originally. Part-of: --- .../gst-plugins-good/gst/rtpmanager/gstrtpfunnel.c | 11 ++++++++--- .../gst-plugins-good/tests/check/elements/rtpfunnel.c | 9 +++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpfunnel.c b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpfunnel.c index 67a3c23c11..092e7c3175 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpfunnel.c +++ b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpfunnel.c @@ -374,16 +374,19 @@ gst_rtp_funnel_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) GstStructure *s; guint ssrc; guint8 ext_id; + GstCaps *rtpcaps = gst_caps_new_empty_simple (RTP_CAPS); gst_event_parse_caps (event, &caps); GST_OBJECT_LOCK (funnel); - if (!gst_caps_can_intersect (funnel->srccaps, caps)) { + if (!gst_caps_can_intersect (rtpcaps, caps)) { GST_ERROR_OBJECT (funnel, "Can't intersect with caps %" GST_PTR_FORMAT, caps); g_assert_not_reached (); } + gst_caps_unref (rtpcaps); + s = gst_caps_get_structure (caps, 0); if (gst_structure_get_uint (s, "ssrc", &ssrc)) { fpad->ssrc = ssrc; @@ -430,15 +433,17 @@ gst_rtp_funnel_sink_query (GstPad * pad, GstObject * parent, GstQuery * query) { GstCaps *filter_caps; GstCaps *new_caps; + GstCaps *rtpcaps = gst_caps_new_empty_simple (RTP_CAPS); gst_query_parse_caps (query, &filter_caps); GST_OBJECT_LOCK (funnel); if (filter_caps) { - new_caps = gst_caps_intersect_full (funnel->srccaps, filter_caps, + new_caps = gst_caps_intersect_full (rtpcaps, filter_caps, GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (rtpcaps); } else { - new_caps = gst_caps_copy (funnel->srccaps); + new_caps = rtpcaps; } GST_OBJECT_UNLOCK (funnel); diff --git a/subprojects/gst-plugins-good/tests/check/elements/rtpfunnel.c b/subprojects/gst-plugins-good/tests/check/elements/rtpfunnel.c index 1b22f7c14f..5e7ee4523a 100644 --- a/subprojects/gst-plugins-good/tests/check/elements/rtpfunnel.c +++ b/subprojects/gst-plugins-good/tests/check/elements/rtpfunnel.c @@ -310,12 +310,13 @@ GST_START_TEST (rtpfunnel_twcc_caps) gst_harness_set_src_caps_str (h0, "application/x-rtp, " "ssrc=(uint)123, extmap-5=" TWCC_EXTMAP_STR ""); - /* request a second sinkpad, and verify the extmap is - present in the caps when doing a caps-query downstream */ + /* request a second sinkpad, the extmap should not be + present in the caps when doing a caps-query downstream, + as we don't want to force upstream (typically a payloader) + to use the extension */ h1 = gst_harness_new_with_element (h->element, "sink_1", NULL); caps = gst_pad_query_caps (GST_PAD_PEER (h1->srcpad), NULL); - expected_caps = gst_caps_from_string ("application/x-rtp, " - "extmap-5=" TWCC_EXTMAP_STR ""); + expected_caps = gst_caps_new_empty_simple ("application/x-rtp"); fail_unless (gst_caps_is_equal (expected_caps, caps)); gst_caps_unref (caps); gst_caps_unref (expected_caps);