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
in-port-index=200
out-port-index=201
hacks=no-component-role
hacks=no-component-role;no-component-reconfigure
[omxanalogaudiosink]
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_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");
}