diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index e1dcaeeffe..fe4cff2f94 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -6234,6 +6234,16 @@ gst_webrtc_bin_request_new_pad (GstElement * element, GstPadTemplate * templ, gst_object_unref (pad2); return NULL; } + + if (caps && trans->codec_preferences) { + if (!gst_caps_can_intersect (caps, trans->codec_preferences)) { + GST_ERROR_OBJECT (element, "Tried to request a new sink pad %s for" + " existing m-line %d, but requested caps %" GST_PTR_FORMAT + " don't match existing codec preferences %" GST_PTR_FORMAT, + name, serial, caps, trans->codec_preferences); + return NULL; + } + } } }