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

Commit ea55da94 authored by Marco Nelissen's avatar Marco Nelissen Committed by Android (Google) Code Review
Browse files

Merge "Fix SoftAAC2 flush" into lmp-dev

parents e0711f26 4edf384a
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -974,11 +974,15 @@ void SoftAAC2::onPortFlushCompleted(OMX_U32 portIndex) {
        mDecodedSizes.clear();
        mLastInHeader = NULL;
    } else {
        while (outputDelayRingBufferSamplesAvailable() > 0) {
            int32_t ns = outputDelayRingBufferGetSamples(0,
                    mStreamInfo->frameSize * mStreamInfo->numChannels);
            if (ns != mStreamInfo->frameSize * mStreamInfo->numChannels) {
        int avail;
        while ((avail = outputDelayRingBufferSamplesAvailable()) > 0) {
            if (avail > mStreamInfo->frameSize * mStreamInfo->numChannels) {
                avail = mStreamInfo->frameSize * mStreamInfo->numChannels;
            }
            int32_t ns = outputDelayRingBufferGetSamples(0, avail);
            if (ns != avail) {
                ALOGE("not a complete frame of samples available");
                break;
            }
            mOutputBufferCount++;
        }