Commit 7df99f74 authored by Nicolas Dufresne's avatar Nicolas Dufresne Committed by Nicolas Dufresne

v4l2videodec: Handle flush while in start_streaming

We need to handle the case where a flush occure while the streaming
thread is being brought up. In this case, the flushing state of the poll
object is cleared. To solve this, we simply set the capture poll to flushing
again, this way we know the thread will exit. The decoder streamlock
is used to synchronize with handle frame.
parent 58716e05
......@@ -263,8 +263,10 @@ gst_v4l2_video_dec_flush (GstVideoDecoder * decoder)
/* Wait for capture thread to stop */
GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
gst_v4l2_object_unlock (self->v4l2capture);
gst_pad_stop_task (decoder->srcpad);
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
self->output_flow = GST_FLOW_OK;
if (self->v4l2output->pool)
......@@ -309,7 +311,7 @@ gst_v4l2_video_dec_finish (GstVideoDecoder * decoder)
GST_VIDEO_DECODER_STREAM_LOCK (decoder);
/* Ensure the processing thread has stopped */
if (self->processing) {
if (g_atomic_int_get (&self->processing)) {
gst_v4l2_object_unlock (self->v4l2capture);
gst_pad_stop_task (decoder->srcpad);
g_assert (g_atomic_int_get (&self->processing) == FALSE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment