audiotestsrc: Fix crash in gst_audio_test_src_fill() 11/275511/6 accepted/tizen/unified/20220530.140619 submit/tizen/20220527.013222
authorGilbok Lee <gilbok.lee@samsung.com>
Thu, 26 May 2022 02:17:51 +0000 (11:17 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Fri, 27 May 2022 01:26:44 +0000 (10:26 +0900)
- src->process is changed to NULL,
  during gst_audio_test_src_fill operation

Change-Id: I8e0943a48b1071f13243fac67945322f8fc90571

packaging/gstreamer.spec
subprojects/gst-plugins-base/gst/audiotestsrc/gstaudiotestsrc.c
subprojects/gst-plugins-base/gst/audiotestsrc/gstaudiotestsrc.h
subprojects/gst-plugins-base/meson.build

index b5e4227..ce2229d 100644 (file)
@@ -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
index a15fe5b..31a53b4 100644 (file)
  * 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)
index cea3e52..ef345f0 100644 (file)
@@ -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);
index fe9bb0f..2c42ce1 100644 (file)
@@ -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)