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

Commit c015b84e authored by Andy Hung's avatar Andy Hung
Browse files

Fix SoftMP3 divide by 0

Bug: 21525346
Change-Id: I19f1ec0f4e9571bd6aeb26efbcba5f16dc664e47
parent ad949cd4
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -283,6 +283,11 @@ void SoftMP3::onQueueFilled(OMX_U32 /* portIndex */) {
            } else {
                // This is recoverable, just ignore the current frame and
                // play silence instead.

                // TODO: should we skip silence (and consume input data)
                // if mIsFirst is true as we may not have a valid
                // mConfig->samplingRate and mConfig->num_channels?
                ALOGV_IF(mIsFirst, "insufficient data for first frame, sending silence");
                memset(outHeader->pBuffer,
                       0,
                       mConfig->outputFrameSize * sizeof(int16_t));
@@ -317,8 +322,7 @@ void SoftMP3::onQueueFilled(OMX_U32 /* portIndex */) {
        }

        outHeader->nTimeStamp =
            mAnchorTimeUs
                + (mNumFramesOutput * 1000000ll) / mConfig->samplingRate;
            mAnchorTimeUs + (mNumFramesOutput * 1000000ll) / mSamplingRate;

        if (inHeader) {
            CHECK_GE(inHeader->nFilledLen, mConfig->inputBufferUsedLength);