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
This commit is contained in:
Guillaume Desmottes 2017-10-24 11:45:20 +02:00 committed by Olivier Crête
parent 0b4931236b
commit 4c0a8a6d90

View file

@ -1562,14 +1562,19 @@ gst_omx_port_set_flushing (GstOMXPort * port, GstClockTime timeout,
signalled = TRUE; signalled = TRUE;
last_error = OMX_ErrorNone; last_error = OMX_ErrorNone;
gst_omx_component_handle_messages (comp); gst_omx_component_handle_messages (comp);
while (signalled && last_error == OMX_ErrorNone && !port->flushed while (!port->flushed &&
&& port->buffers (port->buffers
&& port->buffers->len > g_queue_get_length (&port->pending_buffers)) { && port->buffers->len >
g_queue_get_length (&port->pending_buffers))) {
signalled = gst_omx_component_wait_message (comp, timeout); signalled = gst_omx_component_wait_message (comp, timeout);
if (signalled) if (signalled)
gst_omx_component_handle_messages (comp); gst_omx_component_handle_messages (comp);
last_error = comp->last_error; last_error = comp->last_error;
if (!signalled || last_error != OMX_ErrorNone)
/* Something gone wrong or we timed out */
break;
} }
port->flushed = FALSE; port->flushed = FALSE;