From 4b44169f058a15f25aa5b37a2b63994c0456ea5e Mon Sep 17 00:00:00 2001 From: Elliot Chen Date: Fri, 28 Feb 2025 11:29:56 +0900 Subject: [PATCH] gstplay: support disabling the selected track at startup In some cases, need to disable some type tracks at startup before receiving the stream collection message. And fix printing error log in this case. Part-of: --- subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c b/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c index 6b92228b51..5ae1d026f3 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/play/gstplay.c @@ -1773,7 +1773,7 @@ stream_collection_cb (G_GNUC_UNUSED GstBus * bus, GstMessage * msg, return; g_mutex_lock (&self->lock); - do_default_selection = self->collection != NULL; + do_default_selection = self->collection == NULL; updated = update_stream_collection (self, collection); gst_object_unref (collection); @@ -3447,6 +3447,9 @@ gst_play_select_streams (GstPlay * self) GList *stream_list = NULL; gboolean ret = FALSE; + if (!self->collection) + return FALSE; + if (self->audio_sid && self->audio_enabled) stream_list = g_list_append (stream_list, g_strdup (self->audio_sid)); if (self->video_sid && self->video_enabled)