From: Marijn Suijten Date: Wed, 26 May 2021 21:22:45 +0000 (+0200) Subject: audio,video-format: Make generate_raw_formats idempotent for assertions X-Git-Tag: 1.19.3~511^2~108 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a502c15c6449b33a6f1f9f107d32a96f84041b2;p=platform%2Fupstream%2Fgstreamer.git audio,video-format: Make generate_raw_formats idempotent for assertions When compiling without assertions `g_assert` and its contents disappear resulting in no list being deserialized at all and the `gst_{audio,video}_formats_raw` functions to return an empty collection. Part-of: --- diff --git a/gst-libs/gst/audio/audio-format.c b/gst-libs/gst/audio/audio-format.c index 90551ea..17320d2 100644 --- a/gst-libs/gst/audio/audio-format.c +++ b/gst-libs/gst/audio/audio-format.c @@ -550,13 +550,15 @@ generate_raw_audio_formats (gpointer data) struct RawAudioFormats *all = g_new (struct RawAudioFormats, 1); gchar *tmp; guint i; + gboolean res G_GNUC_UNUSED; g_value_init (&list, GST_TYPE_LIST); /* Workaround a bug in our parser that would lead to segfaults * when deserializing container types using static strings, * see https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/446 */ tmp = g_strdup (GST_AUDIO_FORMATS_ALL); - g_assert (gst_value_deserialize (&list, tmp)); + res = gst_value_deserialize (&list, tmp); + g_assert (res); g_free (tmp); all->n = gst_value_list_get_size (&list); diff --git a/gst-libs/gst/video/video-format.c b/gst-libs/gst/video/video-format.c index 75030b6..8b1bfa3 100644 --- a/gst-libs/gst/video/video-format.c +++ b/gst-libs/gst/video/video-format.c @@ -7217,13 +7217,15 @@ generate_raw_video_formats (gpointer data) struct RawVideoFormats *all = g_new (struct RawVideoFormats, 1); gchar *tmp; guint i; + gboolean res G_GNUC_UNUSED; g_value_init (&list, GST_TYPE_LIST); /* Workaround a bug in our parser that would lead to segfaults * when deserializing container types using static strings, * see https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/446 */ tmp = g_strdup (GST_VIDEO_FORMATS_ALL); - g_assert (gst_value_deserialize (&list, tmp)); + res = gst_value_deserialize (&list, tmp); + g_assert (res); g_free (tmp); all->n = gst_value_list_get_size (&list);