summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-05-31 15:12:05 +0200
committerSebastian Dröge <sebastian@centricular.com>2014-05-31 15:12:05 +0200
commit190adce12595f9596f3666fb4e7d25fb363ed289 (patch)
tree1667d4153090a81d8661fbec47e11e67cfc5ec59
parentbf7e6109d96fb8fef7123e64eb9791f8301785fb (diff)
downloadgst-omx-190adce12595f9596f3666fb4e7d25fb363ed289.tar.gz
omx: Don't handle disabling/enabling ports exactly like flushing
Otherwise we might abort a flush operation in another thread when enabling/disabling ports, leading to deadlocks sometimes. https://bugzilla.gnome.org/show_bug.cgi?id=730989
-rw-r--r--omx/gstomx.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c
index 616a5fc..6044668 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -1398,9 +1398,10 @@ gst_omx_port_release_buffer (GstOMXPort * port, GstOMXBuffer * buf)
goto done;
}
- if (port->flushing) {
- GST_DEBUG_OBJECT (comp->parent, "%s port %u is flushing, not releasing "
- "buffer", comp->name, port->index);
+ if (port->flushing || port->disabled_pending || !port->port_def.bEnabled) {
+ GST_DEBUG_OBJECT (comp->parent,
+ "%s port %u is flushing or disabled, not releasing " "buffer",
+ comp->name, port->index);
g_queue_push_tail (&port->pending_buffers, buf);
gst_omx_component_send_message (comp, NULL);
goto done;
@@ -1857,13 +1858,6 @@ gst_omx_port_set_enabled_unlocked (GstOMXPort * port, gboolean enabled)
else
port->disabled_pending = TRUE;
- if (!enabled) {
- /* This is also like flushing, i.e. all buffers are returned
- * by the component and no new buffers should be passed to
- * the component anymore */
- port->flushing = TRUE;
- }
-
if (enabled)
err =
OMX_SendCommand (comp->handle, OMX_CommandPortEnable, port->index,
@@ -2013,9 +2007,9 @@ gst_omx_port_populate_unlocked (GstOMXPort * port)
gst_omx_component_handle_messages (comp);
- if (port->flushing) {
- GST_DEBUG_OBJECT (comp->parent, "%s port %u is flushing", comp->name,
- port->index);
+ if (port->flushing || port->disabled_pending || !port->port_def.bEnabled) {
+ GST_DEBUG_OBJECT (comp->parent, "%s port %u is flushing or disabled",
+ comp->name, port->index);
err = OMX_ErrorIncorrectStateOperation;
goto done;
}
@@ -2146,7 +2140,6 @@ gst_omx_port_wait_enabled_unlocked (GstOMXPort * port, GstClockTime timeout)
err = last_error;
} else {
if (enabled) {
- port->flushing = FALSE;
/* Reset EOS flag */
port->eos = FALSE;
}