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

Commit fc2a78ee authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Camera3: Add flush support to HEIC composite streams" into rvc-dev am: 22e58223

Change-Id: Ieec1aa49e88cc6dfe879b8cae257851c926fc34b
parents 9e922c15 22e58223
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -28,19 +28,19 @@
namespace android {
namespace camera3 {

CompositeStream::CompositeStream(wp<CameraDeviceBase> device,
CompositeStream::CompositeStream(sp<CameraDeviceBase> device,
        wp<hardware::camera2::ICameraDeviceCallbacks> cb) :
        mDevice(device),
        mRemoteCallback(cb),
        mNumPartialResults(1),
        mErrorState(false) {
    sp<CameraDeviceBase> cameraDevice = device.promote();
    if (cameraDevice.get() != nullptr) {
        CameraMetadata staticInfo = cameraDevice->info();
    if (device != nullptr) {
        CameraMetadata staticInfo = device->info();
        camera_metadata_entry_t entry = staticInfo.find(ANDROID_REQUEST_PARTIAL_RESULT_COUNT);
        if (entry.count > 0) {
            mNumPartialResults = entry.data.i32[0];
        }
        mStatusTracker = device->getStatusTracker();
    }
}

@@ -174,7 +174,7 @@ bool CompositeStream::onError(int32_t errorCode, const CaptureResultExtras& resu
            ret = onStreamBufferError(resultExtras);
            break;
        case hardware::camera2::ICameraDeviceCallbacks::ERROR_CAMERA_REQUEST:
            // Invalid request, this shouldn't affect composite streams.
            onRequestError(resultExtras);
            break;
        default:
            ALOGE("%s: Unrecoverable error: %d detected!", __FUNCTION__, errorCode);
@@ -186,7 +186,7 @@ bool CompositeStream::onError(int32_t errorCode, const CaptureResultExtras& resu
    return ret;
}

void CompositeStream::notifyError(int64_t frameNumber) {
void CompositeStream::notifyError(int64_t frameNumber, int32_t requestId) {
    sp<hardware::camera2::ICameraDeviceCallbacks> remoteCb =
        mRemoteCallback.promote();

@@ -194,6 +194,7 @@ void CompositeStream::notifyError(int64_t frameNumber) {
        CaptureResultExtras extras;
        extras.errorStreamId = getStreamId();
        extras.frameNumber = frameNumber;
        extras.requestId = requestId;
        remoteCb->onDeviceError(
                hardware::camera2::ICameraDeviceCallbacks::ERROR_CAMERA_BUFFER,
                extras);
+7 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ namespace camera3 {
class CompositeStream : public camera3::Camera3StreamBufferListener {

public:
    CompositeStream(wp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb);
    CompositeStream(sp<CameraDeviceBase> device, wp<hardware::camera2::ICameraDeviceCallbacks> cb);
    virtual ~CompositeStream() {}

    status_t createStream(const std::vector<sp<Surface>>& consumers,
@@ -95,7 +95,7 @@ protected:
    status_t registerCompositeStreamListener(int32_t streamId);
    void eraseResult(int64_t frameNumber);
    void flagAnErrorFrameNumber(int64_t frameNumber);
    void notifyError(int64_t frameNumber);
    void notifyError(int64_t frameNumber, int32_t requestId);

    // Subclasses should check for buffer errors from internal streams and return 'true' in
    // case the error notification should remain within camera service.
@@ -105,11 +105,16 @@ protected:
    // internal processing needs result data.
    virtual void onResultError(const CaptureResultExtras& resultExtras) = 0;

    // Subclasses can decide how to handle request errors depending on whether
    // or not the internal processing needs clean up.
    virtual void onRequestError(const CaptureResultExtras& /*resultExtras*/) {}

    // Device and/or service is in unrecoverable error state.
    // Composite streams should behave accordingly.
    void enableErrorState();

    wp<CameraDeviceBase>   mDevice;
    wp<camera3::StatusTracker> mStatusTracker;
    wp<hardware::camera2::ICameraDeviceCallbacks> mRemoteCallback;

    mutable Mutex          mMutex;
+5 −5
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
namespace android {
namespace camera3 {

DepthCompositeStream::DepthCompositeStream(wp<CameraDeviceBase> device,
DepthCompositeStream::DepthCompositeStream(sp<CameraDeviceBase> device,
        wp<hardware::camera2::ICameraDeviceCallbacks> cb) :
        CompositeStream(device, cb),
        mBlobStreamId(-1),
@@ -43,9 +43,8 @@ DepthCompositeStream::DepthCompositeStream(wp<CameraDeviceBase> device,
        mProducerListener(new ProducerListener()),
        mMaxJpegSize(-1),
        mIsLogicalCamera(false) {
    sp<CameraDeviceBase> cameraDevice = device.promote();
    if (cameraDevice.get() != nullptr) {
        CameraMetadata staticInfo = cameraDevice->info();
    if (device != nullptr) {
        CameraMetadata staticInfo = device->info();
        auto entry = staticInfo.find(ANDROID_JPEG_MAX_SIZE);
        if (entry.count > 0) {
            mMaxJpegSize = entry.data.i32[0];
@@ -385,7 +384,8 @@ void DepthCompositeStream::releaseInputFrameLocked(InputFrame *inputFrame /*out*
    }

    if ((inputFrame->error || mErrorState) && !inputFrame->errorNotified) {
        notifyError(inputFrame->frameNumber);
        //TODO: Figure out correct requestId
        notifyError(inputFrame->frameNumber, -1 /*requestId*/);
        inputFrame->errorNotified = true;
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ class DepthCompositeStream : public CompositeStream, public Thread,
        public CpuConsumer::FrameAvailableListener {

public:
    DepthCompositeStream(wp<CameraDeviceBase> device,
    DepthCompositeStream(sp<CameraDeviceBase> device,
            wp<hardware::camera2::ICameraDeviceCallbacks> cb);
    ~DepthCompositeStream() override;

@@ -80,8 +80,9 @@ private:
        bool                      error;
        bool                      errorNotified;
        int64_t                   frameNumber;
        int32_t                   requestId;

        InputFrame() : error(false), errorNotified(false), frameNumber(-1) { }
        InputFrame() : error(false), errorNotified(false), frameNumber(-1), requestId(-1) { }
    };

    // Helper methods
+257 −149

File changed.

Preview size limit exceeded, changes collapsed.

Loading