From 58e9341384faa01073c8b3c1899f0f50defc124d Mon Sep 17 00:00:00 2001 From: Marian Mihailescu Date: Wed, 27 Jun 2018 13:46:00 +0000 Subject: [PATCH] v4l2videoenc: activate capture pool after output pool Some drivers need output buffers set before capture buffers. CODA cannot set output format if capture is streaming. Exynos MFC fails on output STREAMON if capture is already streaming. This patch delays capture activation until output is configured and streaming https://bugzilla.gnome.org/show_bug.cgi?id=796693 --- sys/v4l2/gstv4l2videoenc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/v4l2/gstv4l2videoenc.c b/sys/v4l2/gstv4l2videoenc.c index 4269b28..9931329 100644 --- a/sys/v4l2/gstv4l2videoenc.c +++ b/sys/v4l2/gstv4l2videoenc.c @@ -337,14 +337,6 @@ gst_v4l2_video_enc_set_format (GstVideoEncoder * encoder, return FALSE; } - /* activating a capture pool will also call STREAMON. CODA driver will - * refuse to configure the output if the capture is stremaing. */ - if (!gst_buffer_pool_set_active (GST_BUFFER_POOL (self->v4l2capture->pool), - TRUE)) { - GST_WARNING_OBJECT (self, "Could not activate capture buffer pool."); - return FALSE; - } - self->input_state = gst_video_codec_state_ref (state); GST_DEBUG_OBJECT (self, "output caps: %" GST_PTR_FORMAT, state->caps); @@ -742,6 +734,12 @@ gst_v4l2_video_enc_handle_frame (GstVideoEncoder * encoder, goto activate_failed; } + if (!gst_buffer_pool_set_active + (GST_BUFFER_POOL (self->v4l2capture->pool), TRUE)) { + GST_WARNING_OBJECT (self, "Could not activate capture buffer pool."); + goto activate_failed; + } + GST_DEBUG_OBJECT (self, "Starting encoding thread"); /* Start the processing task, when it quits, the task will disable input -- 2.7.4