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

Commit d4f717c8 authored by Austin Borger's avatar Austin Borger Committed by Android (Google) Code Review
Browse files

Merge "Calculate the max possible preview frame rate for a session and attach...

Merge "Calculate the max possible preview frame rate for a session and attach it to CameraSessionStats for consumption by CameraServiceProxy." into tm-dev
parents 8350d493 4a870a3f
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -52,6 +52,12 @@ status_t CameraStreamStats::readFromParcel(const android::Parcel* parcel) {
        return err;
    }

    float maxPreviewFps = 0;
    if ((err = parcel->readFloat(&maxPreviewFps)) != OK) {
        ALOGE("%s: Failed to read maxPreviewFps from parcel", __FUNCTION__);
        return err;
    }

    int dataSpace = 0;
    if ((err = parcel->readInt32(&dataSpace)) != OK) {
        ALOGE("%s: Failed to read dataSpace from parcel", __FUNCTION__);
@@ -127,6 +133,7 @@ status_t CameraStreamStats::readFromParcel(const android::Parcel* parcel) {
    mWidth = width;
    mHeight = height;
    mFormat = format;
    mMaxPreviewFps = maxPreviewFps;
    mDataSpace = dataSpace;
    mUsage = usage;
    mRequestCount = requestCount;
@@ -166,6 +173,11 @@ status_t CameraStreamStats::writeToParcel(android::Parcel* parcel) const {
        return err;
    }

    if ((err = parcel->writeFloat(mMaxPreviewFps)) != OK) {
        ALOGE("%s: Failed to write stream maxPreviewFps!", __FUNCTION__);
        return err;
    }

    if ((err = parcel->writeInt32(mDataSpace)) != OK) {
        ALOGE("%s: Failed to write stream dataSpace!", __FUNCTION__);
        return err;
@@ -247,6 +259,7 @@ CameraSessionStats::CameraSessionStats() :
        mApiLevel(0),
        mIsNdk(false),
        mLatencyMs(-1),
        mMaxPreviewFps(0),
        mSessionType(0),
        mInternalReconfigure(0),
        mRequestCount(0),
@@ -263,6 +276,7 @@ CameraSessionStats::CameraSessionStats(const String16& cameraId,
                mApiLevel(apiLevel),
                mIsNdk(isNdk),
                mLatencyMs(latencyMs),
                mMaxPreviewFps(0),
                mSessionType(0),
                mInternalReconfigure(0),
                mRequestCount(0),
@@ -319,6 +333,12 @@ status_t CameraSessionStats::readFromParcel(const android::Parcel* parcel) {
        return err;
    }

    float maxPreviewFps;
    if ((err = parcel->readFloat(&maxPreviewFps)) != OK) {
        ALOGE("%s: Failed to read maxPreviewFps from parcel", __FUNCTION__);
        return err;
    }

    int32_t sessionType;
    if ((err = parcel->readInt32(&sessionType)) != OK) {
        ALOGE("%s: Failed to read session type from parcel", __FUNCTION__);
@@ -362,6 +382,7 @@ status_t CameraSessionStats::readFromParcel(const android::Parcel* parcel) {
    mApiLevel = apiLevel;
    mIsNdk = isNdk;
    mLatencyMs = latencyMs;
    mMaxPreviewFps = maxPreviewFps;
    mSessionType = sessionType;
    mInternalReconfigure = internalReconfigure;
    mRequestCount = requestCount;
@@ -415,6 +436,11 @@ status_t CameraSessionStats::writeToParcel(android::Parcel* parcel) const {
        return err;
    }

    if ((err = parcel->writeFloat(mMaxPreviewFps)) != OK) {
        ALOGE("%s: Failed to write maxPreviewFps!", __FUNCTION__);
        return err;
    }

    if ((err = parcel->writeInt32(mSessionType)) != OK) {
        ALOGE("%s: Failed to write session type!", __FUNCTION__);
        return err;
+8 −6
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ public:
    int mWidth;
    int mHeight;
    int mFormat;
    float mMaxPreviewFps;
    int mDataSpace;
    int64_t mUsage;

@@ -68,17 +69,17 @@ public:
    int mStreamUseCase;

    CameraStreamStats() :
            mWidth(0), mHeight(0), mFormat(0), mDataSpace(0), mUsage(0),
            mWidth(0), mHeight(0), mFormat(0), mMaxPreviewFps(0), mDataSpace(0), mUsage(0),
            mRequestCount(0), mErrorCount(0), mStartLatencyMs(0),
            mMaxHalBuffers(0), mMaxAppBuffers(0), mHistogramType(HISTOGRAM_TYPE_UNKNOWN),
            mDynamicRangeProfile(ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD),
            mStreamUseCase(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT) {}
    CameraStreamStats(int width, int height, int format, int dataSpace, int64_t usage,
            int maxHalBuffers, int maxAppBuffers, int dynamicRangeProfile,
    CameraStreamStats(int width, int height, int format, float maxPreviewFps, int dataSpace,
            int64_t usage, int maxHalBuffers, int maxAppBuffers, int dynamicRangeProfile,
            int streamUseCase)
            : mWidth(width), mHeight(height), mFormat(format), mDataSpace(dataSpace),
              mUsage(usage), mRequestCount(0), mErrorCount(0), mStartLatencyMs(0),
              mMaxHalBuffers(maxHalBuffers), mMaxAppBuffers(maxAppBuffers),
            : mWidth(width), mHeight(height), mFormat(format), mMaxPreviewFps(maxPreviewFps),
              mDataSpace(dataSpace), mUsage(usage), mRequestCount(0), mErrorCount(0),
              mStartLatencyMs(0), mMaxHalBuffers(maxHalBuffers), mMaxAppBuffers(maxAppBuffers),
              mHistogramType(HISTOGRAM_TYPE_UNKNOWN),
              mDynamicRangeProfile(dynamicRangeProfile),
              mStreamUseCase(streamUseCase) {}
@@ -123,6 +124,7 @@ public:
    bool mIsNdk;
    // latency in ms for camera open, close, or session creation.
    int mLatencyMs;
    float mMaxPreviewFps;

    // Session info and statistics
    int mSessionType;
+1 −1
Original line number Diff line number Diff line
@@ -287,7 +287,7 @@ void CameraOfflineSessionClient::notifyShutter(const CaptureResultExtras& result
    }
}

status_t CameraOfflineSessionClient::notifyActive() {
status_t CameraOfflineSessionClient::notifyActive(float maxPreviewFps __unused) {
    return startCameraStreamingOps();
}

+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ public:
    // NotificationListener API
    void notifyError(int32_t errorCode, const CaptureResultExtras& resultExtras) override;
    void notifyShutter(const CaptureResultExtras& resultExtras, nsecs_t timestamp) override;
    status_t notifyActive() override;
    status_t notifyActive(float maxPreviewFps) override;
    void notifyIdle(int64_t requestCount, int64_t resultErrorCount, bool deviceError,
            const std::vector<hardware::CameraStreamStats>& streamStats) override;
    void notifyAutoFocus(uint8_t newState, int triggerId) override;
+2 −2
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ void Camera2ClientBase<TClientBase>::notifyError(
}

template <typename TClientBase>
status_t Camera2ClientBase<TClientBase>::notifyActive() {
status_t Camera2ClientBase<TClientBase>::notifyActive(float maxPreviewFps) {
    if (!mDeviceActive) {
        status_t res = TClientBase::startCameraStreamingOps();
        if (res != OK) {
@@ -323,7 +323,7 @@ status_t Camera2ClientBase<TClientBase>::notifyActive() {
                    TClientBase::mCameraIdStr.string(), res);
            return res;
        }
        CameraServiceProxyWrapper::logActive(TClientBase::mCameraIdStr);
        CameraServiceProxyWrapper::logActive(TClientBase::mCameraIdStr, maxPreviewFps);
    }
    mDeviceActive = true;

Loading