mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
opensles: implement the ringbuffer clear_all vmethod too
This commit is contained in:
parent
fc087f6419
commit
69426572f8
2 changed files with 20 additions and 2 deletions
|
@ -453,7 +453,9 @@ _opensles_player_acquire (GstRingBuffer * rb, GstRingBufferSpec * spec)
|
|||
|
||||
/* Allocate the queue associated ringbuffer memory */
|
||||
thiz->data_segtotal = loc_bufq.numBuffers;
|
||||
thiz->data = g_malloc (spec->segsize * thiz->data_segtotal);
|
||||
thiz->data_size = spec->segsize * thiz->data_segtotal;
|
||||
thiz->data = g_malloc0 (thiz->data_size);
|
||||
g_atomic_int_set (&thiz->segqueued, 0);
|
||||
thiz->cursor = 0;
|
||||
|
||||
return TRUE;
|
||||
|
@ -611,7 +613,6 @@ _opensles_player_stop (GstRingBuffer * rb)
|
|||
* OpenSL ES ringbuffer wrapper
|
||||
*/
|
||||
|
||||
|
||||
GstRingBuffer *
|
||||
gst_opensles_ringbuffer_new (RingBufferMode mode)
|
||||
{
|
||||
|
@ -898,6 +899,20 @@ gst_opensles_ringbuffer_delay (GstRingBuffer * rb)
|
|||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_opensles_ringbuffer_clear_all (GstRingBuffer * rb)
|
||||
{
|
||||
GstOpenSLESRingBuffer *thiz;
|
||||
|
||||
thiz = GST_OPENSLES_RING_BUFFER_CAST (rb);
|
||||
|
||||
if (thiz->data) {
|
||||
memset (thiz->data, 0, thiz->data_size);
|
||||
g_atomic_int_set (&thiz->segqueued, 0);
|
||||
thiz->cursor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_opensles_ringbuffer_dispose (GObject * object)
|
||||
{
|
||||
|
@ -947,6 +962,8 @@ gst_opensles_ringbuffer_class_init (GstOpenSLESRingBufferClass * klass)
|
|||
gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_opensles_ringbuffer_stop);
|
||||
gstringbuffer_class->delay =
|
||||
GST_DEBUG_FUNCPTR (gst_opensles_ringbuffer_delay);
|
||||
gstringbuffer_class->clear_all =
|
||||
GST_DEBUG_FUNCPTR (gst_opensles_ringbuffer_clear_all);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -88,6 +88,7 @@ struct _GstOpenSLESRingBuffer
|
|||
SLAndroidSimpleBufferQueueItf bufferQueue;
|
||||
guint data_segtotal;
|
||||
guint8 * data;
|
||||
guint data_size;
|
||||
guint cursor;
|
||||
gint segqueued; /* ATOMIC */
|
||||
gboolean is_queue_callback_registered;
|
||||
|
|
Loading…
Reference in a new issue