diff options
author | Peng Liu <pengliu.mail@gmail.com> | 2014-08-26 22:13:53 -0500 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-08-28 10:45:11 +0300 |
commit | d3d0a82ba4d6dbb475759f895f5a5a41247bdc1c (patch) | |
tree | c33c7c3147c2772b11f30c418d93767c36ea1d6a | |
parent | d75334456d125bc1d1a3c694ef33e2ce4dd747cf (diff) |
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
-rw-r--r-- | config/rpi/gstomx.conf | 2 | ||||
-rw-r--r-- | omx/gstomxvideoenc.c | 51 |
2 files changed, 32 insertions, 21 deletions
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"); } |