From 286020bd23f204f7384ac552e9b876fc196463c5 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 31 Jan 2023 13:21:48 -0300 Subject: [PATCH] uridecodebin: Set source element to READY before querying it Generating the source element is done when uridecodebin is doing the READY to PAUSED state change, so it is reasonable to set the new source element to that state. This also allows detecting early failures with backing libraries or hardware (checks done in NULL->READY). Part-of: --- subprojects/gst-plugins-base/gst/playback/gsturidecodebin.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subprojects/gst-plugins-base/gst/playback/gsturidecodebin.c b/subprojects/gst-plugins-base/gst/playback/gsturidecodebin.c index a128d92..0e7ab34 100644 --- a/subprojects/gst-plugins-base/gst/playback/gsturidecodebin.c +++ b/subprojects/gst-plugins-base/gst/playback/gsturidecodebin.c @@ -2309,6 +2309,10 @@ setup_source (GstURIDecodeBin * decoder) /* stream admin setup */ decoder->streams = g_hash_table_new_full (NULL, NULL, NULL, free_stream); + if (gst_element_set_state (source, + GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) + goto state_fail; + /* see if the source element emits raw audio/video all by itself, * if so, we can create streams for the pads and be done with it. * Also check that is has source pads, if not, we assume it will @@ -2372,6 +2376,12 @@ no_source: /* error message was already posted */ return FALSE; } +state_fail: + { + GST_ELEMENT_ERROR (decoder, CORE, FAILED, + (_("Source element can't be prepared")), (NULL)); + return FALSE; + } invalid_source: { GST_ELEMENT_ERROR (decoder, CORE, FAILED, -- 2.7.4