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

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

Merge "Camera: Release online and offline resources" into rvc-dev am: c2462eae am: e460b137

Change-Id: I5ae004297f445b87139bcfbb78733e4d04551c5e
parents 1fc46f9f e460b137
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -59,6 +59,10 @@ status_t CameraOfflineSessionClient::initialize(sp<CameraProviderManager>, const
        return res;
        return res;
    }
    }


    for (size_t i = 0; i < mCompositeStreamMap.size(); i++) {
        mCompositeStreamMap.valueAt(i)->switchToOffline();
    }

    return OK;
    return OK;
}
}


+5 −0
Original line number Original line Diff line number Diff line
@@ -200,5 +200,10 @@ void CompositeStream::notifyError(int64_t frameNumber) {
    }
    }
}
}


void CompositeStream::switchToOffline() {
    Mutex::Autolock l(mMutex);
    mDevice.clear();
}

}; // namespace camera3
}; // namespace camera3
}; // namespace android
}; // namespace android
+3 −0
Original line number Original line Diff line number Diff line
@@ -48,6 +48,9 @@ public:


    status_t deleteStream();
    status_t deleteStream();


    // Switch to offline mode and release any online resources.
    void switchToOffline();

    // Create and register all internal camera streams.
    // Create and register all internal camera streams.
    virtual status_t createInternalStreams(const std::vector<sp<Surface>>& consumers,
    virtual status_t createInternalStreams(const std::vector<sp<Surface>>& consumers,
            bool hasDeferredConsumer, uint32_t width, uint32_t height, int format,
            bool hasDeferredConsumer, uint32_t width, uint32_t height, int format,
+8 −7
Original line number Original line Diff line number Diff line
@@ -619,14 +619,15 @@ status_t DepthCompositeStream::deleteInternalStreams() {
                strerror(-ret), ret);
                strerror(-ret), ret);
    }
    }


    if (mDepthStreamId >= 0) {
        // Camera devices may not be valid after switching to offline mode.
        // In this case, all offline streams including internal composite streams
        // are managed and released by the offline session.
        sp<CameraDeviceBase> device = mDevice.promote();
        sp<CameraDeviceBase> device = mDevice.promote();
    if (!device.get()) {
        if (device.get() != nullptr) {
        ALOGE("%s: Invalid camera device!", __FUNCTION__);
            ret = device->deleteStream(mDepthStreamId);
        return NO_INIT;
        }
        }


    if (mDepthStreamId >= 0) {
        ret = device->deleteStream(mDepthStreamId);
        mDepthStreamId = -1;
        mDepthStreamId = -1;
    }
    }


+5 −4
Original line number Original line Diff line number Diff line
@@ -209,13 +209,14 @@ status_t HeicCompositeStream::deleteInternalStreams() {
    deinitCodec();
    deinitCodec();


    if (mAppSegmentStreamId >= 0) {
    if (mAppSegmentStreamId >= 0) {
        // Camera devices may not be valid after switching to offline mode.
        // In this case, all offline streams including internal composite streams
        // are managed and released by the offline session.
        sp<CameraDeviceBase> device = mDevice.promote();
        sp<CameraDeviceBase> device = mDevice.promote();
        if (!device.get()) {
        if (device.get() != nullptr) {
            ALOGE("%s: Invalid camera device!", __FUNCTION__);
            res = device->deleteStream(mAppSegmentStreamId);
            return NO_INIT;
        }
        }


        res = device->deleteStream(mAppSegmentStreamId);
        mAppSegmentStreamId = -1;
        mAppSegmentStreamId = -1;
    }
    }


Loading