decodebin3: Post error messages if there are no streams to output

This could happen because:
* No streams were selected
* Or we end up with no stream selected

Also post a warning message if we are missing plugins but there are other
streams to output

Fixes #3360

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6377>
This commit is contained in:
Edward Hervey 2024-03-14 09:27:10 +01:00 committed by GStreamer Marge Bot
parent 2d875b5ed2
commit 80cd85d03d

View file

@ -2429,21 +2429,36 @@ check_inputs_and_slots_for_eos (GstDecodebin3 * dbin, GstEvent * ev)
} }
} }
/*
* Returns TRUE if there are no more streams to output and an ERROR message
* should be posted
*/
static inline gboolean
no_more_streams_locked (GstDecodebin3 * dbin)
{
return (!dbin->requested_selection && !dbin->active_selection
&& !dbin->to_activate);
}
static void static void
check_slot_reconfiguration (GstDecodebin3 * dbin, MultiQueueSlot * slot) check_slot_reconfiguration (GstDecodebin3 * dbin, MultiQueueSlot * slot)
{ {
DecodebinOutputStream *output; DecodebinOutputStream *output;
GstMessage *msg = NULL; GstMessage *msg = NULL;
gboolean no_more_streams;
SELECTION_LOCK (dbin); SELECTION_LOCK (dbin);
output = get_output_for_slot (slot); output = get_output_for_slot (slot);
if (!output) { if (!output) {
no_more_streams = no_more_streams_locked (dbin);
SELECTION_UNLOCK (dbin); SELECTION_UNLOCK (dbin);
if (no_more_streams)
GST_ELEMENT_ERROR (slot->dbin, STREAM, FAILED, (NULL),
("No streams to output"));
return; return;
} }
if (!reconfigure_output_stream (output, slot, &msg)) { if (!reconfigure_output_stream (output, slot, &msg)) {
gboolean no_more_streams;
GST_DEBUG_OBJECT (dbin, "Removing failing stream from selection: %s ", GST_DEBUG_OBJECT (dbin, "Removing failing stream from selection: %s ",
gst_stream_get_stream_id (slot->active_stream)); gst_stream_get_stream_id (slot->active_stream));
slot->dbin->requested_selection = slot->dbin->requested_selection =
@ -2452,14 +2467,17 @@ check_slot_reconfiguration (GstDecodebin3 * dbin, MultiQueueSlot * slot)
slot->dbin->active_selection = slot->dbin->active_selection =
remove_from_list (slot->dbin->active_selection, remove_from_list (slot->dbin->active_selection,
gst_stream_get_stream_id (slot->active_stream)); gst_stream_get_stream_id (slot->active_stream));
no_more_streams = slot->dbin->requested_selection == NULL; no_more_streams = no_more_streams_locked (dbin);
dbin->selection_updated = TRUE; dbin->selection_updated = TRUE;
SELECTION_UNLOCK (dbin); SELECTION_UNLOCK (dbin);
if (msg) if (msg)
gst_element_post_message ((GstElement *) slot->dbin, msg); gst_element_post_message ((GstElement *) slot->dbin, msg);
if (no_more_streams) if (no_more_streams)
GST_ELEMENT_ERROR (slot->dbin, CORE, MISSING_PLUGIN, (NULL), GST_ELEMENT_ERROR (slot->dbin, CORE, MISSING_PLUGIN, (NULL),
("no suitable plugins found")); ("No suitable plugins found"));
else
GST_ELEMENT_WARNING (slot->dbin, CORE, MISSING_PLUGIN, (NULL),
("Some plugins were missing"));
reassign_slot (dbin, slot); reassign_slot (dbin, slot);
} else { } else {
GstMessage *selection_msg = is_selection_done (dbin); GstMessage *selection_msg = is_selection_done (dbin);