v4l2bufferpool: add lock as atomic operation for seek
authorjeri.li <jeri.li@mediatek.com>
Fri, 21 Apr 2023 01:58:36 +0000 (09:58 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 20 Nov 2023 21:30:39 +0000 (21:30 +0000)
commit390d43dcde2dfe39e46c0ed926783304b19f64cf
treec99b1cfb86de97d40fca0d2ad48e16470bb4e0bf
parentd809406dfce5b46b4259495783f7c84662ed69a6
v4l2bufferpool: add lock as atomic operation for seek

When seek flush, gst v4l2 buffer pool flush is not atomic which will
lead double enqueue buffer (qbuf) issue, and v4l2 buffer pool qbuf is
also not atomic which will lead no free buffer found in the pool.
1. add lock for calculate enqueue number in streamon function
2. add lock for v4l2 capture end streamoff in pool flush function
3. lock the whole funciton of v4l2 buffer pool qbuf, then the buffer
   pool index and qbuf operation are atomic

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5695>
subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c