From: Peng Liu Date: Wed, 27 Aug 2014 03:13:53 +0000 (-0500) Subject: omxvideoenc: Implement the hack flag GST_OMX_HACK_NO_COMPONENT_RECONFIGURE X-Git-Tag: 1.16.2~345 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3d0a82ba4d6dbb475759f895f5a5a41247bdc1c;p=platform%2Fupstream%2Fgst-omx.git omxvideoenc: Implement the hack flag GST_OMX_HACK_NO_COMPONENT_RECONFIGURE Fix a video encoder stall problem on RPi when changing the aspect ratio. https://bugzilla.gnome.org/show_bug.cgi?id=732533 --- diff --git a/config/rpi/gstomx.conf b/config/rpi/gstomx.conf index 827ebb6..8b5c7d6 100644 --- a/config/rpi/gstomx.conf +++ b/config/rpi/gstomx.conf @@ -78,7 +78,7 @@ component-name=OMX.broadcom.video_encode rank=257 in-port-index=200 out-port-index=201 -hacks=no-component-role +hacks=no-component-role;no-component-reconfigure [omxanalogaudiosink] type-name=GstOMXAnalogAudioSink diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index d055816..de3f7a6 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -958,26 +958,37 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder, gst_pad_stop_task (GST_VIDEO_ENCODER_SRC_PAD (encoder)); GST_VIDEO_ENCODER_STREAM_LOCK (self); - if (gst_omx_port_set_enabled (self->enc_in_port, FALSE) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_wait_buffers_released (self->enc_in_port, - 5 * GST_SECOND) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_wait_buffers_released (self->enc_out_port, - 1 * GST_SECOND) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_deallocate_buffers (self->enc_in_port) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_deallocate_buffers (self->enc_out_port) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_wait_enabled (self->enc_in_port, - 1 * GST_SECOND) != OMX_ErrorNone) - return FALSE; - if (gst_omx_port_wait_enabled (self->enc_out_port, - 1 * GST_SECOND) != OMX_ErrorNone) - return FALSE; + if (klass->cdata.hacks & GST_OMX_HACK_NO_COMPONENT_RECONFIGURE) { + GST_VIDEO_ENCODER_STREAM_UNLOCK (self); + gst_omx_video_enc_stop (GST_VIDEO_ENCODER (self)); + gst_omx_video_enc_close (GST_VIDEO_ENCODER (self)); + GST_VIDEO_ENCODER_STREAM_LOCK (self); + + if (!gst_omx_video_enc_open (GST_VIDEO_ENCODER (self))) + return FALSE; + needs_disable = FALSE; + } else { + if (gst_omx_port_set_enabled (self->enc_in_port, FALSE) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_wait_buffers_released (self->enc_in_port, + 5 * GST_SECOND) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_wait_buffers_released (self->enc_out_port, + 1 * GST_SECOND) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_deallocate_buffers (self->enc_in_port) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_deallocate_buffers (self->enc_out_port) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_wait_enabled (self->enc_in_port, + 1 * GST_SECOND) != OMX_ErrorNone) + return FALSE; + if (gst_omx_port_wait_enabled (self->enc_out_port, + 1 * GST_SECOND) != OMX_ErrorNone) + return FALSE; + } GST_DEBUG_OBJECT (self, "Encoder drained and disabled"); }