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

Commit 2a90484b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "CCodec: use null wrapper instead of empty buffer" into sc-dev am: b03bd4e9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/15285630

Change-Id: Ia48f186126cad13076f11d4356a52f2fe42a09bb
parents c748eea6 b03bd4e9
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -1301,17 +1301,7 @@ RawGraphicOutputBuffers::RawGraphicOutputBuffers(

sp<Codec2Buffer> RawGraphicOutputBuffers::wrap(const std::shared_ptr<C2Buffer> &buffer) {
    if (buffer == nullptr) {
        sp<Codec2Buffer> c2buffer = ConstGraphicBlockBuffer::AllocateEmpty(
                mFormat,
                [lbp = mLocalBufferPool](size_t capacity) {
                    return lbp->newBuffer(capacity);
                });
        if (c2buffer == nullptr) {
            ALOGD("[%s] ConstGraphicBlockBuffer::AllocateEmpty failed", mName);
            return nullptr;
        }
        c2buffer->setRange(0, 0);
        return c2buffer;
        return new Codec2Buffer(mFormat, new ABuffer(nullptr, 0));
    } else {
        return ConstGraphicBlockBuffer::Allocate(
                mFormat,
+13 −0
Original line number Diff line number Diff line
@@ -106,6 +106,19 @@ TEST(RawGraphicOutputBuffersTest, ChangeNumSlots) {
    }
}

TEST(RawGraphicOutputBuffersTest, WrapNullBuffer) {
    constexpr int32_t kWidth = 320;
    constexpr int32_t kHeight = 240;

    std::shared_ptr<RawGraphicOutputBuffers> buffers =
        GetRawGraphicOutputBuffers(kWidth, kHeight);

    sp<Codec2Buffer> buffer = buffers->wrap(nullptr);
    ASSERT_EQ(nullptr, buffer->base());
    ASSERT_EQ(0, buffer->size());
    ASSERT_EQ(0, buffer->offset());
}

TEST(RawGraphicOutputBuffersTest, FlexYuvColorFormat) {
    constexpr int32_t kWidth = 320;
    constexpr int32_t kHeight = 240;