summaryrefslogtreecommitdiff
path: root/sys/opensles
diff options
context:
space:
mode:
authorJosep Torra <n770galaxy@gmail.com>2012-09-27 17:27:24 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-10-18 14:03:09 +0200
commit08ef2e3eede3cd4663c86c2cd6a2aad918854693 (patch)
treee6784bf6042b18cd5c331e4048cef23f24b829f1 /sys/opensles
parent3698d9892116fcb8d0b1be5490db809c6e272bb6 (diff)
downloadgstreamer-plugins-bad-08ef2e3eede3cd4663c86c2cd6a2aad918854693.tar.gz
opensles: only drain half ringbuffer on start
At start drain half ringbuffer into the OpenSL so the writting/reading pointers will start at half ringbuffer distance.
Diffstat (limited to 'sys/opensles')
-rw-r--r--sys/opensles/openslesringbuffer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/opensles/openslesringbuffer.c b/sys/opensles/openslesringbuffer.c
index 1bc7f589c..c2af73aa3 100644
--- a/sys/opensles/openslesringbuffer.c
+++ b/sys/opensles/openslesringbuffer.c
@@ -348,7 +348,7 @@ _opensles_player_acquire (GstRingBuffer * rb, GstRingBufferSpec * spec)
/* Configure audio source */
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {
- SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, spec->segtotal
+ SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, (spec->segtotal >> 1)
};
SLDataSource audioSrc = { &loc_bufq, &format };
@@ -439,7 +439,7 @@ _opensles_player_acquire (GstRingBuffer * rb, GstRingBufferSpec * spec)
_opensles_player_change_mute (rb);
/* Define our queue data buffer */
- thiz->data_segtotal = spec->segtotal + 1;
+ thiz->data_segtotal = loc_bufq.numBuffers + 1;
thiz->data = g_malloc (spec->segsize * thiz->data_segtotal);
thiz->cursor = 0;
@@ -502,7 +502,7 @@ _opensles_player_start (GstRingBuffer * rb)
}
/* Fill the queue by enqueing buffers */
- for (i = 0; i < rb->spec.segtotal; i++) {
+ for (i = 0; i < (rb->spec.segtotal >> 1); i++) {
_opensles_player_cb (NULL, rb);
}