return NULL;
}
- GST_OBJECT_LOCK (webrtc);
+ PC_LOCK (webrtc);
+
if (name == NULL || strlen (name) < 6 || !g_str_has_prefix (name, "sink_")) {
/* no name given when requesting the pad, use next available int */
serial = webrtc->priv->max_sink_pad_serial++;
serial = g_ascii_strtoull (&name[5], NULL, 10);
lock_mline = TRUE;
}
- GST_OBJECT_UNLOCK (webrtc);
if (lock_mline) {
GstWebRTCBinPad *pad2;
" existing m-line %d, but the transceiver's direction is %s",
name, serial, direction);
g_free (direction);
- return NULL;
+ goto error_out;
}
/* Reject transceivers that already have a pad allocated */
" but the transceiver associated with this m-line already has pad"
" %s", name, serial, GST_PAD_NAME (pad2));
gst_object_unref (pad2);
- return NULL;
+ goto error_out;
}
if (caps) {
" 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;
+ goto error_out;
}
if (trans->kind != GST_WEBRTC_KIND_UNKNOWN) {
" existing m-line %d, but requested caps %" GST_PTR_FORMAT
" don't match transceiver kind %d",
name, serial, caps, trans->kind);
- return NULL;
+ goto error_out;
}
}
}
webrtc->priv->pending_sink_transceivers =
g_list_append (webrtc->priv->pending_sink_transceivers,
gst_object_ref (pad));
- _add_pad (webrtc, pad);
if (lock_mline) {
WebRTCTransceiver *wtrans = WEBRTC_TRANSCEIVER (trans);
trans->mline = serial;
}
+ PC_UNLOCK (webrtc);
+
+ _add_pad (webrtc, pad);
+
return GST_PAD (pad);
+
+error_out:
+ PC_UNLOCK (webrtc);
+ return NULL;
}
static void