diff --git a/ChangeLog b/ChangeLog index 654d8007d3..e3094409a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2004-06-07 Benjamin Otte + + * ext/alsa/gstalsa.c: (gst_alsa_samples_to_timestamp): + cast to GstClockTime to get higher granularity + * ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event): + use gst_element_set_time_delay to get the exact time + * ext/mad/gstmad.c: (gst_mad_chain): + use the negotiated rate instead of the current frame's rate which + might be wrong because of bit errors. This avoids emitting totally + bogus timestamps and screwing sync. + (fixes #143454) + 2004-06-07 Tim-Philipp Müller reviewed by Benjamin Otte diff --git a/ext/alsa/gstalsa.c b/ext/alsa/gstalsa.c index 655c8950fd..336233c943 100644 --- a/ext/alsa/gstalsa.c +++ b/ext/alsa/gstalsa.c @@ -1650,7 +1650,7 @@ gst_alsa_timestamp_to_samples (GstAlsa * this, GstClockTime time) inline GstClockTime gst_alsa_samples_to_timestamp (GstAlsa * this, snd_pcm_uframes_t samples) { - return (GstClockTime) (samples * GST_SECOND / this->format->rate); + return ((GstClockTime) samples) * GST_SECOND / this->format->rate; } inline snd_pcm_uframes_t diff --git a/ext/alsa/gstalsasink.c b/ext/alsa/gstalsasink.c index 325093b736..7743d332d8 100644 --- a/ext/alsa/gstalsasink.c +++ b/ext/alsa/gstalsasink.c @@ -210,20 +210,23 @@ gst_alsa_sink_check_event (GstAlsaSink * sink, gint pad_nr) break; case GST_EVENT_DISCONTINUOUS: { - GstClockTime value; + GstClockTime value, delay; /* only the first pad may seek */ if (pad_nr != 0) { break; } + delay = + GST_SECOND * this->transmitted / this->format->rate - + gst_alsa_sink_get_time (this); if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &value)) { - gst_element_set_time (GST_ELEMENT (this), value); + gst_element_set_time_delay (GST_ELEMENT (this), value, delay); } else if (this->format && (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT, &value) || gst_event_discont_get_value (event, GST_FORMAT_BYTES, &value))) { value = gst_alsa_samples_to_timestamp (this, value); - gst_element_set_time (GST_ELEMENT (this), value); + gst_element_set_time_delay (GST_ELEMENT (this), value, delay); } else { GST_WARNING_OBJECT (this, "couldn't extract time from discont event. Bad things might happen!");