pitch: Fix race between putSamples() and setting soundtouch parameters

The various soundtouch set*() functions may cause buffer (re)allocations
which interferes with inputting the audio data.
This commit is contained in:
Doug Nazar 2019-08-09 02:41:51 -04:00 committed by Jan Schmidt
parent db157428ee
commit 52f736c233

View file

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