Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33903363 authored by Shuzhen Wang's avatar Shuzhen Wang Committed by Automerger Merge Worker
Browse files

Camera: Fix request metadata override for repeating request am: d1d051a0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/12419439

Change-Id: I56bd628ee9bf93d700e07f53ae1052e74095c936
parents 402cd4d0 d1d051a0
Loading
Loading
Loading
Loading
+34 −17
Original line number Diff line number Diff line
@@ -2306,6 +2306,15 @@ sp<Camera3Device::CaptureRequest> Camera3Device::createCaptureRequest(
        newRequest->mRotateAndCropAuto = false;
    }

    auto zoomRatioEntry =
            newRequest->mSettingsList.begin()->metadata.find(ANDROID_CONTROL_ZOOM_RATIO);
    if (zoomRatioEntry.count > 0 &&
            zoomRatioEntry.data.f[0] == 1.0f) {
        newRequest->mZoomRatioIs1x = true;
    } else {
        newRequest->mZoomRatioIs1x = false;
    }

    return newRequest;
}

@@ -4426,6 +4435,8 @@ status_t Camera3Device::RequestThread::prepareHalRequests() {
                                parent->mDistortionMappers.end()) {
                            continue;
                        }

                        if (!captureRequest->mDistortionCorrectionUpdated) {
                            res = parent->mDistortionMappers[it->cameraId].correctCaptureRequest(
                                    &(it->metadata));
                            if (res != OK) {
@@ -4434,6 +4445,8 @@ status_t Camera3Device::RequestThread::prepareHalRequests() {
                                        halRequest->frame_number, strerror(-res), res);
                                return INVALID_OPERATION;
                            }
                            captureRequest->mDistortionCorrectionUpdated = true;
                        }
                    }

                    for (it = captureRequest->mSettingsList.begin();
@@ -4443,11 +4456,11 @@ status_t Camera3Device::RequestThread::prepareHalRequests() {
                            continue;
                        }

                        camera_metadata_entry_t e = it->metadata.find(ANDROID_CONTROL_ZOOM_RATIO);
                        if (e.count > 0 && e.data.f[0] != 1.0f) {
                        if (!captureRequest->mZoomRatioIs1x) {
                            cameraIdsWithZoom.insert(it->cameraId);
                        }

                        if (!captureRequest->mZoomRatioUpdated) {
                            res = parent->mZoomRatioMappers[it->cameraId].updateCaptureRequest(
                                    &(it->metadata));
                            if (res != OK) {
@@ -4456,8 +4469,11 @@ status_t Camera3Device::RequestThread::prepareHalRequests() {
                                        halRequest->frame_number, strerror(-res), res);
                                return INVALID_OPERATION;
                            }
                            captureRequest->mZoomRatioUpdated = true;
                        }
                    }
                    if (captureRequest->mRotateAndCropAuto) {
                    if (captureRequest->mRotateAndCropAuto &&
                            !captureRequest->mRotationAndCropUpdated) {
                        for (it = captureRequest->mSettingsList.begin();
                                it != captureRequest->mSettingsList.end(); it++) {
                            auto mapper = parent->mRotateAndCropMappers.find(it->cameraId);
@@ -4471,6 +4487,7 @@ status_t Camera3Device::RequestThread::prepareHalRequests() {
                                }
                            }
                        }
                        captureRequest->mRotationAndCropUpdated = true;
                    }
                }
            }
+13 −0
Original line number Diff line number Diff line
@@ -517,6 +517,19 @@ class Camera3Device :
        // overriding of ROTATE_AND_CROP value and adjustment of coordinates
        // in several other controls in both the request and the result
        bool                                mRotateAndCropAuto;
        // Whether this capture request has its zoom ratio set to 1.0x before
        // the framework overrides it for camera HAL consumption.
        bool                                mZoomRatioIs1x;


        // Whether this capture request's distortion correction update has
        // been done.
        bool                                mDistortionCorrectionUpdated = false;
        // Whether this capture request's rotation and crop update has been
        // done.
        bool                                mRotationAndCropUpdated = false;
        // Whether this capture request's zoom ratio update has been done.
        bool                                mZoomRatioUpdated = false;
    };
    typedef List<sp<CaptureRequest> > RequestList;