gst/wavparse/gstwavparse.c: Only set DISCONT when there actually is a discont or...
authorWim Taymans <wim.taymans@gmail.com>
Wed, 2 May 2007 18:25:09 +0000 (18:25 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 2 May 2007 18:25:09 +0000 (18:25 +0000)
Original commit message from CVS:
* gst/wavparse/gstwavparse.c: (gst_wavparse_perform_seek),
(gst_wavparse_stream_headers), (gst_wavparse_stream_data):
Only set DISCONT when there actually is a discont or when we just
started.

ChangeLog
gst/wavparse/gstwavparse.c

index fb6a18b..157166f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-05-02  Wim Taymans  <wim@fluendo.com>
+
+       * gst/wavparse/gstwavparse.c: (gst_wavparse_perform_seek),
+       (gst_wavparse_stream_headers), (gst_wavparse_stream_data):
+       Only set DISCONT when there actually is a discont or when we just
+       started.
+
 2007-05-02  Sebastian Dröge  <slomo@circular-chaos.org>
 
        * ext/flac/gstflac.c: (plugin_init):
index 81c62c1..bc7a48b 100644 (file)
@@ -736,6 +736,7 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event)
   gboolean flush;
   gboolean update;
   GstSegment seeksegment = { 0, };
+  gint64 last_stop;
 
   if (event) {
     GstFormat fmt;
@@ -793,6 +794,11 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event)
    * with the above flush/pause code */
   GST_PAD_STREAM_LOCK (wav->sinkpad);
 
+  /* save current position */
+  last_stop = wav->segment.last_stop;
+
+  GST_DEBUG_OBJECT (wav, "stopped streaming at %" G_GINT64_FORMAT, last_stop);
+
   /* copy segment, we need this because we still need the old
    * segment when we close the current segment. */
   memcpy (&seeksegment, &wav->segment, sizeof (GstSegment));
@@ -907,8 +913,11 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event)
       wav->segment.format, wav->segment.last_stop, stop,
       wav->segment.last_stop);
 
-  /* mark discont */
-  wav->discont = TRUE;
+  /* mark discont if we are going to stream from another position. */
+  if (last_stop != wav->segment.last_stop) {
+    GST_DEBUG_OBJECT (wav, "mark DISCONT, we did a seek to another position");
+    wav->discont = TRUE;
+  }
 
   /* and start the streaming task again */
   wav->segment_running = TRUE;
@@ -1286,6 +1295,9 @@ gst_wavparse_stream_headers (GstWavParse * wav)
   event_p = &wav->seek_event;
   gst_event_replace (event_p, NULL);
 
+  /* we just started, we are discont */
+  wav->discont = TRUE;
+
   wav->state = GST_WAVPARSE_DATA;
 
   return GST_FLOW_OK;
@@ -1564,6 +1576,7 @@ iterate_adapter:
     gst_segment_set_last_stop (&wav->segment, GST_FORMAT_TIME, next_timestamp);
 
     if (wav->discont) {
+      GST_DEBUG_OBJECT (wav, "marking DISCONT");
       GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
       wav->discont = FALSE;
     } else if (wav->vbr) {