mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
audiobasesink: do big correction for large drift
If we are using skew slaving and we drift more than twice the allowed amount, do a big correction to get back on track more quickly.
This commit is contained in:
parent
24f3c80fef
commit
c9ff3e4f98
1 changed files with 16 additions and 4 deletions
|
@ -1272,8 +1272,14 @@ gst_audio_base_sink_skew_slaving (GstAudioBaseSink * sink,
|
|||
GST_WARNING_OBJECT (sink,
|
||||
"correct clock skew %" G_GINT64_FORMAT " > %" G_GINT64_FORMAT,
|
||||
sink->priv->avg_skew, mdrift2);
|
||||
cexternal = cexternal > mdrift ? cexternal - mdrift : 0;
|
||||
sink->priv->avg_skew -= mdrift;
|
||||
|
||||
if (sink->priv->avg_skew > (2 * mdrift)) {
|
||||
cexternal -= sink->priv->avg_skew;
|
||||
sink->priv->avg_skew = 0;
|
||||
} else {
|
||||
cexternal = cexternal > mdrift ? cexternal - mdrift : 0;
|
||||
sink->priv->avg_skew -= mdrift;
|
||||
}
|
||||
|
||||
driftsamples = (sink->ringbuffer->spec.info.rate * mdrift) / GST_SECOND;
|
||||
last_align = sink->priv->last_align;
|
||||
|
@ -1294,8 +1300,14 @@ gst_audio_base_sink_skew_slaving (GstAudioBaseSink * sink,
|
|||
GST_WARNING_OBJECT (sink,
|
||||
"correct clock skew %" G_GINT64_FORMAT " < %" G_GINT64_FORMAT,
|
||||
sink->priv->avg_skew, -mdrift2);
|
||||
cexternal += mdrift;
|
||||
sink->priv->avg_skew += mdrift;
|
||||
|
||||
if (sink->priv->avg_skew < (2 * -mdrift)) {
|
||||
cexternal -= sink->priv->avg_skew;
|
||||
sink->priv->avg_skew = 0;
|
||||
} else {
|
||||
cexternal += mdrift;
|
||||
sink->priv->avg_skew += mdrift;
|
||||
}
|
||||
|
||||
driftsamples = (sink->ringbuffer->spec.info.rate * mdrift) / GST_SECOND;
|
||||
last_align = sink->priv->last_align;
|
||||
|
|
Loading…
Reference in a new issue