mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-08 23:42:28 +00:00
webrtcbin: Reject pad request for a specific m-line if it already exists
This way, the app developer is in control. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2104>
This commit is contained in:
parent
0e2d128bec
commit
902e40cae2
1 changed files with 18 additions and 11 deletions
|
@ -6194,10 +6194,10 @@ gst_webrtc_bin_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
||||||
const gchar * name, const GstCaps * caps)
|
const gchar * name, const GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstWebRTCBin *webrtc = GST_WEBRTC_BIN (element);
|
GstWebRTCBin *webrtc = GST_WEBRTC_BIN (element);
|
||||||
GstWebRTCRTPTransceiver *trans;
|
GstWebRTCRTPTransceiver *trans = NULL;
|
||||||
GstWebRTCBinPad *pad = NULL;
|
GstWebRTCBinPad *pad = NULL;
|
||||||
GstWebRTCBinPad *pad2;
|
|
||||||
guint serial;
|
guint serial;
|
||||||
|
gboolean lock_mline = FALSE;
|
||||||
|
|
||||||
if (!_have_nice_elements (webrtc) || !_have_dtls_elements (webrtc))
|
if (!_have_nice_elements (webrtc) || !_have_dtls_elements (webrtc))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -6215,19 +6215,26 @@ gst_webrtc_bin_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
||||||
} else {
|
} else {
|
||||||
/* parse serial number from requested padname */
|
/* parse serial number from requested padname */
|
||||||
serial = g_ascii_strtoull (&name[5], NULL, 10);
|
serial = g_ascii_strtoull (&name[5], NULL, 10);
|
||||||
if (serial > webrtc->priv->max_sink_pad_serial)
|
lock_mline = TRUE;
|
||||||
webrtc->priv->max_sink_pad_serial = serial;
|
|
||||||
}
|
}
|
||||||
GST_OBJECT_UNLOCK (webrtc);
|
GST_OBJECT_UNLOCK (webrtc);
|
||||||
|
|
||||||
trans = _find_transceiver_for_mline (webrtc, serial);
|
if (lock_mline) {
|
||||||
|
GstWebRTCBinPad *pad2;
|
||||||
|
|
||||||
/* Ignore transceivers that already have a pad allocated */
|
trans = _find_transceiver_for_mline (webrtc, serial);
|
||||||
pad2 = _find_pad_for_transceiver (webrtc, GST_PAD_SINK, trans);
|
|
||||||
if (pad2) {
|
if (trans) {
|
||||||
serial = -1;
|
/* Ignore transceivers that already have a pad allocated */
|
||||||
trans = NULL;
|
pad2 = _find_pad_for_transceiver (webrtc, GST_PAD_SINK, trans);
|
||||||
gst_object_unref (pad2);
|
if (pad2) {
|
||||||
|
GST_ERROR_OBJECT (element, "Trying to request pad %s for m-line %d, "
|
||||||
|
" but the transceiver associated with this m-line already has pad"
|
||||||
|
" %s", name, serial, GST_PAD_NAME (pad2));
|
||||||
|
gst_object_unref (pad2);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!trans) {
|
if (!trans) {
|
||||||
|
|
Loading…
Reference in a new issue