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

Commit 1ff811b0 authored by Zhijun He's avatar Zhijun He
Browse files

Camera3: return cancelled buffers to buffer manager

When a buffer is cancelled, it is considered as a free buffer and need to be
returned to buffer manamager for buffer reuse. This will also make the prepare
work.

Also fix the buffer removal bug.

Bug: 25088440
Change-Id: I0e3da44c76008406ee19541366da7a962c355949
parent 2961a353
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -362,11 +362,12 @@ status_t Camera3BufferManager::removeBuffersFromBufferListLocked(BufferList& buf
    while (i != bufferList.end()) {
        ssize_t idx = i->indexOfKey(streamId);
        if (idx != NAME_NOT_FOUND) {
            ALOGV("%s: Remove a buffer for stream %d, free buffer total count: %zu",
                    __FUNCTION__, streamId, bufferList.size());
            i->removeItem(streamId);
            if (i->isEmpty()) {
                i = bufferList.erase(i);
            }
            break;
        } else {
            i++;
        }
+5 −0
Original line number Diff line number Diff line
@@ -220,6 +220,11 @@ status_t Camera3OutputStream::returnBufferCheckedLocked(
            ALOGE("%s: Stream %d: Error cancelling buffer to native window:"
                  " %s (%d)", __FUNCTION__, mId, strerror(-res), res);
        }

        if (mUseBufferManager) {
            // Return this buffer back to buffer manager.
            mBufferReleasedListener->onBufferReleased();
        }
    } else {
        if (mTraceFirstBuffer && (stream_type == CAMERA3_STREAM_OUTPUT)) {
            {