pitch: Flush only if there are unprocessed samples
Otherwise we end up trying to flush before
sample rate of SoundTouch is set
https://bugzilla.gnome.org/show_bug.cgi?id=796613
diff --git a/ext/soundtouch/gstpitch.cc b/ext/soundtouch/gstpitch.cc
index c529bd7..281ae2b 100644
--- a/ext/soundtouch/gstpitch.cc
+++ b/ext/soundtouch/gstpitch.cc
@@ -390,10 +390,12 @@
gst_pitch_flush_buffer (GstPitch * pitch, gboolean send)
{
GstBuffer *buffer;
+
+ if (pitch->priv->st->numUnprocessedSamples() != 0) {
+ GST_DEBUG_OBJECT (pitch, "flushing buffer");
+ pitch->priv->st->flush ();
+ }
- GST_DEBUG_OBJECT (pitch, "flushing buffer");
-
- pitch->priv->st->flush ();
if (!send)
return GST_FLOW_OK;