omxvideoenc: pause component when flushing

As stated in the spec ("6.1.3 Seek Event Sequence") we should pause
before flushing.
We were pausing the decoder but not the encoder so I just aligned the
two code paths.

https://bugzilla.gnome.org/show_bug.cgi?id=797038
This commit is contained in:
Guillaume Desmottes 2018-08-28 13:10:35 +02:00
parent a863893842
commit 626a481e01

View file

@ -2294,6 +2294,14 @@ gst_omx_video_enc_flush (GstVideoEncoder * encoder)
if (gst_omx_component_get_state (self->enc, 0) == OMX_StateLoaded)
return TRUE;
/* 0) Pause the components */
if (gst_omx_component_get_state (self->enc, 0) == OMX_StateExecuting) {
gst_omx_component_set_state (self->enc, OMX_StatePause);
gst_omx_component_get_state (self->enc, GST_CLOCK_TIME_NONE);
}
/* 1) Flush the ports */
GST_DEBUG_OBJECT (self, "flushing ports");
gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, TRUE);
gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, TRUE);
@ -2305,6 +2313,11 @@ gst_omx_video_enc_flush (GstVideoEncoder * encoder)
GST_PAD_STREAM_UNLOCK (GST_VIDEO_ENCODER_SRC_PAD (self));
GST_VIDEO_ENCODER_STREAM_LOCK (self);
/* 3) Resume components */
gst_omx_component_set_state (self->enc, OMX_StateExecuting);
gst_omx_component_get_state (self->enc, GST_CLOCK_TIME_NONE);
/* 4) Unset flushing to allow ports to accept data again */
gst_omx_port_set_flushing (self->enc_in_port, 5 * GST_SECOND, FALSE);
gst_omx_port_set_flushing (self->enc_out_port, 5 * GST_SECOND, FALSE);
gst_omx_port_populate (self->enc_out_port);