decodebin3: Convert checks to assertions

"decodebin.input" is never resetted and should always be present, therefore make
it an assertion check

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1900>
This commit is contained in:
Edward Hervey 2022-03-09 10:15:08 +01:00 committed by Edward Hervey
parent 9b94798d0b
commit c658e29d09

View file

@ -844,23 +844,19 @@ gst_decodebin3_input_pad_link (GstPad * pad, GstObject * parent, GstPad * peer)
{
GstDecodebin3 *dbin = (GstDecodebin3 *) parent;
GstPadLinkReturn res = GST_PAD_LINK_OK;
DecodebinInput *input;
DecodebinInput *input = g_object_get_data (G_OBJECT (pad), "decodebin.input");
g_return_val_if_fail (input, GST_PAD_LINK_REFUSED);
GST_LOG_OBJECT (parent, "Got link on input pad %" GST_PTR_FORMAT
". Creating parsebin if needed", pad);
if ((input = g_object_get_data (G_OBJECT (pad), "decodebin.input")) == NULL)
goto fail;
INPUT_LOCK (dbin);
if (!ensure_input_parsebin (dbin, input))
res = GST_PAD_LINK_REFUSED;
INPUT_UNLOCK (dbin);
return res;
fail:
GST_ERROR_OBJECT (parent, "Failed to retrieve input state from ghost pad");
return GST_PAD_LINK_REFUSED;
}
/* Drop duration query during _input_pad_unlink */
@ -885,14 +881,13 @@ static void
gst_decodebin3_input_pad_unlink (GstPad * pad, GstObject * parent)
{
GstDecodebin3 *dbin = (GstDecodebin3 *) parent;
DecodebinInput *input;
DecodebinInput *input = g_object_get_data (G_OBJECT (pad), "decodebin.input");
g_return_if_fail (input);
GST_LOG_OBJECT (parent, "Got unlink on input pad %" GST_PTR_FORMAT
". Removing parsebin.", pad);
if ((input = g_object_get_data (G_OBJECT (pad), "decodebin.input")) == NULL)
goto fail;
INPUT_LOCK (dbin);
if (input->parsebin == NULL) {
INPUT_UNLOCK (dbin);
@ -952,10 +947,6 @@ gst_decodebin3_input_pad_unlink (GstPad * pad, GstObject * parent)
}
INPUT_UNLOCK (dbin);
return;
fail:
GST_ERROR_OBJECT (parent, "Failed to retrieve input state from ghost pad");
return;
}
static void