From 960590f92ff6535565226dfab6fd52082dd6ee2c Mon Sep 17 00:00:00 2001 From: jitendra Date: Tue, 16 Apr 2013 14:50:49 +0530 Subject: [PATCH] omx: Disable output port before transition to idle state https://bugzilla.gnome.org/show_bug.cgi?id=698109 --- omx/gstomxaudioenc.c | 16 ++++++++-------- omx/gstomxvideodec.c | 16 ++++++++-------- omx/gstomxvideoenc.c | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c index 195665524f..6866eebfa2 100644 --- a/omx/gstomxaudioenc.c +++ b/omx/gstomxaudioenc.c @@ -781,14 +781,7 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) if (gst_omx_port_mark_reconfigured (self->enc_in_port) != OMX_ErrorNone) return FALSE; } else { - if (gst_omx_component_set_state (self->enc, OMX_StateIdle) != OMX_ErrorNone) - return FALSE; - - /* Need to allocate buffers to reach Idle state */ - if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone) - return FALSE; - - /* And disable output port */ + /* Disable output port */ if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone) return FALSE; @@ -796,6 +789,13 @@ gst_omx_audio_enc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) 1 * GST_SECOND) != OMX_ErrorNone) return FALSE; + if (gst_omx_component_set_state (self->enc, OMX_StateIdle) != OMX_ErrorNone) + return FALSE; + + /* Need to allocate buffers to reach Idle state */ + if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone) + return FALSE; + if (gst_omx_component_get_state (self->enc, GST_CLOCK_TIME_NONE) != OMX_StateIdle) return FALSE; diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index f815f11a9f..cd0ac13761 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -2660,14 +2660,7 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, if (!gst_omx_video_dec_negotiate (self)) GST_LOG_OBJECT (self, "Negotiation failed, will get output format later"); - if (gst_omx_component_set_state (self->dec, OMX_StateIdle) != OMX_ErrorNone) - return FALSE; - - /* Need to allocate buffers to reach Idle state */ - if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone) - return FALSE; - - /* And disable output port */ + /* Disable output port */ if (gst_omx_port_set_enabled (self->dec_out_port, FALSE) != OMX_ErrorNone) return FALSE; @@ -2675,6 +2668,13 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder, 1 * GST_SECOND) != OMX_ErrorNone) return FALSE; + if (gst_omx_component_set_state (self->dec, OMX_StateIdle) != OMX_ErrorNone) + return FALSE; + + /* Need to allocate buffers to reach Idle state */ + if (gst_omx_port_allocate_buffers (self->dec_in_port) != OMX_ErrorNone) + return FALSE; + if (gst_omx_component_get_state (self->dec, GST_CLOCK_TIME_NONE) != OMX_StateIdle) return FALSE; diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 6eaedfaf21..0e8bcb6e59 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -1256,14 +1256,7 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder, if (gst_omx_port_mark_reconfigured (self->enc_in_port) != OMX_ErrorNone) return FALSE; } else { - if (gst_omx_component_set_state (self->enc, OMX_StateIdle) != OMX_ErrorNone) - return FALSE; - - /* Need to allocate buffers to reach Idle state */ - if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone) - return FALSE; - - /* And disable output port */ + /* Disable output port */ if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone) return FALSE; @@ -1271,6 +1264,13 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder, 1 * GST_SECOND) != OMX_ErrorNone) return FALSE; + if (gst_omx_component_set_state (self->enc, OMX_StateIdle) != OMX_ErrorNone) + return FALSE; + + /* Need to allocate buffers to reach Idle state */ + if (gst_omx_port_allocate_buffers (self->enc_in_port) != OMX_ErrorNone) + return FALSE; + if (gst_omx_component_get_state (self->enc, GST_CLOCK_TIME_NONE) != OMX_StateIdle) return FALSE;