Loading media/jni/android_media_MediaCodecLinearBlock.h +8 −1 Original line number Original line Diff line number Diff line Loading @@ -44,12 +44,19 @@ struct JMediaCodecLinearBlock { std::shared_ptr<C2Buffer> toC2Buffer(size_t offset, size_t size) const { std::shared_ptr<C2Buffer> toC2Buffer(size_t offset, size_t size) const { if (mBuffer) { 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) { if (mBuffer->data().type() != C2BufferData::LINEAR) { return nullptr; return nullptr; } } C2ConstLinearBlock block = mBuffer->data().linearBlocks().front(); C2ConstLinearBlock block = mBuffer->data().linearBlocks().front(); if (offset == 0 && size == block.capacity()) { 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 = std::shared_ptr<C2Buffer> buffer = Loading Loading
media/jni/android_media_MediaCodecLinearBlock.h +8 −1 Original line number Original line Diff line number Diff line Loading @@ -44,12 +44,19 @@ struct JMediaCodecLinearBlock { std::shared_ptr<C2Buffer> toC2Buffer(size_t offset, size_t size) const { std::shared_ptr<C2Buffer> toC2Buffer(size_t offset, size_t size) const { if (mBuffer) { 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) { if (mBuffer->data().type() != C2BufferData::LINEAR) { return nullptr; return nullptr; } } C2ConstLinearBlock block = mBuffer->data().linearBlocks().front(); C2ConstLinearBlock block = mBuffer->data().linearBlocks().front(); if (offset == 0 && size == block.capacity()) { 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 = std::shared_ptr<C2Buffer> buffer = Loading