v4l2videodec: Ensure internal pool are activated
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Sun, 16 Mar 2014 17:39:32 +0000 (18:39 +0100)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 8 May 2014 19:56:35 +0000 (15:56 -0400)
sys/v4l2/gstv4l2videodec.c

index a169972..9fad0a2 100644 (file)
@@ -449,6 +449,7 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
   }
 
   if (G_UNLIKELY (!GST_V4L2_IS_ACTIVE (self->v4l2capture))) {
+    GstBufferPool *pool = GST_BUFFER_POOL (self->v4l2output->pool);
     GstVideoInfo info;
     GstVideoCodecState *output_state;
     GstBuffer *codec_data;
@@ -468,6 +469,9 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
       frame->input_buffer = NULL;
     }
 
+    if (!gst_buffer_pool_set_active (pool, TRUE))
+      goto activate_failed;
+
     GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
     gst_v4l2_object_unlock_stop (self->v4l2output);
     ret =
@@ -494,6 +498,11 @@ gst_v4l2_video_dec_handle_frame (GstVideoDecoder * decoder,
       else
         goto not_negotiated;
     }
+
+    /* Ensure our internal pool is activated */
+    if (!gst_buffer_pool_set_active (GST_BUFFER_POOL (self->v4l2capture->pool),
+            TRUE))
+      goto activate_failed;
   }
 
   if (g_atomic_int_get (&self->processing) == FALSE) {
@@ -542,6 +551,13 @@ not_negotiated:
     ret = GST_FLOW_NOT_NEGOTIATED;
     goto drop;
   }
+activate_failed:
+  {
+    GST_ELEMENT_ERROR (self, RESOURCE, SETTINGS,
+        (_("Failed to allocated required memory.")),
+        ("Buffer pool activation failed"));
+    return GST_FLOW_ERROR;
+  }
 flushing:
   {
     ret = GST_FLOW_FLUSHING;