openslesringbuffer: Warn if the position reported by OpenSL is higher than what we queued up so far

This would hint at wrong position reporting, and apparently sometimes happens
after a seek.
This commit is contained in:
Sebastian Dröge 2016-03-16 12:03:53 +02:00
parent a032347c77
commit 0acdcc1b37

View file

@ -973,8 +973,15 @@ gst_opensles_ringbuffer_delay (GstAudioRingBuffer * rb)
playedpos = playedpos =
gst_util_uint64_scale_round (position, rb->spec.info.rate, 1000); gst_util_uint64_scale_round (position, rb->spec.info.rate, 1000);
queuedpos = g_atomic_int_get (&thiz->segqueued) * rb->samples_per_seg; queuedpos = g_atomic_int_get (&thiz->segqueued) * rb->samples_per_seg;
if (queuedpos < playedpos) {
res = 0;
GST_ERROR_OBJECT (thiz,
"Queued position smaller than playback position (%" G_GUINT64_FORMAT
" < %" G_GUINT64_FORMAT ")", queuedpos, playedpos);
} else {
res = queuedpos - playedpos; res = queuedpos - playedpos;
} }
}
GST_LOG_OBJECT (thiz, "queued samples %" G_GUINT64_FORMAT " position %u ms " GST_LOG_OBJECT (thiz, "queued samples %" G_GUINT64_FORMAT " position %u ms "
"(%" G_GUINT64_FORMAT " samples) delay %u samples", "(%" G_GUINT64_FORMAT " samples) delay %u samples",