omx: handle both errors in the two steps of update_port_definition

Also consider potential errors in the _get_parameter() in the return of the
update_port_definition function.

CID #1287052
This commit is contained in:
Luis de Bethencourt 2015-03-06 12:03:56 +00:00
parent 3aa008adb7
commit 70c48cf85f

View file

@ -1197,7 +1197,7 @@ OMX_ERRORTYPE
gst_omx_port_update_port_definition (GstOMXPort * port, gst_omx_port_update_port_definition (GstOMXPort * port,
OMX_PARAM_PORTDEFINITIONTYPE * port_def) OMX_PARAM_PORTDEFINITIONTYPE * port_def)
{ {
OMX_ERRORTYPE err = OMX_ErrorNone; OMX_ERRORTYPE err_get, err_set = OMX_ErrorNone;
GstOMXComponent *comp; GstOMXComponent *comp;
g_return_val_if_fail (port != NULL, FALSE); g_return_val_if_fail (port != NULL, FALSE);
@ -1205,16 +1205,19 @@ gst_omx_port_update_port_definition (GstOMXPort * port,
comp = port->comp; comp = port->comp;
if (port_def) if (port_def)
err = err_set =
gst_omx_component_set_parameter (comp, OMX_IndexParamPortDefinition, gst_omx_component_set_parameter (comp, OMX_IndexParamPortDefinition,
port_def); port_def);
gst_omx_component_get_parameter (comp, OMX_IndexParamPortDefinition, err_get = gst_omx_component_get_parameter (comp, OMX_IndexParamPortDefinition,
&port->port_def); &port->port_def);
GST_DEBUG_OBJECT (comp->parent, "Updated %s port %u definition: %s (0x%08x)", GST_DEBUG_OBJECT (comp->parent, "Updated %s port %u definition: %s (0x%08x)",
comp->name, port->index, gst_omx_error_to_string (err), err); comp->name, port->index, gst_omx_error_to_string (err_set), err_set);
return err; if (err_set != OMX_ErrorNone)
return err_set;
else
return err_get;
} }
/* NOTE: Uses comp->lock and comp->messages_lock */ /* NOTE: Uses comp->lock and comp->messages_lock */