mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
audiodecoder: fix timestamp tolerance handling
This commit is contained in:
parent
d8312994aa
commit
a7ce550d04
1 changed files with 4 additions and 4 deletions
|
@ -792,17 +792,17 @@ gst_audio_decoder_finish_frame (GstAudioDecoder * dec, GstBuffer * buf,
|
||||||
|
|
||||||
g_assert (GST_CLOCK_TIME_IS_VALID (priv->base_ts));
|
g_assert (GST_CLOCK_TIME_IS_VALID (priv->base_ts));
|
||||||
next_ts = priv->base_ts +
|
next_ts = priv->base_ts +
|
||||||
gst_util_uint64_scale (samples, GST_SECOND, ctx->info.rate);
|
gst_util_uint64_scale (priv->samples, GST_SECOND, ctx->info.rate);
|
||||||
GST_LOG_OBJECT (dec, "buffer is %d samples past base_ts %" GST_TIME_FORMAT
|
GST_LOG_OBJECT (dec, "buffer is %d samples past base_ts %" GST_TIME_FORMAT
|
||||||
", expected ts %" GST_TIME_FORMAT, samples,
|
", expected ts %" GST_TIME_FORMAT, priv->samples,
|
||||||
GST_TIME_ARGS (priv->base_ts), GST_TIME_ARGS (next_ts));
|
GST_TIME_ARGS (priv->base_ts), GST_TIME_ARGS (next_ts));
|
||||||
diff = GST_CLOCK_DIFF (next_ts, ts);
|
diff = GST_CLOCK_DIFF (next_ts, ts);
|
||||||
GST_LOG_OBJECT (dec, "ts diff %d ms", (gint) (diff / GST_MSECOND));
|
GST_LOG_OBJECT (dec, "ts diff %d ms", (gint) (diff / GST_MSECOND));
|
||||||
/* if within tolerance,
|
/* if within tolerance,
|
||||||
* discard buffer ts and carry on producing perfect stream,
|
* discard buffer ts and carry on producing perfect stream,
|
||||||
* otherwise resync to ts */
|
* otherwise resync to ts */
|
||||||
if (G_UNLIKELY (diff < -dec->priv->tolerance ||
|
if (G_UNLIKELY (diff < (gint64) - dec->priv->tolerance ||
|
||||||
diff > dec->priv->tolerance)) {
|
diff > (gint64) dec->priv->tolerance)) {
|
||||||
GST_DEBUG_OBJECT (dec, "base_ts resync");
|
GST_DEBUG_OBJECT (dec, "base_ts resync");
|
||||||
priv->base_ts = ts;
|
priv->base_ts = ts;
|
||||||
priv->samples = 0;
|
priv->samples = 0;
|
||||||
|
|
Loading…
Reference in a new issue