mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
gst-libs/gst/audio/gstbaseaudiosink.c: Guard against over and underflows because of clock slaving.
Original commit message from CVS: * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_skew_slaving), (gst_base_audio_sink_render): Guard against over and underflows because of clock slaving. When we are using our own clock, still compensate for any calibrations that we might have done to our clock.
This commit is contained in:
parent
495f45b245
commit
ce67ac6373
2 changed files with 17 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2008-04-03 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* gst-libs/gst/audio/gstbaseaudiosink.c:
|
||||||
|
(gst_base_audio_sink_skew_slaving), (gst_base_audio_sink_render):
|
||||||
|
Guard against over and underflows because of clock slaving.
|
||||||
|
When we are using our own clock, still compensate for any calibrations
|
||||||
|
that we might have done to our clock.
|
||||||
|
|
||||||
2008-04-03 Wim Taymans <wim.taymans@collabora.co.uk>
|
2008-04-03 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* ext/theora/theoradec.c: (theora_handle_type_packet),
|
* ext/theora/theoradec.c: (theora_handle_type_packet),
|
||||||
|
|
|
@ -870,8 +870,9 @@ gst_base_audio_sink_skew_slaving (GstBaseAudioSink * sink,
|
||||||
etime = gst_clock_get_time (GST_ELEMENT_CLOCK (sink));
|
etime = gst_clock_get_time (GST_ELEMENT_CLOCK (sink));
|
||||||
itime = gst_clock_get_internal_time (sink->provided_clock);
|
itime = gst_clock_get_internal_time (sink->provided_clock);
|
||||||
|
|
||||||
etime -= cexternal;
|
/* make sure we never go below 0 */
|
||||||
itime -= cinternal;
|
etime = etime > cexternal ? etime - cexternal : 0;
|
||||||
|
itime = itime > cinternal ? itime - cinternal : 0;
|
||||||
|
|
||||||
skew = GST_CLOCK_DIFF (etime, itime);
|
skew = GST_CLOCK_DIFF (etime, itime);
|
||||||
if (sink->priv->avg_skew == -1) {
|
if (sink->priv->avg_skew == -1) {
|
||||||
|
@ -896,7 +897,7 @@ gst_base_audio_sink_skew_slaving (GstBaseAudioSink * sink,
|
||||||
GST_WARNING_OBJECT (sink,
|
GST_WARNING_OBJECT (sink,
|
||||||
"correct clock skew %" G_GINT64_FORMAT " > %" G_GINT64_FORMAT,
|
"correct clock skew %" G_GINT64_FORMAT " > %" G_GINT64_FORMAT,
|
||||||
sink->priv->avg_skew, segtime2);
|
sink->priv->avg_skew, segtime2);
|
||||||
cinternal += segtime;
|
cexternal = cexternal > segtime ? cexternal - segtime : 0;
|
||||||
sink->priv->avg_skew -= segtime;
|
sink->priv->avg_skew -= segtime;
|
||||||
|
|
||||||
segsamples =
|
segsamples =
|
||||||
|
@ -1138,6 +1139,11 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
||||||
/* handle clock slaving */
|
/* handle clock slaving */
|
||||||
gst_base_audio_sink_handle_slaving (sink, render_start, render_stop,
|
gst_base_audio_sink_handle_slaving (sink, render_start, render_stop,
|
||||||
&render_start, &render_stop);
|
&render_start, &render_stop);
|
||||||
|
} else {
|
||||||
|
/* no slaving needed but we need to adapt to the clock calibration
|
||||||
|
* parameters */
|
||||||
|
gst_base_audio_sink_none_slaving (sink, render_start, render_stop,
|
||||||
|
&render_start, &render_stop);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and bring the time to the rate corrected offset in the buffer */
|
/* and bring the time to the rate corrected offset in the buffer */
|
||||||
|
|
Loading…
Reference in a new issue