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.
This commit is contained in:
Nicolas Dufresne 2014-05-16 17:46:30 -04:00 committed by Nicolas Dufresne
parent 58716e054f
commit 7df99f7469

View file

@ -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);