summaryrefslogtreecommitdiff
path: root/sys/opensles
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-02-10 16:18:34 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-02-10 16:18:34 +0100
commit4ccd4257725b2499ce6f154a718f07741cbf590c (patch)
treeb097d94bc6051d93183fa74b1b5abc0aca1e317d /sys/opensles
parent9ed4054a940677c123fdf7bdd8080616a690a6bf (diff)
downloadgstreamer-plugins-bad-4ccd4257725b2499ce6f154a718f07741cbf590c.tar.gz
openslesringbuffer: Only allocate at most half the number of internal buffers as external audioringbuffer ones
Otherwise we might end up reading too much from the audioringbuffer, which would result in reading silence.
Diffstat (limited to 'sys/opensles')
-rw-r--r--sys/opensles/openslesringbuffer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/opensles/openslesringbuffer.c b/sys/opensles/openslesringbuffer.c
index 74af26696..5f993ec80 100644
--- a/sys/opensles/openslesringbuffer.c
+++ b/sys/opensles/openslesringbuffer.c
@@ -358,9 +358,13 @@ _opensles_player_acquire (GstAudioRingBuffer * rb,
/* Configure audio source
* 4 buffers is the "typical" size as optimized inside Android's
* OpenSL ES, see frameworks/wilhelm/src/itfstruct.h BUFFER_HEADER_TYPICAL
+ *
+ * Also only use half of our segment size to make sure that there's always
+ * some more queued up in our ringbuffer and we don't start to read silence.
*/
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {
- SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, MIN (4, spec->segtotal)
+ SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, MIN (4, MAX (spec->segtotal >> 1,
+ 1))
};
SLDataSource audioSrc = { &loc_bufq, &format };