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

Commit b65473f4 authored by Vineeta Srivastava's avatar Vineeta Srivastava
Browse files

Fix kAutoRampDurationUs overflow issue

When kAutoRampDurationUs multiplies with mSampleRate, it overflows to int64.
Type cast it to int64 to make sure RampDurationUs properly.

BUg: 11162491
Change-Id: I4f93bc9acc8456e25623a9255ca7a5b206425009
parent dedc7b0f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -236,10 +236,10 @@ status_t AudioSource::read(
        memset((uint8_t *) buffer->data(), 0, buffer->range_length());
    } else if (elapsedTimeUs < kAutoRampStartUs + kAutoRampDurationUs) {
        int32_t autoRampDurationFrames =
                    (kAutoRampDurationUs * mSampleRate + 500000LL) / 1000000LL;
                    ((int64_t)kAutoRampDurationUs * mSampleRate + 500000LL) / 1000000LL; //Need type casting

        int32_t autoRampStartFrames =
                    (kAutoRampStartUs * mSampleRate + 500000LL) / 1000000LL;
                    ((int64_t)kAutoRampStartUs * mSampleRate + 500000LL) / 1000000LL; //Need type casting

        int32_t nFrames = mNumFramesReceived - autoRampStartFrames;
        rampVolume(nFrames, autoRampDurationFrames,