commit 77bb7733b1af9d8d82be7baf2b2347a9ce6ac040
Author: memeka <mihailescu2m@gmail.com>
Date:   Wed Jun 27 21:44:47 2018 +0930

    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.

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
