From 68052a7bc3643ec7b918755492d342bfafadf4ee Mon Sep 17 00:00:00 2001 From: Suhas Nayak Date: Mon, 18 Jun 2018 07:39:10 +0530 Subject: [PATCH] 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 --- ext/soundtouch/gstpitch.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/soundtouch/gstpitch.cc b/ext/soundtouch/gstpitch.cc index c529bd7c2c..281ae2b966 100644 --- a/ext/soundtouch/gstpitch.cc +++ b/ext/soundtouch/gstpitch.cc @@ -390,10 +390,12 @@ static GstFlowReturn 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;