android: CameraDevice: Fix Camera3RequestDescriptor leakage

CameraDevice creates Camera3RequestDescriptor in
processCaptureRequest() and disallocates in requestComplete().
Camera3RequestDescriptor can never be destroyed if
requestComplete() is never called. This avoid the memory
leakage by storing them in map CameraRequestDescriptor.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Hirokazu Honda 2021-04-03 22:57:34 +09:00 committed by Laurent Pinchart
parent 0b661d70ec
commit d40430116b
4 changed files with 57 additions and 39 deletions

View file

@ -26,10 +26,10 @@ LOG_DECLARE_CATEGORY(HAL)
* by the CameraWorker which queues it to the libcamera::Camera after handling
* fences.
*/
CaptureRequest::CaptureRequest(libcamera::Camera *camera, uint64_t cookie)
CaptureRequest::CaptureRequest(libcamera::Camera *camera)
: camera_(camera)
{
request_ = camera_->createRequest(cookie);
request_ = camera_->createRequest(reinterpret_cast<uint64_t>(this));
}
void CaptureRequest::addBuffer(Stream *stream, FrameBuffer *buffer, int fence)