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

Commit 1d1f846c authored by Zhijun He's avatar Zhijun He
Browse files

Camera3: track request status in inflight queue

Bug: 9758581
Change-Id: I1d7135cd0932bd6b453acabfeb9a553985c887bc
parent 6ea551fa
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -1232,7 +1232,12 @@ void Camera3Device::processCaptureResult(const camera3_capture_result *result) {
        }
        InFlightRequest &request = mInFlightMap.editValueAt(idx);
        timestamp = request.captureTimestamp;
        if (timestamp == 0) {
        /**
         * One of the following must happen before it's legal to call process_capture_result:
         * - CAMERA3_MSG_SHUTTER (expected during normal operation)
         * - CAMERA3_MSG_ERROR (expected during flush)
         */
        if (request.requestStatus == OK && timestamp == 0) {
            SET_ERR("Called before shutter notify for frame %d",
                    frameNumber);
            return;
@@ -1356,6 +1361,16 @@ void Camera3Device::notify(const camera3_notify_msg *msg) {
            ALOGV("Camera %d: %s: HAL error, frame %d, stream %d: %d",
                    mId, __FUNCTION__, msg->message.error.frame_number,
                    streamId, msg->message.error.error_code);

            // Set request error status for the request in the in-flight tracking
            {
                Mutex::Autolock l(mInFlightLock);
                ssize_t idx = mInFlightMap.indexOfKey(msg->message.error.frame_number);
                if (idx >= 0) {
                    mInFlightMap.editValueAt(idx).requestStatus = msg->message.error.error_code;
                }
            }

            if (listener != NULL) {
                listener->notifyError(msg->message.error.error_code,
                        msg->message.error.frame_number, streamId);
+2 −0
Original line number Diff line number Diff line
@@ -383,6 +383,7 @@ class Camera3Device :
    struct InFlightRequest {
        // Set by notify() SHUTTER call.
        nsecs_t captureTimestamp;
        int     requestStatus;
        // Set by process_capture_result call with valid metadata
        bool    haveResultMetadata;
        // Decremented by calls to process_capture_result with valid output
@@ -391,6 +392,7 @@ class Camera3Device :

        InFlightRequest() :
                captureTimestamp(0),
                requestStatus(OK),
                haveResultMetadata(false),
                numBuffersLeft(0) {
        }