mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
ext/alsa/gstalsa.c: cast to GstClockTime to get higher granularity
Original commit message from CVS: * 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)
This commit is contained in:
parent
5b6ffe42de
commit
b0d718fcc3
3 changed files with 19 additions and 4 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2004-06-07 Benjamin Otte <otte@gnome.org>
|
||||
|
||||
* 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 <t.i.m@zen.co.uk>
|
||||
|
||||
reviewed by Benjamin Otte <otte@gnome.org>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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!");
|
||||
|
|
Loading…
Reference in a new issue