ext/alsa/gstalsasink.c: compute correct expected timestamps after seek (broken since...
authorBenjamin Otte <otte@gnome.org>
Sun, 16 May 2004 16:06:42 +0000 (16:06 +0000)
committerBenjamin Otte <otte@gnome.org>
Sun, 16 May 2004 16:06:42 +0000 (16:06 +0000)
Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
compute correct expected timestamps after seek (broken since
last commit)
* ext/gdk_pixbuf/pixbufscale.c: (pixbufscale_init):
rename element and debugging category to gdkpixbufscale

ChangeLog
ext/alsa/gstalsasink.c

index a42c48d09ddedd6ef83917f43dba085b1ce46096..9f2434334ccfedf2d52b78a661514049bf4d21a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-05-16  Benjamin Otte  <otte@gnome.org>
+
+       * ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
+         compute correct expected timestamps after seek (broken since
+         last commit)
+       * ext/gdk_pixbuf/pixbufscale.c: (pixbufscale_init):
+         rename element and debugging category to gdkpixbufscale
+
 2004-05-16  Benjamin Otte  <otte@gnome.org>
 
        * ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):
index 55dd030bd59a950d2b6bbc9db33f224d29e81ee2..fefe75cb38d0643c6261a4469be62da65ac7d3b7 100644 (file)
@@ -229,7 +229,6 @@ gst_alsa_sink_check_event (GstAlsaSink * sink, gint pad_nr)
               "couldn't extract time from discont event. Bad things might happen!");
         }
 
-
         break;
       }
       default:
@@ -371,19 +370,28 @@ sink_restart:
             gst_alsa_timestamp_to_samples (this,
             GST_BUFFER_TIMESTAMP (sink->buf[i]));
         max_discont = gst_alsa_timestamp_to_samples (this, this->max_discont);
-        if (snd_pcm_delay (this->handle, &sample_diff) != 0) {
-          sample_diff = 0;
-        }
         /* optimization: check if we're using our own clock
          * This optimization is important because if we're using our own clock 
          * gst_element_get_time calls snd_pcm_delay and the following code assumes
          * that both calls return the same value. However they can be wildly 
          * different, since snd_pcm_delay goes deep into the kernel.
          */
-        if (gst_element_get_clock (GST_ELEMENT (this)) ==
-            GST_CLOCK (GST_ALSA (this)->clock)) {
-          expected = this->transmitted;
+        if (gst_element_get_clock (element) == GST_CLOCK (this->clock)) {
+          /* FIXME: this is ugly because of the variables it uses but I don't know a 
+           * better way to get this info */
+          if (element->base_time > this->clock->start_time) {
+            expected =
+                this->transmitted - gst_alsa_timestamp_to_samples (this,
+                element->base_time - this->clock->start_time);
+          } else {
+            expected =
+                this->transmitted + gst_alsa_timestamp_to_samples (this,
+                this->clock->start_time - element->base_time);
+          }
         } else {
+          if (snd_pcm_delay (this->handle, &sample_diff) != 0) {
+            sample_diff = 0;
+          }
           expected =
               gst_alsa_timestamp_to_samples (this,
               gst_element_get_time (GST_ELEMENT (this))) + sample_diff;