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

Commit ed422aa0 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "We were accidentally sending out an output buffer before the final port settings change"

parents 0e8f3d80 eca1762d
Loading
Loading
Loading
Loading
+25 −19
Original line number Diff line number Diff line
@@ -378,6 +378,11 @@ void SoftAAC::onQueueFilled(OMX_U32 portIndex) {
            // fall through
        }

        if (decoderErr == MP4AUDEC_SUCCESS || mNumSamplesOutput > 0) {
            // We'll only output data if we successfully decoded it or
            // we've previously decoded valid data, in the latter case
            // (decode failed) we'll output a silent frame.

            if (mUpsamplingFactor == 2) {
                if (mConfig->desiredChannels == 1) {
                    memcpy(&mConfig->pOutputBuffer[1024],
@@ -396,6 +401,13 @@ void SoftAAC::onQueueFilled(OMX_U32 portIndex) {

            mNumSamplesOutput += mConfig->frameLength * mUpsamplingFactor;

            outInfo->mOwnedByUs = false;
            outQueue.erase(outQueue.begin());
            outInfo = NULL;
            notifyFillBufferDone(outHeader);
            outHeader = NULL;
        }

        if (inHeader->nFilledLen == 0) {
            inInfo->mOwnedByUs = false;
            inQueue.erase(inQueue.begin());
@@ -404,12 +416,6 @@ void SoftAAC::onQueueFilled(OMX_U32 portIndex) {
            inHeader = NULL;
        }

        outInfo->mOwnedByUs = false;
        outQueue.erase(outQueue.begin());
        outInfo = NULL;
        notifyFillBufferDone(outHeader);
        outHeader = NULL;

        if (decoderErr == MP4AUDEC_SUCCESS) {
            ++mInputBufferCount;
        }