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 <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Umang Jain
2021-09-29 19:00:28 +05:30
parent 25b0216886
commit 8e7feeb5e7
2 changed files with 55 additions and 45 deletions
+2 -1
View File
@@ -10,6 +10,7 @@
#include <map>
#include <memory>
#include <mutex>
#include <queue>
#include <vector>
#include <hardware/camera3.h>
@@ -125,7 +126,7 @@ private:
std::vector<CameraStream> streams_;
libcamera::Mutex descriptorsMutex_; /* Protects descriptors_. */
std::map<uint64_t, Camera3RequestDescriptor> descriptors_;
std::queue<std::unique_ptr<Camera3RequestDescriptor>> descriptors_;
std::string maker_;
std::string model_;