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

Commit c3c536d3 authored by Pawin Vongmasa's avatar Pawin Vongmasa
Browse files

CCodec: Guard against null output->buffers

In CCodecBufferChannel::feedInputBufferIfAvailable(), there is a call to
output->buffers->hasPending(). Since we have changed the logic to allow
output->buffers to be null, the call to hasPending() must be done after
confirming that output->buffers is not null.

Test: atest CtsMediaTestCases

Bug: 158509743
Bug: 158539113
Change-Id: Icb1a46c954ff2b8d5018c0827ff9ca9acd8d4d8e
parent 752adf7f
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -618,13 +618,14 @@ void CCodecBufferChannel::feedInputBufferIfAvailable() {
}

void CCodecBufferChannel::feedInputBufferIfAvailableInternal() {
    if (mInputMetEos ||
           mOutput.lock()->buffers->hasPending() ||
           mPipelineWatcher.lock()->pipelineFull()) {
    if (mInputMetEos || mPipelineWatcher.lock()->pipelineFull()) {
        return;
    } else {
    }
    {
        Mutexed<Output>::Locked output(mOutput);
        if (!output->buffers || output->buffers->numClientBuffers() >= output->numSlots) {
        if (!output->buffers ||
                output->buffers->hasPending() ||
                output->buffers->numClientBuffers() >= output->numSlots) {
            return;
        }
    }