mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-01 01:33:52 +00:00
omx: Don't use port_def.bEnabled to check if the Enable/Disable command is finished
bEnabled should be set immediately after sending the command, it's only Bellagio that waits until the command is finished before setting it.
This commit is contained in:
parent
11d2e806c2
commit
5d4f7890c2
2 changed files with 10 additions and 6 deletions
13
omx/gstomx.c
13
omx/gstomx.c
|
@ -206,6 +206,7 @@ EventHandler (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent,
|
||||||
(cmd == OMX_CommandPortEnable ? "enabled" : "disabled"));
|
(cmd == OMX_CommandPortEnable ? "enabled" : "disabled"));
|
||||||
|
|
||||||
g_mutex_lock (port->port_lock);
|
g_mutex_lock (port->port_lock);
|
||||||
|
port->enabled_changed = TRUE;
|
||||||
g_cond_broadcast (port->port_cond);
|
g_cond_broadcast (port->port_cond);
|
||||||
g_mutex_unlock (port->port_lock);
|
g_mutex_unlock (port->port_lock);
|
||||||
|
|
||||||
|
@ -1103,6 +1104,8 @@ gst_omx_port_set_enabled_unlocked (GstOMXPort * port, gboolean enabled)
|
||||||
if (! !port->port_def.bEnabled == ! !enabled)
|
if (! !port->port_def.bEnabled == ! !enabled)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
port->enabled_changed = FALSE;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
err =
|
err =
|
||||||
OMX_SendCommand (comp->handle, OMX_CommandPortEnable, port->index,
|
OMX_SendCommand (comp->handle, OMX_CommandPortEnable, port->index,
|
||||||
|
@ -1125,10 +1128,6 @@ gst_omx_port_set_enabled_unlocked (GstOMXPort * port, gboolean enabled)
|
||||||
timeval = &abstimeout;
|
timeval = &abstimeout;
|
||||||
GST_DEBUG_OBJECT (comp->parent, "Waiting for 5s");
|
GST_DEBUG_OBJECT (comp->parent, "Waiting for 5s");
|
||||||
|
|
||||||
/* FIXME XXX: The spec says that bEnabled should be set *immediately*
|
|
||||||
* but bellagio sets bEnabled after all buffers are allocated/deallocated
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* First wait until all buffers are released by the port */
|
/* First wait until all buffers are released by the port */
|
||||||
signalled = TRUE;
|
signalled = TRUE;
|
||||||
last_error = OMX_ErrorNone;
|
last_error = OMX_ErrorNone;
|
||||||
|
@ -1144,11 +1143,13 @@ gst_omx_port_set_enabled_unlocked (GstOMXPort * port, gboolean enabled)
|
||||||
GST_ERROR_OBJECT (comp->parent,
|
GST_ERROR_OBJECT (comp->parent,
|
||||||
"Got error while waiting for port %u to release all buffers: %d",
|
"Got error while waiting for port %u to release all buffers: %d",
|
||||||
port->index, err);
|
port->index, err);
|
||||||
|
goto done;
|
||||||
} else if (!signalled) {
|
} else if (!signalled) {
|
||||||
GST_ERROR_OBJECT (comp->parent,
|
GST_ERROR_OBJECT (comp->parent,
|
||||||
"Timeout waiting for port %u to release all buffers", port->index);
|
"Timeout waiting for port %u to release all buffers", port->index);
|
||||||
err = OMX_ErrorTimeout;
|
err = OMX_ErrorTimeout;
|
||||||
gst_omx_component_set_last_error (comp, err);
|
gst_omx_component_set_last_error (comp, err);
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate/deallocate all buffers for the port to finish
|
/* Allocate/deallocate all buffers for the port to finish
|
||||||
|
@ -1174,13 +1175,15 @@ gst_omx_port_set_enabled_unlocked (GstOMXPort * port, gboolean enabled)
|
||||||
OMX_GetParameter (comp->handle, OMX_IndexParamPortDefinition,
|
OMX_GetParameter (comp->handle, OMX_IndexParamPortDefinition,
|
||||||
&port->port_def);
|
&port->port_def);
|
||||||
while (signalled && last_error == OMX_ErrorNone
|
while (signalled && last_error == OMX_ErrorNone
|
||||||
&& (! !port->port_def.bEnabled != ! !enabled)) {
|
&& (! !port->port_def.bEnabled != ! !enabled || !port->enabled_changed)) {
|
||||||
signalled = g_cond_timed_wait (port->port_cond, port->port_lock, timeval);
|
signalled = g_cond_timed_wait (port->port_cond, port->port_lock, timeval);
|
||||||
last_error = gst_omx_component_get_last_error (comp);
|
last_error = gst_omx_component_get_last_error (comp);
|
||||||
OMX_GetParameter (comp->handle, OMX_IndexParamPortDefinition,
|
OMX_GetParameter (comp->handle, OMX_IndexParamPortDefinition,
|
||||||
&port->port_def);
|
&port->port_def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
port->enabled_changed = FALSE;
|
||||||
|
|
||||||
if (!signalled) {
|
if (!signalled) {
|
||||||
GST_ERROR_OBJECT (comp->parent,
|
GST_ERROR_OBJECT (comp->parent,
|
||||||
"Timeout waiting for port %u to be enabled/disabled", port->index);
|
"Timeout waiting for port %u to be enabled/disabled", port->index);
|
||||||
|
|
|
@ -57,7 +57,7 @@ struct _GstOMXPort {
|
||||||
guint32 index;
|
guint32 index;
|
||||||
|
|
||||||
/* Protects port_def, buffers, pending_buffers,
|
/* Protects port_def, buffers, pending_buffers,
|
||||||
* settings_changed, flushing and flushed.
|
* settings_changed, flushing, flushed, enabled_changed.
|
||||||
*
|
*
|
||||||
* Signalled if pending_buffers gets a
|
* Signalled if pending_buffers gets a
|
||||||
* new buffer or flushing/flushed is set
|
* new buffer or flushing/flushed is set
|
||||||
|
@ -80,6 +80,7 @@ struct _GstOMXPort {
|
||||||
gboolean settings_changed;
|
gboolean settings_changed;
|
||||||
gboolean flushing;
|
gboolean flushing;
|
||||||
gboolean flushed; /* TRUE after OMX_CommandFlush was done */
|
gboolean flushed; /* TRUE after OMX_CommandFlush was done */
|
||||||
|
gboolean enabled_changed; /* TRUE after OMX_Command{En,Dis}able was done */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstOMXComponent {
|
struct _GstOMXComponent {
|
||||||
|
|
Loading…
Reference in a new issue