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

Commit 72a71019 authored by Wonsik Kim's avatar Wonsik Kim
Browse files

CCodecBufferChannel: exit handleWork early if output buffers are cleared

Bug: 260805148
Test: atest android.media.codec.cts.MediaCodecTest#testAbruptStop
Change-Id: I808a3e24d45d1670f3d91d59f59318a01ca6aef6
parent 692bb92e
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1965,7 +1965,10 @@ bool CCodecBufferChannel::handleWork(
    // csd cannot be re-ordered and will always arrive first.
    if (initData != nullptr) {
        Mutexed<Output>::Locked output(mOutput);
        if (output->buffers && outputFormat) {
        if (!output->buffers) {
            return false;
        }
        if (outputFormat) {
            output->buffers->updateSkipCutBuffer(outputFormat);
            output->buffers->setFormat(outputFormat);
        }
@@ -1974,7 +1977,7 @@ bool CCodecBufferChannel::handleWork(
        }
        size_t index;
        sp<MediaCodecBuffer> outBuffer;
        if (output->buffers && output->buffers->registerCsd(initData, &index, &outBuffer) == OK) {
        if (output->buffers->registerCsd(initData, &index, &outBuffer) == OK) {
            outBuffer->meta()->setInt64("timeUs", timestamp.peek());
            outBuffer->meta()->setInt32("flags", BUFFER_FLAG_CODEC_CONFIG);
            ALOGV("[%s] onWorkDone: csd index = %zu [%p]", mName, index, outBuffer.get());