Commit 4211e4c2 authored by Guillaume Desmottes's avatar Guillaume Desmottes 🐐 Committed by Olivier Crête

omx: wait for flush complete and buffers being released when flushing

As stated in the existing comment, when flusing we should wait for OMX
to send the flush command complete event AND all ports being released.
We were stopping as soon as one of those condition was met.

Fix a race between FillThisBufferDone/EmptyBufferDone and the flush
EventCmdComplete messages. The OMX implementation is supposed to release
its buffers before posting the EventCmdComplete event but the ordering
isn't guaranteed as the FillThisBufferDone/EmptyBufferDone and
EventHandler callbacks can be called from different threads (cf 2.7
'Thread Safety' in the spec).
parent 4c0a8a6d
......@@ -1562,7 +1562,7 @@ gst_omx_port_set_flushing (GstOMXPort * port, GstClockTime timeout,
signalled = TRUE;
last_error = OMX_ErrorNone;
gst_omx_component_handle_messages (comp);
while (!port->flushed &&
while (!port->flushed ||
&& port->buffers->len >
g_queue_get_length (&port->pending_buffers))) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment