ext/soundtouch/gstpitch.cc: If we receive a new segment event, don't try to push...
authorMichael Smith <msmith@xiph.org>
Wed, 18 Jul 2007 20:56:22 +0000 (20:56 +0000)
committerMichael Smith <msmith@xiph.org>
Wed, 18 Jul 2007 20:56:22 +0000 (20:56 +0000)
Original commit message from CVS:
* ext/soundtouch/gstpitch.cc:
If we receive a new segment event, don't try to push buffers out
in response (without first sending it on!).
Instead, flush internal buffers on receiving flush events.
Fixes playback after seeking.

ChangeLog
ext/soundtouch/gstpitch.cc

index b9e084d7e7c89beef9b78d17d3ee3c0afc19d6ea..c94c4d7385f7c3c96b608da6345f8317509fed1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-07-18  Michael Smith  <msmith@fluendo.com>
+
+       * ext/soundtouch/gstpitch.cc:
+         If we receive a new segment event, don't try to push buffers out
+         in response (without first sending it on!).
+         Instead, flush internal buffers on receiving flush events.
+         Fixes playback after seeking.
+
 2007-07-18  Stefan Kost  <ensonic@users.sf.net>
 
        * gst/bayer/gstbayer2rgb.c: (gst_bayer2rgb_set_caps),
index 8b09c2c4a906aae88c7d3e02b070f38a4fc49980..da90c513567a83324cff16998c153d353b045723 100644 (file)
@@ -365,7 +365,7 @@ gst_pitch_prepare_buffer (GstPitch * pitch)
  * samples are sent out here as strictly necessary, because soundtouch could
  * append zero samples, which could disturb looping.  */
 static GstFlowReturn
-gst_pitch_flush_buffer (GstPitch * pitch)
+gst_pitch_flush_buffer (GstPitch * pitch, gboolean send)
 {
   GstBuffer *buffer;
 
@@ -375,6 +375,9 @@ gst_pitch_flush_buffer (GstPitch * pitch)
     return GST_FLOW_OK;
 
   pitch->priv->st->flush ();
+  if (!send)
+    return GST_FLOW_OK;
+
   buffer = gst_pitch_prepare_buffer (pitch);
 
   if (!buffer)
@@ -617,9 +620,11 @@ gst_pitch_sink_event (GstPad * pad, GstEvent * event)
   GST_LOG_OBJECT (pad, "received %s event", GST_EVENT_TYPE_NAME (event));
 
   switch (GST_EVENT_TYPE (event)) {
-    case GST_EVENT_NEWSEGMENT:
+    case GST_EVENT_FLUSH_STOP:
+      gst_pitch_flush_buffer (pitch, FALSE);
+      break;
     case GST_EVENT_EOS:
-      gst_pitch_flush_buffer (pitch);
+      gst_pitch_flush_buffer (pitch, TRUE);
       break;
     default:
       break;