summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-08-28 13:10:35 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2018-08-28 15:52:14 +0200
commit626a481e01da499e333801f18911ae6ed763a15f (patch)
treebae6c90e2bd173ebb29590d7385def7e3b06add9
parenta8638938427b819252a3efa0fc30be3f522eead3 (diff)
downloadgst-omx-626a481e01da499e333801f18911ae6ed763a15f.tar.gz
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
-rw-r--r--omx/gstomxvideoenc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index 9abd9a8..287e003 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -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);