summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AudioSource.cpp
diff options
context:
space:
mode:
authorVineeta Srivastava <vsrivastava@google.com>2013-10-17 14:23:00 -0700
committerVineeta Srivastava <vsrivastava@google.com>2013-10-18 15:01:49 -0700
commitb65473f4f881ee7c0a24217ceac69514f6c127d5 (patch)
treef4bf921ad9ef6a08be65eaa9134621eae3c9d759 /media/libstagefright/AudioSource.cpp
parentdedc7b0fa23c21b525dc8abb572bb8161ad66a9b (diff)
downloadframeworks_av-b65473f4f881ee7c0a24217ceac69514f6c127d5.zip
frameworks_av-b65473f4f881ee7c0a24217ceac69514f6c127d5.tar.gz
frameworks_av-b65473f4f881ee7c0a24217ceac69514f6c127d5.tar.bz2
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
Diffstat (limited to 'media/libstagefright/AudioSource.cpp')
-rw-r--r--media/libstagefright/AudioSource.cpp4
1 files 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,