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

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

Merge "Camera: Attach Jpeg/R composite stream metrics" into udc-dev

parents 10207c29 567c31c9
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -2026,8 +2026,20 @@ void CameraDeviceClient::notifyIdle(
    if (remoteCb != 0) {
        remoteCb->onDeviceIdle();
    }

    std::vector<hardware::CameraStreamStats> fullStreamStats = streamStats;
    {
        Mutex::Autolock l(mCompositeLock);
        for (size_t i = 0; i < mCompositeStreamMap.size(); i++) {
            hardware::CameraStreamStats compositeStats;
            mCompositeStreamMap.valueAt(i)->getStreamStats(&compositeStats);
            if (compositeStats.mWidth > 0) {
                fullStreamStats.push_back(compositeStats);
            }
        }
    }
    Camera2ClientBase::notifyIdleWithUserTag(requestCount, resultErrorCount, deviceError,
            streamStats, mUserTag, mVideoStabilizationMode);
            fullStreamStats, mUserTag, mVideoStabilizationMode);
}

void CameraDeviceClient::notifyShutter(const CaptureResultExtras& resultExtras,
+8 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ status_t CompositeStream::deleteStream() {
        mCaptureResults.clear();
        mFrameNumberMap.clear();
        mErrorFrameNumbers.clear();
        mRequestTimeMap.clear();
    }

    return deleteInternalStreams();
@@ -97,6 +98,8 @@ void CompositeStream::onBufferRequestForFrameNumber(uint64_t frameNumber, int st
    Mutex::Autolock l(mMutex);
    if (!mErrorState && (streamId == getStreamId())) {
        mPendingCaptureResults.emplace(frameNumber, CameraMetadata());
        auto ts = systemTime();
        mRequestTimeMap.emplace(frameNumber, ts);
    }
}

@@ -111,6 +114,11 @@ void CompositeStream::onBufferReleased(const BufferInfo& bufferInfo) {
void CompositeStream::eraseResult(int64_t frameNumber) {
    Mutex::Autolock l(mMutex);

    auto requestTimeIt = mRequestTimeMap.find(frameNumber);
    if (requestTimeIt != mRequestTimeMap.end()) {
        mRequestTimeMap.erase(requestTimeIt);
    }

    auto it = mPendingCaptureResults.find(frameNumber);
    if (it == mPendingCaptureResults.end()) {
        return;
+6 −0
Original line number Diff line number Diff line
@@ -83,6 +83,9 @@ public:
    // Notify when shutter notify is triggered
    virtual void onShutter(const CaptureResultExtras& /*resultExtras*/, nsecs_t /*timestamp*/) {}

    // Get composite stream stats
    virtual void getStreamStats(hardware::CameraStreamStats* streamStats /*out*/) = 0;

    void onResultAvailable(const CaptureResult& result);
    bool onError(int32_t errorCode, const CaptureResultExtras& resultExtras);

@@ -140,6 +143,9 @@ protected:
    // Keeps a set buffer/result frame numbers for any errors detected during processing.
    std::set<int64_t> mErrorFrameNumbers;

    // Frame number to request time map
    std::unordered_map<int64_t, nsecs_t> mRequestTimeMap;

};

}; //namespace camera3
+3 −0
Original line number Diff line number Diff line
@@ -69,6 +69,9 @@ public:
    static status_t getCompositeStreamInfo(const OutputStreamInfo &streamInfo,
            const CameraMetadata& ch, std::vector<OutputStreamInfo>* compositeOutput /*out*/);

    // Get composite stream stats
    void getStreamStats(hardware::CameraStreamStats*) override {};

protected:

    bool threadLoop() override;
+3 −0
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@ public:
    static status_t getCompositeStreamInfo(const OutputStreamInfo &streamInfo,
            const CameraMetadata& ch, std::vector<OutputStreamInfo>* compositeOutput /*out*/);

    // Get composite stream stats
    void getStreamStats(hardware::CameraStreamStats*) override {};

    static bool isSizeSupportedByHeifEncoder(int32_t width, int32_t height,
            bool* useHeic, bool* useGrid, int64_t* stall, AString* hevcName = nullptr);
    static bool isInMemoryTempFileSupported();
Loading