From b65473f4f881ee7c0a24217ceac69514f6c127d5 Mon Sep 17 00:00:00 2001 From: Vineeta Srivastava Date: Thu, 17 Oct 2013 14:23:00 -0700 Subject: 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 --- media/libstagefright/AudioSource.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp index bdd842f..d7223d9 100644 --- a/media/libstagefright/AudioSource.cpp +++ b/media/libstagefright/AudioSource.cpp @@ -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, -- cgit v1.1