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

Commit 82783425 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "MediaCodecLinearBlock: Let input slot available for onWorkDone buffer."...

Merge "MediaCodecLinearBlock: Let input slot available for onWorkDone buffer." am: c831fde1 am: e0aa0a98 am: fedca6e3

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1844937



Change-Id: Iec0dc3b12775f73836f9043bdbf5f74c07bb8776
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 701ab69c fedca6e3
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -44,12 +44,19 @@ struct JMediaCodecLinearBlock {

    std::shared_ptr<C2Buffer> toC2Buffer(size_t offset, size_t size) const {
        if (mBuffer) {
            // TODO: if returned C2Buffer is different from mBuffer, we should
            // find a way to connect the life cycle between this C2Buffer and
            // mBuffer.
            if (mBuffer->data().type() != C2BufferData::LINEAR) {
                return nullptr;
            }
            C2ConstLinearBlock block = mBuffer->data().linearBlocks().front();
            if (offset == 0 && size == block.capacity()) {
                return mBuffer;
                // Let C2Buffer be new one to queue to MediaCodec. It will allow
                // the related input slot to be released by onWorkDone from C2
                // Component. Currently, the life cycle of mBuffer should be
                // protected by different flows.
                return std::make_shared<C2Buffer>(*mBuffer);
            }

            std::shared_ptr<C2Buffer> buffer =