From 8e7feeb5e7ecc24e8dab5c5f5711210758f98b0d Mon Sep 17 00:00:00 2001 From: Umang Jain Date: Wed, 29 Sep 2021 19:00:28 +0530 Subject: android: camera_device: Transform descriptors_ map to queue The descriptors_ map holds Camera3RequestDescriptor(s) which are per-capture requests placed by the framework to libcamera HAL. CameraDevice::requestComplete() looks for the descriptor for which the camera request has been completed and removes it from the map. Since the requests are placed in form of FIFO and the framework expects the order of completion to be FIFO as well, this calls for a need of a queue rather than a std::map. This patch still keeps the same lifetime of Camera3RequestDescriptor as before i.e. in the requestComplete(). Previously, a descriptor was extracted from the map and its lifetime was bound to requestComplete(). The lifetime is kept the same by manually calling .pop_front() on the queue. In the subsequent commit, this is likely to change with a centralized location of dropping descriptors from the queue for request completion. Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/android/camera_device.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/android/camera_device.h') diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 43eb5895..9ec510d5 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -125,7 +126,7 @@ private: std::vector streams_; libcamera::Mutex descriptorsMutex_; /* Protects descriptors_. */ - std::map descriptors_; + std::queue> descriptors_; std::string maker_; std::string model_; -- cgit v1.2.1