summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2017-10-24 12:19:50 +0200
committerOlivier CrĂȘte <olivier.crete@collabora.com>2017-11-28 13:35:07 -0500
commit4211e4c29a262f110cb92ddf9c06b403ced233ef (patch)
treeb4f8d3e50392183013b345da0bd195da1b79a667
parent4c0a8a6d900db6aaf03a7483d460b79be2da0315 (diff)
downloadgst-omx-4211e4c29a262f110cb92ddf9c06b403ced233ef.tar.gz
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). https://bugzilla.gnome.org/show_bug.cgi?id=789475
-rw-r--r--omx/gstomx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c
index 6629d33..fc17ac8 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -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
&& port->buffers->len >
g_queue_get_length (&port->pending_buffers))) {