summaryrefslogtreecommitdiff
path: root/ext/webrtc/gstwebrtcbin.c
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2021-03-26 15:54:35 -0400
committerOlivier CrĂȘte <olivier.crete@collabora.com>2021-04-12 17:55:07 -0400
commit92d356d4b07796fb734a72321315fead9688f57b (patch)
treed421d08bf0782581a4b93c248fd0ed699a93e24d /ext/webrtc/gstwebrtcbin.c
parent249b2d54d7068c6ea2943c7e2c9834716ceb3552 (diff)
downloadgstreamer-plugins-bad-92d356d4b07796fb734a72321315fead9688f57b.tar.gz
webrtcbin: Enforce same-kind on request sink pad with a specific name
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
Diffstat (limited to 'ext/webrtc/gstwebrtcbin.c')
-rw-r--r--ext/webrtc/gstwebrtcbin.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c
index fe4cff2f9..4d5e9215e 100644
--- a/ext/webrtc/gstwebrtcbin.c
+++ b/ext/webrtc/gstwebrtcbin.c
@@ -6235,14 +6235,27 @@ gst_webrtc_bin_request_new_pad (GstElement * element, GstPadTemplate * templ,
return NULL;
}
- if (caps && trans->codec_preferences) {
- if (!gst_caps_can_intersect (caps, trans->codec_preferences)) {
+ if (caps) {
+ if (trans->codec_preferences &&
+ !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;
}
+
+ if (trans->kind != GST_WEBRTC_KIND_UNKNOWN) {
+ GstWebRTCKind kind = _kind_from_caps (caps);
+
+ if (trans->kind != kind) {
+ 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 transceiver kind %d",
+ name, serial, caps, trans->kind);
+ return NULL;
+ }
+ }
}
}
}
@@ -6257,11 +6270,8 @@ gst_webrtc_bin_request_new_pad (GstElement * element, GstPadTemplate * templ,
}
pad = _create_pad_for_sdp_media (webrtc, GST_PAD_SINK, trans, serial);
- if (caps && name && !_update_transceiver_kind_from_caps (trans, caps))
- GST_WARNING_OBJECT (webrtc,
- "Trying to create pad %s with caps %" GST_PTR_FORMAT
- " but transceiver %d already exists with a different"
- " media type", name, caps, serial);
+ if (caps)
+ _update_transceiver_kind_from_caps (trans, caps);
pad->block_id = gst_pad_add_probe (GST_PAD (pad), GST_PAD_PROBE_TYPE_BLOCK |
GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST,