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

Commit 200f710f authored by Eino-Ville Talvala (Eddy)'s avatar Eino-Ville Talvala (Eddy) Committed by Android (Google) Code Review
Browse files

Merge "Camera server: Move shutter notify callback outside in-flight mutex" into main

parents 4dcd5705 c87f9570
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -1015,6 +1015,7 @@ void notifyShutter(CaptureOutputStates& states, const camera_shutter_msg_t &msg)
    ssize_t idx;

    std::vector<BufferToReturn> returnableBuffers{};
    CaptureResultExtras pendingNotificationResultExtras{};

    // Set timestamp for the request in the in-flight tracking
    // and get the request ID to send upstream
@@ -1082,9 +1083,13 @@ void notifyShutter(CaptureOutputStates& states, const camera_shutter_msg_t &msg)
                            states.lastCompletedReprocessFrameNumber;
                    r.resultExtras.lastCompletedZslFrameNumber =
                            states.lastCompletedZslFrameNumber;
                    if (flags::return_buffers_outside_locks()) {
                        pendingNotificationResultExtras = r.resultExtras;
                    } else {
                        states.listener->notifyShutter(r.resultExtras, msg.timestamp);
                    }
                // send pending result and buffers
                }
                // send pending result and buffers; this queues them up for delivery later
                const auto& cameraIdsWithZoom = getCameraIdsWithZoomLocked(
                        inflightMap, r.pendingMetadata, r.cameraIdsWithZoom);
                sendCaptureResult(states,
@@ -1110,6 +1115,11 @@ void notifyShutter(CaptureOutputStates& states, const camera_shutter_msg_t &msg)
        SET_ERR("Shutter notification for non-existent frame number %d",
                msg.frame_number);
    }
    // Call notifyShutter outside of in-flight mutex
    if (flags::return_buffers_outside_locks() && pendingNotificationResultExtras.isValid()) {
        states.listener->notifyShutter(pendingNotificationResultExtras, msg.timestamp);
    }

    // With no locks held, finish returning buffers to streams, which may take a while since
    // binder calls are involved
    if (flags::return_buffers_outside_locks()) {