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
This commit is contained in:
Peng Liu 2014-08-26 22:13:53 -05:00 committed by Sebastian Dröge
parent d75334456d
commit d3d0a82ba4
2 changed files with 32 additions and 21 deletions

View file

@ -78,7 +78,7 @@ component-name=OMX.broadcom.video_encode
rank=257 rank=257
in-port-index=200 in-port-index=200
out-port-index=201 out-port-index=201
hacks=no-component-role hacks=no-component-role;no-component-reconfigure
[omxanalogaudiosink] [omxanalogaudiosink]
type-name=GstOMXAnalogAudioSink type-name=GstOMXAnalogAudioSink

View file

@ -958,26 +958,37 @@ gst_omx_video_enc_set_format (GstVideoEncoder * encoder,
gst_pad_stop_task (GST_VIDEO_ENCODER_SRC_PAD (encoder)); gst_pad_stop_task (GST_VIDEO_ENCODER_SRC_PAD (encoder));
GST_VIDEO_ENCODER_STREAM_LOCK (self); GST_VIDEO_ENCODER_STREAM_LOCK (self);
if (gst_omx_port_set_enabled (self->enc_in_port, FALSE) != OMX_ErrorNone) if (klass->cdata.hacks & GST_OMX_HACK_NO_COMPONENT_RECONFIGURE) {
return FALSE; GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone) gst_omx_video_enc_stop (GST_VIDEO_ENCODER (self));
return FALSE; gst_omx_video_enc_close (GST_VIDEO_ENCODER (self));
if (gst_omx_port_wait_buffers_released (self->enc_in_port, GST_VIDEO_ENCODER_STREAM_LOCK (self);
5 * GST_SECOND) != OMX_ErrorNone)
return FALSE; if (!gst_omx_video_enc_open (GST_VIDEO_ENCODER (self)))
if (gst_omx_port_wait_buffers_released (self->enc_out_port, return FALSE;
1 * GST_SECOND) != OMX_ErrorNone) needs_disable = FALSE;
return FALSE; } else {
if (gst_omx_port_deallocate_buffers (self->enc_in_port) != OMX_ErrorNone) if (gst_omx_port_set_enabled (self->enc_in_port, FALSE) != OMX_ErrorNone)
return FALSE; return FALSE;
if (gst_omx_port_deallocate_buffers (self->enc_out_port) != OMX_ErrorNone) if (gst_omx_port_set_enabled (self->enc_out_port, FALSE) != OMX_ErrorNone)
return FALSE; return FALSE;
if (gst_omx_port_wait_enabled (self->enc_in_port, if (gst_omx_port_wait_buffers_released (self->enc_in_port,
1 * GST_SECOND) != OMX_ErrorNone) 5 * GST_SECOND) != OMX_ErrorNone)
return FALSE; return FALSE;
if (gst_omx_port_wait_enabled (self->enc_out_port, if (gst_omx_port_wait_buffers_released (self->enc_out_port,
1 * GST_SECOND) != OMX_ErrorNone) 1 * GST_SECOND) != OMX_ErrorNone)
return FALSE; 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"); GST_DEBUG_OBJECT (self, "Encoder drained and disabled");
} }