From: Benjamin Otte Date: Sun, 16 May 2004 16:06:42 +0000 (+0000) Subject: ext/alsa/gstalsasink.c: compute correct expected timestamps after seek (broken since... X-Git-Tag: 1.19.3~511^2~14231 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe680690c177395d486d2b26a8a2ad70d637c99a;p=platform%2Fupstream%2Fgstreamer.git ext/alsa/gstalsasink.c: compute correct expected timestamps after seek (broken since last commit) 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 --- diff --git a/ChangeLog b/ChangeLog index a42c48d09d..9f2434334c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-05-16 Benjamin Otte + + * 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 * ext/alsa/gstalsasink.c: (gst_alsa_sink_loop): diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index 55dd030bd5..fefe75cb38 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -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;