From c1ddab893ba49aafd585c84b97fb5fcf8194fad7 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Thu, 26 May 2022 11:17:51 +0900 Subject: [PATCH] audiotestsrc: Fix crash in gst_audio_test_src_fill() - src->process is changed to NULL, during gst_audio_test_src_fill operation Change-Id: I8e0943a48b1071f13243fac67945322f8fc90571 --- packaging/gstreamer.spec | 2 +- .../gst/audiotestsrc/gstaudiotestsrc.c | 23 +++++++++++++++++----- .../gst/audiotestsrc/gstaudiotestsrc.h | 3 +++ subprojects/gst-plugins-base/meson.build | 1 + 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/packaging/gstreamer.spec b/packaging/gstreamer.spec index b5e4227..ce2229d 100644 --- a/packaging/gstreamer.spec +++ b/packaging/gstreamer.spec @@ -60,7 +60,7 @@ Name: %{_name} Version: 1.20.0 -Release: 24 +Release: 25 Summary: Streaming-Media Framework Runtime License: LGPL-2.0+ Group: Multimedia/Framework diff --git a/subprojects/gst-plugins-base/gst/audiotestsrc/gstaudiotestsrc.c b/subprojects/gst-plugins-base/gst/audiotestsrc/gstaudiotestsrc.c index a15fe5b..31a53b4 100644 --- a/subprojects/gst-plugins-base/gst/audiotestsrc/gstaudiotestsrc.c +++ b/subprojects/gst-plugins-base/gst/audiotestsrc/gstaudiotestsrc.c @@ -27,15 +27,15 @@ * Waveform specific notes: * * ## Gaussian white noise - * + * * This waveform produces white (zero mean) Gaussian noise. * Volume sets the standard deviation of the noise in units of the range * of values of the sample type, e.g. volume=0.1 produces noise with a * standard deviation of 0.1*32767=3277 with 16-bit integer samples, * or 0.1*1.0=0.1 with floating-point samples. - * + * * ## Ticks - * + * * This waveform is special in that it does not produce one continuous * signal. Instead, it produces finite-length sine wave pulses (the "ticks"). * It is useful for detecting time shifts between audio signal, for example @@ -340,6 +340,9 @@ gst_audio_test_src_init (GstAudioTestSrc * src) src->wave = DEFAULT_WAVE; gst_base_src_set_blocksize (GST_BASE_SRC (src), -1); +#ifdef TIZEN_FEATURE_FIX_SEG_FAULT + g_mutex_init (&src->func_lock); +#endif } static void @@ -353,7 +356,9 @@ gst_audio_test_src_finalize (GObject * object) g_free (src->tmp); src->tmp = NULL; src->tmpsize = 0; - +#ifdef TIZEN_FEATURE_FIX_SEG_FAULT + g_mutex_clear (&src->func_lock); +#endif G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -1200,7 +1205,9 @@ static void gst_audio_test_src_change_wave (GstAudioTestSrc * src) { gint idx; - +#ifdef TIZEN_FEATURE_FIX_SEG_FAULT + g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&src->func_lock); +#endif src->pack_func = NULL; src->process = NULL; @@ -1541,6 +1548,9 @@ gst_audio_test_src_fill (GstBaseSrc * basesrc, guint64 offset, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer))); gst_buffer_map (buffer, &map, GST_MAP_WRITE); +#ifdef TIZEN_FEATURE_FIX_SEG_FAULT + g_mutex_lock (&src->func_lock); +#endif if (src->pack_func) { gsize tmpsize; @@ -1559,6 +1569,9 @@ gst_audio_test_src_fill (GstBaseSrc * basesrc, guint64 offset, } else { src->process (src, map.data); } +#ifdef TIZEN_FEATURE_FIX_SEG_FAULT + g_mutex_unlock (&src->func_lock); +#endif gst_buffer_unmap (buffer, &map); if (G_UNLIKELY ((src->wave == GST_AUDIO_TEST_SRC_WAVE_SILENCE) diff --git a/subprojects/gst-plugins-base/gst/audiotestsrc/gstaudiotestsrc.h b/subprojects/gst-plugins-base/gst/audiotestsrc/gstaudiotestsrc.h index cea3e52..ef345f0 100644 --- a/subprojects/gst-plugins-base/gst/audiotestsrc/gstaudiotestsrc.h +++ b/subprojects/gst-plugins-base/gst/audiotestsrc/gstaudiotestsrc.h @@ -133,6 +133,9 @@ struct _GstAudioTestSrc { gboolean apply_tick_ramp; guint samples_between_ticks; guint tick_counter; +#ifdef TIZEN_FEATURE_FIX_SEG_FAULT + GMutex func_lock; +#endif }; GST_ELEMENT_REGISTER_DECLARE (audiotestsrc); diff --git a/subprojects/gst-plugins-base/meson.build b/subprojects/gst-plugins-base/meson.build index fe9bb0f..2c42ce1 100644 --- a/subprojects/gst-plugins-base/meson.build +++ b/subprojects/gst-plugins-base/meson.build @@ -376,6 +376,7 @@ else endif # TIZEN_BUILD_OPTION +core_conf.set('TIZEN_FEATURE_FIX_SEG_FAULT', true) core_conf.set('TIZEN_FEATURE_WAYLAND_ENHANCEMENT', true) core_conf.set('TIZEN_FEATURE_TYPEFIND_ENHANCEMENT', true) core_conf.set('TIZEN_FEATURE_AUDIODECODER_MODIFICATION', true) -- 2.7.4