diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2021-03-26 21:09:04 -0400 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2021-04-12 17:55:07 -0400 |
commit | 7f29486ba4b02c6e58550620796c4ec722efdb2d (patch) | |
tree | b72b1a97aee4fdf531953884b829507619c34678 /ext/webrtc/gstwebrtcbin.c | |
parent | 5971a9610992d08746e9137ea5b8bc4e2b2b61ae (diff) | |
download | gstreamer-plugins-bad-7f29486ba4b02c6e58550620796c4ec722efdb2d.tar.gz |
webrtcbin: Enforce direction 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.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index b21faa48b..88cdc5dd6 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -6302,6 +6302,7 @@ sink_pad_block (GstPad * pad, GstPadProbeInfo * info, gpointer unused) return GST_PAD_PROBE_OK; } + static GstPad * gst_webrtc_bin_request_new_pad (GstElement * element, GstPadTemplate * templ, const gchar * name, const GstCaps * caps) @@ -6338,7 +6339,20 @@ gst_webrtc_bin_request_new_pad (GstElement * element, GstPadTemplate * templ, trans = _find_transceiver_for_mline (webrtc, serial); if (trans) { - /* Ignore transceivers that already have a pad allocated */ + /* Reject transceivers that are only for receiving ... */ + if (trans->direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY || + trans->direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE) { + gchar *direction = + g_enum_to_string (GST_TYPE_WEBRTC_RTP_TRANSCEIVER_DIRECTION, + trans->direction); + GST_ERROR_OBJECT (element, "Tried to request a new sink pad %s for" + " existing m-line %d, but the transceiver's direction is %s", + name, serial, direction); + g_free (direction); + return NULL; + } + + /* Reject transceivers that already have a pad allocated */ pad2 = _find_pad_for_transceiver (webrtc, GST_PAD_SINK, trans); if (pad2) { GST_ERROR_OBJECT (element, "Trying to request pad %s for m-line %d, " |