summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-04-01 21:15:46 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-01 21:15:46 +0000
commit0fb6aabfb5edaa7687372fac1b1b7c329e7629a2 (patch)
tree8a74af758331fae76c66029b02dc71eec926695e /media
parentec24fa46443634cd29627182c5812ccf43682692 (diff)
parenta8eccec73a40d4afcff505eb463a016c89aeed42 (diff)
downloadframeworks_av-0fb6aabfb5edaa7687372fac1b1b7c329e7629a2.zip
frameworks_av-0fb6aabfb5edaa7687372fac1b1b7c329e7629a2.tar.gz
frameworks_av-0fb6aabfb5edaa7687372fac1b1b7c329e7629a2.tar.bz2
Merge "ToneGenerator: fix overflow in stopTone" into jb-mr2-dev
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/ToneGenerator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/media/libmedia/ToneGenerator.cpp b/media/libmedia/ToneGenerator.cpp
index 9ea3ea7..f09ce75 100644
--- a/media/libmedia/ToneGenerator.cpp
+++ b/media/libmedia/ToneGenerator.cpp
@@ -986,7 +986,7 @@ void ToneGenerator::stopTone() {
// If the start time is valid, make sure that the number of audio samples produced
// corresponds at least to the time between the start and stop commands.
// This is needed in case of cold start of the output stream.
- if ((mStartTime. tv_sec != 0) && (clock_gettime(CLOCK_MONOTONIC, &stopTime) == 0)) {
+ if ((mStartTime.tv_sec != 0) && (clock_gettime(CLOCK_MONOTONIC, &stopTime) == 0)) {
time_t sec = stopTime.tv_sec - mStartTime.tv_sec;
long nsec = stopTime.tv_nsec - mStartTime.tv_nsec;
long durationMs;
@@ -1000,7 +1000,7 @@ void ToneGenerator::stopTone() {
} else {
// mSamplingRate is always > 1000
sec = sec * 1000 + nsec / 1000000; // duration in milliseconds
- mMaxSmp = (sec * mSamplingRate) / 1000;
+ mMaxSmp = (unsigned int)(((int64_t)sec * mSamplingRate) / 1000);
}
ALOGV("stopTone() forcing mMaxSmp to %d, total for far %d", mMaxSmp, mTotalSmp);
} else {