android: camera_device: Fix variables access without protection

This fixes the code accessing descriptors and
Camera3RequestDescriptor::pendingStreamsToProcess_ without holding
descriptorsMutex_ and Camera3RequestDescriptor::streamProcessMutex_
in CameraDevice.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Hirokazu Honda 2021-12-01 16:53:46 +09:00 committed by Laurent Pinchart
parent 97ab0074ec
commit f6807016a3

View file

@ -436,7 +436,11 @@ void CameraDevice::stop()
worker_.stop();
camera_->stop();
{
MutexLocker descriptorsLock(descriptorsMutex_);
descriptors_ = {};
}
streams_.clear();
state_ = State::Stopped;
@ -933,6 +937,9 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
*/
FrameBuffer *frameBuffer = nullptr;
int acquireFence = -1;
MutexLocker lock(descriptor->streamsProcessMutex_);
switch (cameraStream->type()) {
case CameraStream::Type::Mapped:
/*