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

Commit 96363281 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Camera: Load initial session params speculatively" into pi-dev

parents 9f39994c b139b178
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -77,7 +77,8 @@ Camera3Device::Camera3Device(const String8 &id):
        mNextShutterFrameNumber(0),
        mNextReprocessShutterFrameNumber(0),
        mListener(NULL),
        mVendorTagId(CAMERA_METADATA_INVALID_VENDOR_ID)
        mVendorTagId(CAMERA_METADATA_INVALID_VENDOR_ID),
        mLastTemplateId(-1)
{
    ATRACE_CALL();
    camera3_callback_ops::notify = &sNotify;
@@ -1597,6 +1598,18 @@ status_t Camera3Device::configureStreams(const CameraMetadata& sessionParams, in
    Mutex::Autolock il(mInterfaceLock);
    Mutex::Autolock l(mLock);

    // In case the client doesn't include any session parameter, try a
    // speculative configuration using the values from the last cached
    // default request.
    if (sessionParams.isEmpty() &&
            ((mLastTemplateId > 0) && (mLastTemplateId < CAMERA3_TEMPLATE_COUNT)) &&
            (!mRequestTemplateCache[mLastTemplateId].isEmpty())) {
        ALOGV("%s: Speculative session param configuration with template id: %d", __func__,
                mLastTemplateId);
        return filterParamsAndConfigureLocked(mRequestTemplateCache[mLastTemplateId],
                operatingMode);
    }

    return filterParamsAndConfigureLocked(sessionParams, operatingMode);
}

@@ -1673,6 +1686,7 @@ status_t Camera3Device::createDefaultRequest(int templateId,

        if (!mRequestTemplateCache[templateId].isEmpty()) {
            *request = mRequestTemplateCache[templateId];
            mLastTemplateId = templateId;
            return OK;
        }
    }
@@ -1697,6 +1711,7 @@ status_t Camera3Device::createDefaultRequest(int templateId,
        mRequestTemplateCache[templateId].acquire(rawRequest);

        *request = mRequestTemplateCache[templateId];
        mLastTemplateId = templateId;
    }
    return OK;
}
+3 −0
Original line number Diff line number Diff line
@@ -1191,6 +1191,9 @@ class Camera3Device :

    metadata_vendor_id_t mVendorTagId;

    // Cached last requested template id
    int mLastTemplateId;

    /**
     * Static callback forwarding methods from HAL to instance
     */