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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1278>
This commit is contained in:
Mathieu Duponchelle 2021-11-09 19:41:14 +01:00 committed by GStreamer Marge Bot
parent 72118b9db4
commit 97d83056b3
2 changed files with 13 additions and 7 deletions

View file

@ -374,16 +374,19 @@ gst_rtp_funnel_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
GstStructure *s; GstStructure *s;
guint ssrc; guint ssrc;
guint8 ext_id; guint8 ext_id;
GstCaps *rtpcaps = gst_caps_new_empty_simple (RTP_CAPS);
gst_event_parse_caps (event, &caps); gst_event_parse_caps (event, &caps);
GST_OBJECT_LOCK (funnel); 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, GST_ERROR_OBJECT (funnel, "Can't intersect with caps %" GST_PTR_FORMAT,
caps); caps);
g_assert_not_reached (); g_assert_not_reached ();
} }
gst_caps_unref (rtpcaps);
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
if (gst_structure_get_uint (s, "ssrc", &ssrc)) { if (gst_structure_get_uint (s, "ssrc", &ssrc)) {
fpad->ssrc = ssrc; fpad->ssrc = ssrc;
@ -430,15 +433,17 @@ gst_rtp_funnel_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
{ {
GstCaps *filter_caps; GstCaps *filter_caps;
GstCaps *new_caps; GstCaps *new_caps;
GstCaps *rtpcaps = gst_caps_new_empty_simple (RTP_CAPS);
gst_query_parse_caps (query, &filter_caps); gst_query_parse_caps (query, &filter_caps);
GST_OBJECT_LOCK (funnel); GST_OBJECT_LOCK (funnel);
if (filter_caps) { 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_INTERSECT_FIRST);
gst_caps_unref (rtpcaps);
} else { } else {
new_caps = gst_caps_copy (funnel->srccaps); new_caps = rtpcaps;
} }
GST_OBJECT_UNLOCK (funnel); GST_OBJECT_UNLOCK (funnel);

View file

@ -310,12 +310,13 @@ GST_START_TEST (rtpfunnel_twcc_caps)
gst_harness_set_src_caps_str (h0, "application/x-rtp, " gst_harness_set_src_caps_str (h0, "application/x-rtp, "
"ssrc=(uint)123, extmap-5=" TWCC_EXTMAP_STR ""); "ssrc=(uint)123, extmap-5=" TWCC_EXTMAP_STR "");
/* request a second sinkpad, and verify the extmap is /* request a second sinkpad, the extmap should not be
present in the caps when doing a caps-query downstream */ 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); h1 = gst_harness_new_with_element (h->element, "sink_1", NULL);
caps = gst_pad_query_caps (GST_PAD_PEER (h1->srcpad), NULL); caps = gst_pad_query_caps (GST_PAD_PEER (h1->srcpad), NULL);
expected_caps = gst_caps_from_string ("application/x-rtp, " expected_caps = gst_caps_new_empty_simple ("application/x-rtp");
"extmap-5=" TWCC_EXTMAP_STR "");
fail_unless (gst_caps_is_equal (expected_caps, caps)); fail_unless (gst_caps_is_equal (expected_caps, caps));
gst_caps_unref (caps); gst_caps_unref (caps);
gst_caps_unref (expected_caps); gst_caps_unref (expected_caps);