From 35ab185d752fb610aa26002c1aa03cf2fd954b7d Mon Sep 17 00:00:00 2001 From: Michael Tretter Date: Tue, 26 Jun 2018 15:04:39 +0200 Subject: [PATCH] v4l2videodec: do not call streamon while pool is flushing gst_v4l2_buffer_pool_flush() executes streamoff for the output, but streamoff->streamon for the capture of the decoder. gst_v4l2_buffer_pool_streamon() on capture assumes that is able to resurrect the buffers from the pool, but acquiring buffers fails if the buffer pool is still flushing. The decoder needs to stop flushing the pools before calling gst_v4l2_buffer_pool_flush() to restart the v4l2 device. Otherwise starting the decoding thread might fail, because there are no buffers in the capture pool. This fixes a regression that was introduced in 97985a335c78 ("v4l2videodec: Add dynamic resolution change support"). https://bugzilla.gnome.org/show_bug.cgi?id=796681 --- sys/v4l2/gstv4l2videodec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/v4l2/gstv4l2videodec.c b/sys/v4l2/gstv4l2videodec.c index d14ad90..a00ccd9 100644 --- a/sys/v4l2/gstv4l2videodec.c +++ b/sys/v4l2/gstv4l2videodec.c @@ -301,15 +301,18 @@ gst_v4l2_video_dec_flush (GstVideoDecoder * decoder) self->output_flow = GST_FLOW_OK; + gst_v4l2_object_unlock_stop (self->v4l2output); + gst_v4l2_object_unlock_stop (self->v4l2capture); + if (self->v4l2output->pool) gst_v4l2_buffer_pool_flush (self->v4l2output->pool); + /* gst_v4l2_buffer_pool_flush() calls streamon the capture pool and must be + * called after gst_v4l2_object_unlock_stop() stopped flushing the buffer + * pool. */ if (self->v4l2capture->pool) gst_v4l2_buffer_pool_flush (self->v4l2capture->pool); - gst_v4l2_object_unlock_stop (self->v4l2output); - gst_v4l2_object_unlock_stop (self->v4l2capture); - return TRUE; } -- 2.7.4