From c658e29d09984a1f45bc54e344fb5de027fcba03 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 9 Mar 2022 10:15:08 +0100 Subject: [PATCH] decodebin3: Convert checks to assertions "decodebin.input" is never resetted and should always be present, therefore make it an assertion check Part-of: --- .../gst-plugins-base/gst/playback/gstdecodebin3.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c index fd93284..c87ead3 100644 --- a/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c +++ b/subprojects/gst-plugins-base/gst/playback/gstdecodebin3.c @@ -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 -- 2.7.4