summaryrefslogtreecommitdiff
path: root/src/v4l2/v4l2_camera.h
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2020-06-16 16:40:34 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2020-06-25 23:47:13 +0900
commit566ccd75cafd0bd9d60d350405ca7d337786ae39 (patch)
tree77208d0cfc8c0eec0886bc1b5a5ba73c6efdba46 /src/v4l2/v4l2_camera.h
parentf155e638168cb0d6cbd9dde8748301fa12a0736f (diff)
v4l2: v4l2_camera: Don't use libcamera::Semaphore for available buffers
In V4L2, a blocked dqbuf should not not also block a streamoff. This means that on streamoff, the blocked dqbuf must return (with error). We cannot do this with the libcamera semaphore, so pull out the necessary components of a semaphore, and put them into V4L2Camera, so that dqbuf from V4L2CameraProxy can wait on a disjunct condition of the availability of the semaphore or the stopping of the stream. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/v4l2/v4l2_camera.h')
-rw-r--r--src/v4l2/v4l2_camera.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h
index ee53c2b0..515e9060 100644
--- a/src/v4l2/v4l2_camera.h
+++ b/src/v4l2/v4l2_camera.h
@@ -57,9 +57,10 @@ public:
int qbuf(unsigned int index);
- bool isRunning();
+ void waitForBufferAvailable();
+ bool isBufferAvailable();
- Semaphore bufferSema_;
+ bool isRunning();
private:
void requestComplete(Request *request);
@@ -76,6 +77,10 @@ private:
std::deque<std::unique_ptr<Buffer>> completedBuffers_;
int efd_;
+
+ Mutex bufferMutex_;
+ std::condition_variable bufferCV_;
+ unsigned int bufferAvailableCount_;
};
#endif /* __V4L2_CAMERA_H__ */