summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2017-10-24 11:45:20 +0200
committerOlivier CrĂȘte <olivier.crete@collabora.com>2017-11-28 13:35:07 -0500
commit4c0a8a6d900db6aaf03a7483d460b79be2da0315 (patch)
treebe84a463fae9d503320b180ae11ae737270aad1c
parent0b4931236b22f749bcf62dcbcc802b48a542a93f (diff)
downloadgst-omx-4c0a8a6d900db6aaf03a7483d460b79be2da0315.tar.gz
gst_omx_port_set_flushing: simplify waiting loop
No semantic change so far, I just made the 'while' end condition easier to understand as a first step before changing it. - move error/time out checks inside the loop to make it clearer on what we are actually waiting for. - group port->buffers checks together with parenthesis as they are part of the same conceptual check: waiting for all buffers to be released. https://bugzilla.gnome.org/show_bug.cgi?id=789475
-rw-r--r--omx/gstomx.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c
index e81a5e4..6629d33 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -1562,14 +1562,19 @@ gst_omx_port_set_flushing (GstOMXPort * port, GstClockTime timeout,
signalled = TRUE;
last_error = OMX_ErrorNone;
gst_omx_component_handle_messages (comp);
- while (signalled && last_error == OMX_ErrorNone && !port->flushed
- && port->buffers
- && port->buffers->len > g_queue_get_length (&port->pending_buffers)) {
+ while (!port->flushed &&
+ (port->buffers
+ && port->buffers->len >
+ g_queue_get_length (&port->pending_buffers))) {
signalled = gst_omx_component_wait_message (comp, timeout);
if (signalled)
gst_omx_component_handle_messages (comp);
last_error = comp->last_error;
+
+ if (!signalled || last_error != OMX_ErrorNone)
+ /* Something gone wrong or we timed out */
+ break;
}
port->flushed = FALSE;