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

Commit 9a3f4251 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6318458 from 6437df87 to rvc-release

Change-Id: I37827a6b5509bbc433df45253b0e7e91ba9945b2
parents 0147c736 6437df87
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@

#include <hidlmemory/mapping.h>

#include <vector>

static const OMX_U32 kPortIndexInput = 0;
static const OMX_U32 kPortIndexOutput = 1;

@@ -493,9 +495,7 @@ status_t OMXNodeInstance::freeNode() {

        case OMX_StateLoaded:
        {
            if (mActiveBuffers.size() > 0) {
            freeActiveBuffers();
            }
            FALLTHROUGH_INTENDED;
        }
        case OMX_StateInvalid:
@@ -2430,11 +2430,19 @@ void OMXNodeInstance::removeActiveBuffer(
}

void OMXNodeInstance::freeActiveBuffers() {
    // Make sure to count down here, as freeBuffer will in turn remove
    // the active buffer from the vector...
    for (size_t i = mActiveBuffers.size(); i > 0;) {
        i--;
        freeBuffer(mActiveBuffers[i].mPortIndex, mActiveBuffers[i].mID);
    std::vector<OMX_U32> portIndices;
    std::vector<IOMX::buffer_id> bufferIds;
    {
        // Access to mActiveBuffers must be protected by mLock.
        Mutex::Autolock _l(mLock);
        for (const ActiveBuffer& activeBuffer : mActiveBuffers) {
            portIndices.emplace_back(activeBuffer.mPortIndex);
            bufferIds.emplace_back(activeBuffer.mID);
        }
    }
    for (size_t i = bufferIds.size(); i > 0; ) {
        --i;
        freeBuffer(portIndices[i], bufferIds[i]);
    }
}

+4 −0
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ status_t CameraOfflineSessionClient::initialize(sp<CameraProviderManager>, const
        return res;
    }

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

    return OK;
}

+5 −0
Original line number 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 android
+3 −0
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ public:

    status_t deleteStream();

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

    // Create and register all internal camera streams.
    virtual status_t createInternalStreams(const std::vector<sp<Surface>>& consumers,
            bool hasDeferredConsumer, uint32_t width, uint32_t height, int format,
+8 −7
Original line number Diff line number Diff line
@@ -619,14 +619,15 @@ status_t DepthCompositeStream::deleteInternalStreams() {
                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();
    if (!device.get()) {
        ALOGE("%s: Invalid camera device!", __FUNCTION__);
        return NO_INIT;
        if (device.get() != nullptr) {
            ret = device->deleteStream(mDepthStreamId);
        }

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

Loading