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


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

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


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

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


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

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


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


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


    // Session info and statistics
    // Session info and statistics
    int mSessionType;
    int mSessionType;
+1 −1
Original line number Original line 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();
    return startCameraStreamingOps();
}
}


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


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


Loading