mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 13:36:39 +00:00
opensles: ensure that we register the callback only in STOPPED
Fixes the error registering the callback on the PLAYING -> PAUSE -> PLAYING state change sequence.
This commit is contained in:
parent
e265cec514
commit
97a1ccfab1
2 changed files with 23 additions and 12 deletions
|
@ -215,12 +215,15 @@ _opensles_recorder_start (GstRingBuffer * rb)
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
/* Register callback on the buffer queue */
|
/* Register callback on the buffer queue */
|
||||||
result = (*thiz->bufferQueue)->RegisterCallback (thiz->bufferQueue,
|
if (!thiz->is_queue_callback_registered) {
|
||||||
_opensles_recorder_cb, rb);
|
result = (*thiz->bufferQueue)->RegisterCallback (thiz->bufferQueue,
|
||||||
if (result != SL_RESULT_SUCCESS) {
|
_opensles_recorder_cb, rb);
|
||||||
GST_ERROR_OBJECT (thiz, "bufferQueue.RegisterCallback failed(0x%08x)",
|
if (result != SL_RESULT_SUCCESS) {
|
||||||
(guint32) result);
|
GST_ERROR_OBJECT (thiz, "bufferQueue.RegisterCallback failed(0x%08x)",
|
||||||
return FALSE;
|
(guint32) result);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
thiz->is_queue_callback_registered = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill the queue by enqueing buffers */
|
/* Fill the queue by enqueing buffers */
|
||||||
|
@ -264,6 +267,7 @@ _opensles_recorder_stop (GstRingBuffer * rb)
|
||||||
(guint32) result);
|
(guint32) result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
thiz->is_queue_callback_registered = FALSE;
|
||||||
|
|
||||||
/* Reset the queue */
|
/* Reset the queue */
|
||||||
result = (*thiz->bufferQueue)->Clear (thiz->bufferQueue);
|
result = (*thiz->bufferQueue)->Clear (thiz->bufferQueue);
|
||||||
|
@ -494,12 +498,15 @@ _opensles_player_start (GstRingBuffer * rb)
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
/* Register callback on the buffer queue */
|
/* Register callback on the buffer queue */
|
||||||
result = (*thiz->bufferQueue)->RegisterCallback (thiz->bufferQueue,
|
if (!thiz->is_queue_callback_registered) {
|
||||||
_opensles_player_cb, rb);
|
result = (*thiz->bufferQueue)->RegisterCallback (thiz->bufferQueue,
|
||||||
if (result != SL_RESULT_SUCCESS) {
|
_opensles_player_cb, rb);
|
||||||
GST_ERROR_OBJECT (thiz, "bufferQueue.RegisterCallback failed(0x%08x)",
|
if (result != SL_RESULT_SUCCESS) {
|
||||||
(guint32) result);
|
GST_ERROR_OBJECT (thiz, "bufferQueue.RegisterCallback failed(0x%08x)",
|
||||||
return FALSE;
|
(guint32) result);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
thiz->is_queue_callback_registered = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill the queue by enqueing buffers */
|
/* Fill the queue by enqueing buffers */
|
||||||
|
@ -561,6 +568,7 @@ _opensles_player_stop (GstRingBuffer * rb)
|
||||||
(guint32) result);
|
(guint32) result);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
thiz->is_queue_callback_registered = FALSE;
|
||||||
|
|
||||||
/* Reset the queue */
|
/* Reset the queue */
|
||||||
result = (*thiz->bufferQueue)->Clear (thiz->bufferQueue);
|
result = (*thiz->bufferQueue)->Clear (thiz->bufferQueue);
|
||||||
|
@ -571,6 +579,7 @@ _opensles_player_stop (GstRingBuffer * rb)
|
||||||
}
|
}
|
||||||
|
|
||||||
g_atomic_int_set (&thiz->segqueued, 0);
|
g_atomic_int_set (&thiz->segqueued, 0);
|
||||||
|
thiz->cursor = 0;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -900,4 +909,5 @@ gst_opensles_ringbuffer_init (GstOpenSLESRingBuffer * thiz,
|
||||||
thiz->outputMixObject = NULL;
|
thiz->outputMixObject = NULL;
|
||||||
thiz->playerObject = NULL;
|
thiz->playerObject = NULL;
|
||||||
thiz->recorderObject = NULL;
|
thiz->recorderObject = NULL;
|
||||||
|
thiz->is_queue_callback_registered = FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,7 @@ struct _GstOpenSLESRingBuffer
|
||||||
guint8 * data;
|
guint8 * data;
|
||||||
guint cursor;
|
guint cursor;
|
||||||
gint segqueued; /* ATOMIC */
|
gint segqueued; /* ATOMIC */
|
||||||
|
gboolean is_queue_callback_registered;
|
||||||
|
|
||||||
/* vmethods */
|
/* vmethods */
|
||||||
AcquireFunc acquire;
|
AcquireFunc acquire;
|
||||||
|
|
Loading…
Reference in a new issue