diff options
author | Marijn Suijten <marijns95@gmail.com> | 2021-05-26 23:22:45 +0200 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2021-06-01 02:01:10 +0100 |
commit | 50aff43979944934252075facc8251db9bbef20d (patch) | |
tree | 22f3d5948528e214ceb115f931db6f15ce278f2c | |
parent | 0f86fca8da23ebf0ec24cf6a4e3cbb842e02da7b (diff) | |
download | gstreamer-plugins-base-50aff43979944934252075facc8251db9bbef20d.tar.gz |
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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1182>
-rw-r--r-- | gst-libs/gst/audio/audio-format.c | 4 | ||||
-rw-r--r-- | gst-libs/gst/video/video-format.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/gst-libs/gst/audio/audio-format.c b/gst-libs/gst/audio/audio-format.c index cc5345e5d..b79a49c73 100644 --- a/gst-libs/gst/audio/audio-format.c +++ b/gst-libs/gst/audio/audio-format.c @@ -530,13 +530,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 394ad9919..6168b99dd 100644 --- a/gst-libs/gst/video/video-format.c +++ b/gst-libs/gst/video/video-format.c @@ -7056,13 +7056,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); |