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

Commit c50e04a5 authored by Shuzhen Wang's avatar Shuzhen Wang Committed by Android (Google) Code Review
Browse files

Merge "Camera2: Add onCaptureQueueEmpty callback"

parents d3f86cde 9d06601e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44,4 +44,5 @@ interface ICameraDeviceCallbacks
     * @param lastFrameNumber Frame number of the last frame of the streaming request.
     */
    oneway void onRepeatingRequestError(in long lastFrameNumber);
    oneway void onRequestQueueEmpty();
}
+6 −0
Original line number Diff line number Diff line
@@ -1346,6 +1346,12 @@ CameraDevice::ServiceCallback::onPrepared(int) {
    return binder::Status::ok();
}

binder::Status
CameraDevice::ServiceCallback::onRequestQueueEmpty() {
    // onRequestQueueEmpty not yet implemented in NDK
    return binder::Status::ok();
}

binder::Status
CameraDevice::ServiceCallback::onRepeatingRequestError(int64_t lastFrameNumber) {
    binder::Status ret = binder::Status::ok();
+1 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ class CameraDevice final : public RefBase {
        binder::Status onResultReceived(const CameraMetadata& metadata,
                              const CaptureResultExtras& resultExtras) override;
        binder::Status onPrepared(int streamId) override;
        binder::Status onRequestQueueEmpty() override;
        binder::Status onRepeatingRequestError(int64_t lastFrameNumber) override;
      private:
        const wp<CameraDevice> mDevice;
+9 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ public:
        SENT_RESULT,
        UNINITIALIZED,
        REPEATING_REQUEST_ERROR,
        REQUEST_QUEUE_EMPTY,
    };

protected:
@@ -225,6 +226,14 @@ public:
        return binder::Status::ok();
    }

    virtual binder::Status onRequestQueueEmpty() {
        Mutex::Autolock l(mLock);
        mLastStatus = REQUEST_QUEUE_EMPTY;
        mStatusesHit.push_back(mLastStatus);
        mStatusCondition.broadcast();
        return binder::Status::ok();
    }

    // Test helper functions:

    bool hadError() const {
+8 −0
Original line number Diff line number Diff line
@@ -1210,6 +1210,14 @@ void CameraDeviceClient::notifyPrepared(int streamId) {
    }
}

void CameraDeviceClient::notifyRequestQueueEmpty() {
    // Thread safe. Don't bother locking.
    sp<hardware::camera2::ICameraDeviceCallbacks> remoteCb = getRemoteCallback();
    if (remoteCb != 0) {
        remoteCb->onRequestQueueEmpty();
    }
}

void CameraDeviceClient::detachDevice() {
    if (mDevice == 0) return;

Loading