summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJosep Torra <n770galaxy@gmail.com>2012-10-12 10:08:59 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-10-18 14:03:10 +0200
commite4810c3420201972ceb8a419e9bbc0b4a7b56f67 (patch)
tree823e282376fdedef3ae660876a31e33ee275d383 /sys
parent7c3a9c2974e77f23b8f226df8ea3a39fb2091266 (diff)
openslessink: Return 0 delay if the player object is in PAUSED state
Diffstat (limited to 'sys')
-rw-r--r--sys/opensles/openslesringbuffer.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/opensles/openslesringbuffer.c b/sys/opensles/openslesringbuffer.c
index ea17f7c77..8038821a0 100644
--- a/sys/opensles/openslesringbuffer.c
+++ b/sys/opensles/openslesringbuffer.c
@@ -887,13 +887,16 @@ gst_opensles_ringbuffer_delay (GstRingBuffer * rb)
thiz = GST_OPENSLES_RING_BUFFER_CAST (rb);
if (thiz->playerPlay) {
+ SLuint32 state;
SLmillisecond position;
- guint64 playedpos, queuedpos;
-
- (*thiz->playerPlay)->GetPosition (thiz->playerPlay, &position);
- playedpos = gst_util_uint64_scale_round (position, rb->spec.rate, 1000);
- queuedpos = g_atomic_int_get (&thiz->segqueued) * rb->samples_per_seg;
- res = queuedpos - playedpos;
+ guint64 playedpos = 0, queuedpos = 0;
+ (*thiz->playerPlay)->GetPlayState (thiz->playerPlay, &state);
+ if (state == SL_PLAYSTATE_PLAYING) {
+ (*thiz->playerPlay)->GetPosition (thiz->playerPlay, &position);
+ playedpos = gst_util_uint64_scale_round (position, rb->spec.rate, 1000);
+ queuedpos = g_atomic_int_get (&thiz->segqueued) * rb->samples_per_seg;
+ res = queuedpos - playedpos;
+ }
GST_LOG_OBJECT (thiz, "queued samples %" G_GUINT64_FORMAT " position %u ms "
"(%" G_GUINT64_FORMAT " samples) delay %u samples",