v4l2videodec: Check that pool where allocated before flushing them
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Sun, 16 Mar 2014 16:01:10 +0000 (17:01 +0100)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 8 May 2014 19:56:35 +0000 (15:56 -0400)
Upon error, the pools might not have been allocated yet, hence we should not
try and flush them (even though we still want to make sure the processing thread
is fully stopped).

sys/v4l2/gstv4l2videodec.c

index ece5440..a169972 100644 (file)
@@ -276,8 +276,11 @@ gst_v4l2_video_dec_flush (GstVideoDecoder * decoder)
   gst_pad_stop_task (decoder->srcpad);
   self->output_flow = GST_FLOW_OK;
 
-  gst_v4l2_buffer_pool_flush (GST_V4L2_BUFFER_POOL (self->v4l2output->pool));
-  gst_v4l2_buffer_pool_flush (GST_V4L2_BUFFER_POOL (self->v4l2capture->pool));
+  if (self->v4l2output->pool)
+    gst_v4l2_buffer_pool_flush (GST_V4L2_BUFFER_POOL (self->v4l2output->pool));
+
+  if (self->v4l2capture->pool)
+    gst_v4l2_buffer_pool_flush (GST_V4L2_BUFFER_POOL (self->v4l2capture->pool));
 
   /* Output will remain flushing until new frame comes in */
   gst_v4l2_object_unlock_stop (self->v4l2capture);