summaryrefslogtreecommitdiff
path: root/sys/opensles
diff options
context:
space:
mode:
authorJosep Torra <n770galaxy@gmail.com>2012-10-01 12:54:15 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-10-18 14:03:10 +0200
commit7c3a9c2974e77f23b8f226df8ea3a39fb2091266 (patch)
tree476ec09eabd0ddcc6d3cd4c99f9a3e7e8d42f7a2 /sys/opensles
parentadcf73e43fab16b8d7ecaad2cf4df5a84a2ed1db (diff)
downloadgstreamer-plugins-bad-7c3a9c2974e77f23b8f226df8ea3a39fb2091266.tar.gz
opensles: fixes noise on seekeing
Diffstat (limited to 'sys/opensles')
-rw-r--r--sys/opensles/openslesringbuffer.c17
-rw-r--r--sys/opensles/openslesringbuffer.h1
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/opensles/openslesringbuffer.c b/sys/opensles/openslesringbuffer.c
index 55b6639b4..ea17f7c77 100644
--- a/sys/opensles/openslesringbuffer.c
+++ b/sys/opensles/openslesringbuffer.c
@@ -456,6 +456,7 @@ _opensles_player_acquire (GstRingBuffer * rb, GstRingBufferSpec * spec)
thiz->data_size = spec->segsize * thiz->data_segtotal;
thiz->data = g_malloc0 (thiz->data_size);
g_atomic_int_set (&thiz->segqueued, 0);
+ g_atomic_int_set (&thiz->is_prerolled, 0);
thiz->cursor = 0;
return TRUE;
@@ -534,8 +535,11 @@ _opensles_player_start (GstRingBuffer * rb)
}
/* Fill the queue by enqueing buffers */
- for (i = 0; i < thiz->data_segtotal; i++) {
- _opensles_player_cb (NULL, rb);
+ if (!g_atomic_int_get (&thiz->is_prerolled)) {
+ for (i = 0; i < thiz->data_segtotal; i++) {
+ _opensles_player_cb (NULL, rb);
+ }
+ g_atomic_int_set (&thiz->is_prerolled, 1);
}
/* Change player state into PLAYING */
@@ -907,9 +911,18 @@ gst_opensles_ringbuffer_clear_all (GstRingBuffer * rb)
thiz = GST_OPENSLES_RING_BUFFER_CAST (rb);
if (thiz->data) {
+ SLresult result;
+
memset (thiz->data, 0, thiz->data_size);
g_atomic_int_set (&thiz->segqueued, 0);
thiz->cursor = 0;
+ /* Reset the queue */
+ result = (*thiz->bufferQueue)->Clear (thiz->bufferQueue);
+ if (result != SL_RESULT_SUCCESS) {
+ GST_WARNING_OBJECT (thiz, "bufferQueue.Clear failed(0x%08x)",
+ (guint32) result);
+ }
+ g_atomic_int_set (&thiz->is_prerolled, 0);
}
GST_CALL_PARENT (GST_RING_BUFFER_CLASS, clear_all, (rb));
diff --git a/sys/opensles/openslesringbuffer.h b/sys/opensles/openslesringbuffer.h
index 8a192cbc2..7da6563d8 100644
--- a/sys/opensles/openslesringbuffer.h
+++ b/sys/opensles/openslesringbuffer.h
@@ -79,6 +79,7 @@ struct _GstOpenSLESRingBuffer
SLVolumeItf playerVolume;
gfloat volume;
gboolean mute;
+ gint is_prerolled; /* ATOMIC */
/* recorder interfaces */
SLObjectItf recorderObject;