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

Commit d270804d authored by Chien-Yu Chen's avatar Chien-Yu Chen Committed by Android Git Automerger
Browse files

am a24a1a63: Merge "Camera3Device: Bookkeeping reprocess shutters separately" into mnc-dr-dev

* commit 'a24a1a63':
  Camera3Device: Bookkeeping reprocess shutters separately
parents 02d60280 a24a1a63
Loading
Loading
Loading
Loading
+24 −12
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ Camera3Device::Camera3Device(int id):
        mNextResultFrameNumber(0),
        mNextReprocessResultFrameNumber(0),
        mNextShutterFrameNumber(0),
        mNextReprocessShutterFrameNumber(0),
        mListener(NULL)
{
    ATRACE_CALL();
@@ -2534,10 +2535,28 @@ void Camera3Device::notifyError(const camera3_error_msg_t &msg,
void Camera3Device::notifyShutter(const camera3_shutter_msg_t &msg,
        NotificationListener *listener) {
    ssize_t idx;

    // Set timestamp for the request in the in-flight tracking
    // and get the request ID to send upstream
    {
        Mutex::Autolock l(mInFlightLock);
        idx = mInFlightMap.indexOfKey(msg.frame_number);
        if (idx >= 0) {
            InFlightRequest &r = mInFlightMap.editValueAt(idx);

            // Verify ordering of shutter notifications
            {
                Mutex::Autolock l(mOutputLock);
                // TODO: need to track errors for tighter bounds on expected frame number.
                if (r.hasInputBuffer) {
                    if (msg.frame_number < mNextReprocessShutterFrameNumber) {
                        SET_ERR("Shutter notification out-of-order. Expected "
                                "notification for frame %d, got frame %d",
                                mNextReprocessShutterFrameNumber, msg.frame_number);
                        return;
                    }
                    mNextReprocessShutterFrameNumber = msg.frame_number + 1;
                } else {
                    if (msg.frame_number < mNextShutterFrameNumber) {
                        SET_ERR("Shutter notification out-of-order. Expected "
                                "notification for frame %d, got frame %d",
@@ -2546,14 +2565,7 @@ void Camera3Device::notifyShutter(const camera3_shutter_msg_t &msg,
                    }
                    mNextShutterFrameNumber = msg.frame_number + 1;
                }

    // Set timestamp for the request in the in-flight tracking
    // and get the request ID to send upstream
    {
        Mutex::Autolock l(mInFlightLock);
        idx = mInFlightMap.indexOfKey(msg.frame_number);
        if (idx >= 0) {
            InFlightRequest &r = mInFlightMap.editValueAt(idx);
            }

            ALOGVV("Camera %d: %s: Shutter fired for frame %d (id %d) at %" PRId64,
                    mId, __FUNCTION__,
+3 −0
Original line number Diff line number Diff line
@@ -771,7 +771,10 @@ class Camera3Device :
    uint32_t               mNextResultFrameNumber;
    // the minimal frame number of the next reprocess result
    uint32_t               mNextReprocessResultFrameNumber;
    // the minimal frame number of the next non-reprocess shutter
    uint32_t               mNextShutterFrameNumber;
    // the minimal frame number of the next reprocess shutter
    uint32_t               mNextReprocessShutterFrameNumber;
    List<CaptureResult>   mResultQueue;
    Condition              mResultSignal;
    NotificationListener  *mListener;