From e9eba56cd3de2763e143cc1dcd4c6574a2d35b32 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Sun, 16 Mar 2014 18:39:32 +0100 Subject: [PATCH] v4l2videodec: Ensure internal pool are activated --- sys/v4l2/gstv4l2videodec.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/v4l2/gstv4l2videodec.c b/sys/v4l2/gstv4l2videodec.c index a169972ff0..9fad0a25e7 100644 --- a/sys/v4l2/gstv4l2videodec.c +++ b/sys/v4l2/gstv4l2videodec.c @@ -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;