v4l2videodec: handle stop being called without flush

Uppon certain downstream error, stop() is called without a flush(). This mean that
the streaming thread may still be running even though unlock has been called.
Now calling flush to reset the decoder state if we are processing.
This commit is contained in:
Nicolas Dufresne 2014-03-12 17:11:16 +01:00
parent fb852669de
commit 7101c4341a

View file

@ -210,6 +210,15 @@ gst_v4l2_video_dec_stop (GstVideoDecoder * decoder)
GST_DEBUG_OBJECT (self, "Stopping"); GST_DEBUG_OBJECT (self, "Stopping");
gst_v4l2_object_unlock (self->v4l2output);
gst_v4l2_object_unlock (self->v4l2capture);
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
/* Wait for capture thread to stop */
gst_pad_stop_task (decoder->srcpad);
self->output_flow = GST_FLOW_OK;
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
/* Should have been flushed already */ /* Should have been flushed already */
g_assert (g_atomic_int_get (&self->active) == FALSE); g_assert (g_atomic_int_get (&self->active) == FALSE);
g_assert (g_atomic_int_get (&self->processing) == FALSE); g_assert (g_atomic_int_get (&self->processing) == FALSE);