From 170def84c65b91b9d76603e768f254419aaa69b9 Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Thu, 27 Feb 2020 14:42:42 -0500 Subject: gst: libcamerasrc: Prevent src task deadlock on exhausted buffer pool Allow GstLibcameraPool to notify the source when a new buffer has become available in a previously exhausted buffer pool. This can be used to resume a src task that got paused because it couldn't acquire a buffer. Without this change the src task will never resume from pause once the pool gets exhausted. To trigger the deadlock (it doesn't happen every time), run: gst-launch-1.0 libcamerasrc ! queue ! glimagesink Signed-off-by: Jakub Adam Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/gstreamer/gstlibcamerasrc.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gstreamer/gstlibcamerasrc.cpp') diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 690892bd..9755922a 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -439,6 +439,9 @@ gst_libcamera_src_task_enter(GstTask *task, GThread *thread, gpointer user_data) const StreamConfiguration &stream_cfg = state->config_->at(i); GstLibcameraPool *pool = gst_libcamera_pool_new(self->allocator, stream_cfg.stream()); + g_signal_connect_swapped(pool, "buffer-notify", + G_CALLBACK(gst_libcamera_resume_task), task); + gst_libcamera_pad_set_pool(srcpad, pool); gst_flow_combiner_add_pad(self->flow_combiner, srcpad); } -- cgit v1.2.1