libcamera/src
Laurent Pinchart b3fd8e14b5 gstreamer: Fix race conditions in task pause/resume
The task run function races with two other threads that want to resume
the task: the requestCompleted() handler and the buffer-notify signal
handler. If the former queues completed requests or the latter queues
back buffers to the pool, and then resume the task, after the task run
handler checks the queues but before it attemps to pause the task, then
the task may be paused without noticing that more work is available.

The most immediate way to fix this is to take the stream_lock in the
requestCompleted() and buffer-notify signal handlers, or cover the whole
task run handler with the GstLibcameraSrcState lock. This could cause
long delays in the requestCompleted() handler, so that's not a good
option.

Instead, pause the task unconditionally at the beginning of its run
function, and track while processing buffers and requests if the task
needs to be resumed. It may also get resumed externally by the
buffer-notify signal handler or the request completion handler, which
are guaranteed not to race due to the lock taken by the gst_task_pause()
and gst_task_resume() functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2022-07-04 23:08:12 +03:00
..
android android: Use the YamlObject iterator API 2022-06-20 15:12:12 +03:00
cam cam: kms_sink: Remove limitation that camera and display must match 2022-06-20 15:46:27 +03:00
gstreamer gstreamer: Fix race conditions in task pause/resume 2022-07-04 23:08:12 +03:00
ipa ipa: rkisp1: Add support of Black Level Correction tuning 2022-06-29 17:21:15 +03:00
lc-compliance lc-compliance: Only download gtest subproject as a fallback 2022-02-03 18:23:48 +02:00
libcamera pipeline: rkisp1: Support IPA tuning file 2022-06-29 17:21:11 +03:00
py py: examples: Add simple-cam.py 2022-06-08 20:16:25 +03:00
qcam libcamera: Replace toString with operator<<() for format classes 2022-05-04 14:11:33 +03:00
v4l2 libcamera: Replace toString with operator<<() for format classes 2022-05-04 14:11:33 +03:00
meson.build Add Python bindings 2022-05-10 13:53:43 +02:00