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

Commit 743aeb89 authored by Pawin Vongmasa's avatar Pawin Vongmasa
Browse files

SoftAAC2: Modified conditions for format change notification

after decoding each frame.

Before: The format change notification would not be sent if
mInputBufferCount and mOutputBufferCount do not satisfy
(mInputBufferCount <= 2 || mOutputBufferCount > 1) even when sampleRate
and numChannels are valid and do not match the previous values.

Change: Check sampleRate and numChannels first. If they are valid and
do not match their previous values, the format change notification will
be sent regardless of the values of mInputBufferCount and
mOutputBufferCount. The OMX_EventError will still be sent under the same
condition.

Bug: 27645138
Change-Id: I5499b8495675744e04905c2d94c176fa1ada08e5
parent 613aae14
Loading
Loading
Loading
Loading
+27 −27
Original line number Diff line number Diff line
@@ -767,9 +767,15 @@ void SoftAAC2::onQueueFilled(OMX_U32 /* portIndex */) {
                 * Thus, we could not say for sure whether a stream is
                 * AAC+/eAAC+ until the first data frame is decoded.
                 */
                if (mInputBufferCount <= 2 || mOutputBufferCount > 1) { // TODO: <= 1
                    if (mStreamInfo->sampleRate != prevSampleRate ||
                        mStreamInfo->numChannels != prevNumChannels) {
                if (!mStreamInfo->sampleRate || !mStreamInfo->numChannels) {
                    if ((mInputBufferCount > 2) && (mOutputBufferCount <= 1)) {
                        ALOGW("Invalid AAC stream");
                        mSignalledError = true;
                        notify(OMX_EventError, OMX_ErrorUndefined, decoderErr, NULL);
                        return;
                    }
                } else if ((mStreamInfo->sampleRate != prevSampleRate) ||
                           (mStreamInfo->numChannels != prevNumChannels)) {
                    ALOGI("Reconfiguring decoder: %d->%d Hz, %d->%d channels",
                          prevSampleRate, mStreamInfo->sampleRate,
                          prevNumChannels, mStreamInfo->numChannels);
@@ -788,12 +794,6 @@ void SoftAAC2::onQueueFilled(OMX_U32 /* portIndex */) {
                    }
                    return;
                }
                } else if (!mStreamInfo->sampleRate || !mStreamInfo->numChannels) {
                    ALOGW("Invalid AAC stream");
                    mSignalledError = true;
                    notify(OMX_EventError, OMX_ErrorUndefined, decoderErr, NULL);
                    return;
                }
                if (inHeader && inHeader->nFilledLen == 0) {
                    inInfo->mOwnedByUs = false;
                    mInputBufferCount++;