omxvideodec: Only enable the output port after we know the output format

This commit is contained in:
Sebastian Dröge 2013-02-28 17:02:31 +01:00
parent 0bb816e32c
commit 63e0d61971

View file

@ -576,7 +576,8 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
GST_DEBUG_OBJECT (self, "Port settings have changed, updating caps");
/* Reallocate all buffers */
if (acq_return == GST_OMX_ACQUIRE_BUFFER_RECONFIGURE) {
if (acq_return == GST_OMX_ACQUIRE_BUFFER_RECONFIGURE
&& gst_omx_port_is_enabled (port)) {
err = gst_omx_port_set_enabled (port, FALSE);
if (err != OMX_ErrorNone)
goto reconfigure_error;
@ -596,7 +597,6 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
GST_VIDEO_DECODER_STREAM_LOCK (self);
gst_omx_port_get_port_definition (port, &port_def);
g_assert (port_def.format.video.eCompressionFormat ==
OMX_VIDEO_CodingUnused);
@ -1175,11 +1175,6 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
&port_def) != OMX_ErrorNone)
return FALSE;
GST_DEBUG_OBJECT (self, "Setting outport port definition");
if (gst_omx_port_update_port_definition (self->dec_out_port,
NULL) != OMX_ErrorNone)
return FALSE;
if (klass->set_format) {
if (!klass->set_format (self, self->dec_in_port, state)) {
GST_ERROR_OBJECT (self, "Subclass failed to set the new format");
@ -1187,6 +1182,11 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
}
}
GST_DEBUG_OBJECT (self, "Updating outport port definition");
if (gst_omx_port_update_port_definition (self->dec_out_port,
NULL) != OMX_ErrorNone)
return FALSE;
gst_buffer_replace (&self->codec_data, state->codec_data);
self->input_state = gst_video_codec_state_ref (state);
@ -1213,7 +1213,13 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
/* Need to allocate buffers to reach Idle state */
if (gst_omx_port_allocate_buffers (self->dec_in_port, -1) != OMX_ErrorNone)
return FALSE;
if (gst_omx_port_allocate_buffers (self->dec_out_port, -1) != OMX_ErrorNone)
/* And disable output port */
if (gst_omx_port_set_enabled (self->dec_out_port, FALSE) != OMX_ErrorNone)
return FALSE;
if (gst_omx_port_wait_enabled (self->dec_out_port,
1 * GST_SECOND) != OMX_ErrorNone)
return FALSE;
if (gst_omx_component_get_state (self->dec,