From 63e0d6197121d1a0638d36773e4ec55a7055f1a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 28 Feb 2013 17:02:31 +0100 Subject: [PATCH] omxvideodec: Only enable the output port after we know the output format --- omx/gstomxvideodec.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index e8e8e03aee..a8063a60bc 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -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,