pitch: Fix race between putSamples() and setting soundtouch parameters
authorDoug Nazar <nazard@nazar.ca>
Fri, 9 Aug 2019 06:41:51 +0000 (02:41 -0400)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 14 Aug 2019 17:39:47 +0000 (18:39 +0100)
The various soundtouch set*() functions may cause buffer (re)allocations
which interferes with inputting the audio data.

ext/soundtouch/gstpitch.cc

index 4fbe0ab..89bab3f 100644 (file)
@@ -876,7 +876,9 @@ gst_pitch_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
   }
 
   gst_buffer_map (buffer, &info, GST_MAP_READ);
+  GST_OBJECT_LOCK (pitch);
   priv->st->putSamples ((soundtouch::SAMPLETYPE *) info.data, info.size / pitch->info.bpf);
+  GST_OBJECT_UNLOCK (pitch);
   gst_buffer_unmap (buffer, &info);
   gst_buffer_unref (buffer);