diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2021-05-06 17:58:15 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2021-05-13 15:05:00 -0400 |
commit | f34be8a3bd94b44e6a084bf55f325152ab5ee04d (patch) | |
tree | 4f8eb034235ee9e06033a87c5f90d2c18ad8af50 /ext/webrtc | |
parent | 3065ac49fb80c85de49171a2c60b07002a2ce0cd (diff) | |
download | gstreamer-plugins-bad-f34be8a3bd94b44e6a084bf55f325152ab5ee04d.tar.gz |
webrtcbin: Intersect answer with codec prefs & capabilities
In case the local capabilities changed since the last negotiaton,
we need to re-intersect and see if the result would be different.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2183>
Diffstat (limited to 'ext/webrtc')
-rw-r--r-- | ext/webrtc/gstwebrtcbin.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index fe1ce2273..f7216b3c1 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -3618,18 +3618,33 @@ _create_answer_task (GstWebRTCBin * webrtc, const GstStructure * options, gst_sdp_message_get_media (last_answer, i); const gchar *last_mid = gst_sdp_media_get_attribute_val (last_media, "mid"); + GstCaps *current_caps; /* FIXME: assumes no shenanigans with recycling transceivers */ g_assert (g_strcmp0 (mid, last_mid) == 0); - if (!answer_caps) - answer_caps = _find_codec_preferences (webrtc, rtp_trans, i, error); + current_caps = _find_codec_preferences (webrtc, rtp_trans, i, error); if (*error) { gst_caps_unref (offer_caps); goto rejected; } - if (!answer_caps) - answer_caps = _rtp_caps_from_media (last_media); + if (!current_caps) + current_caps = _rtp_caps_from_media (last_media); + + if (current_caps) { + answer_caps = gst_caps_intersect (offer_caps, current_caps); + if (gst_caps_is_empty (answer_caps)) { + GST_WARNING_OBJECT (webrtc, "Caps from offer for m-line %d (%" + GST_PTR_FORMAT ") don't intersect with caps from codec" + " preferences and transceiver %" GST_PTR_FORMAT, i, offer_caps, + current_caps); + gst_caps_unref (current_caps); + gst_caps_unref (answer_caps); + gst_caps_unref (offer_caps); + goto rejected; + } + gst_caps_unref (current_caps); + } /* XXX: In theory we're meant to use the sendrecv formats for the * inactive direction however we don't know what that may be and would |