From d92fb127aebd49ac0fbadb28fba081aebcc75510 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 1 Mar 2013 11:25:04 +0100 Subject: [PATCH] omxaudioenc: Only enable the output port after we know the output format --- omx/gstomxaudioenc.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c index 250ef39..547d0cd 100644 --- a/omx/gstomxaudioenc.c +++ b/omx/gstomxaudioenc.c @@ -654,11 +654,6 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) &port_def) != OMX_ErrorNone) return FALSE; - GST_DEBUG_OBJECT (self, "Setting outport port definition"); - if (gst_omx_port_update_port_definition (self->enc_out_port, - NULL) != OMX_ErrorNone) - return FALSE; - GST_OMX_INIT_STRUCT (&pcm_param); pcm_param.nPortIndex = self->enc_in_port->index; pcm_param.nChannels = info->channels; @@ -729,6 +724,11 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) } } + GST_DEBUG_OBJECT (self, "Updating outport port definition"); + if (gst_omx_port_update_port_definition (self->enc_out_port, + NULL) != OMX_ErrorNone) + return FALSE; + GST_DEBUG_OBJECT (self, "Enabling component"); if (needs_disable) { if (gst_omx_port_set_enabled (self->enc_in_port, TRUE) != OMX_ErrorNone) @@ -747,7 +747,13 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) /* Need to allocate buffers to reach Idle state */ if (gst_omx_port_allocate_buffers (self->enc_in_port, -1) != OMX_ErrorNone) return FALSE; - if (gst_omx_port_allocate_buffers (self->enc_out_port, -1) != OMX_ErrorNone) + + /* And disable output port */ + if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone) + return FALSE; + + if (gst_omx_port_wait_enabled (self->enc_out_port, + 1 * GST_SECOND) != OMX_ErrorNone) return FALSE; if (gst_omx_component_get_state (self->enc, -- 2.7.4