diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2018-08-22 15:52:23 +0200 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2018-08-29 12:19:52 -0400 |
commit | 2b7ad7f2fe1157c508e3bf6f66be447e3a38d137 (patch) | |
tree | 5c280fae4a2ae01ff7dd89056c77dc6d9526646b | |
parent | 7d08fc88e6a677c0a18fa879a7a7083827633db9 (diff) | |
download | gst-omx-2b7ad7f2fe1157c508e3bf6f66be447e3a38d137.tar.gz |
omx: factor out should_wait_until_flushed()
No semantic change. Makes the code easier to understand and I'm about to
change the waiting condition.
https://bugzilla.gnome.org/show_bug.cgi?id=789475
-rw-r--r-- | omx/gstomx.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c index b16cf50..ac6d4eb 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -1569,6 +1569,19 @@ done: return err; } +static gboolean +should_wait_until_flushed (GstOMXPort * port) +{ + if (port->flushed) + return FALSE; + + if (port->buffers + && port->buffers->len == g_queue_get_length (&port->pending_buffers)) + return FALSE; + + return TRUE; +} + /* NOTE: Uses comp->lock and comp->messages_lock */ OMX_ERRORTYPE gst_omx_port_set_flushing (GstOMXPort * port, GstClockTime timeout, @@ -1633,9 +1646,7 @@ gst_omx_port_set_flushing (GstOMXPort * port, GstClockTime timeout, } if (timeout == 0) { - if (!port->flushed || (port->buffers - && port->buffers->len > - g_queue_get_length (&port->pending_buffers))) + if (should_wait_until_flushed (port)) err = OMX_ErrorTimeout; goto done; } @@ -1646,10 +1657,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 && - (port->buffers - && port->buffers->len > - g_queue_get_length (&port->pending_buffers))) { + while (should_wait_until_flushed (port)) { signalled = gst_omx_component_wait_message (comp, timeout); if (signalled) gst_omx_component_handle_messages (comp); |