summaryrefslogtreecommitdiffstats
path: root/media/jni/soundpool
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-06-01 09:58:43 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-06-01 09:58:43 -0700
commit4599184a1c1c3f54b396c49b5728e4031e559e18 (patch)
tree5a540a21948b855027917c91cb8e4aa68258ec76 /media/jni/soundpool
parentceb0cba3574770b62ab37c6f401a5509728eca58 (diff)
parent450ad31b62af468aa0fb308a5c983b8f8334ae4e (diff)
downloadframeworks_base-4599184a1c1c3f54b396c49b5728e4031e559e18.zip
frameworks_base-4599184a1c1c3f54b396c49b5728e4031e559e18.tar.gz
frameworks_base-4599184a1c1c3f54b396c49b5728e4031e559e18.tar.bz2
am 450ad31b: Merge change 2774 into donut
Merge commit '450ad31b62af468aa0fb308a5c983b8f8334ae4e' * commit '450ad31b62af468aa0fb308a5c983b8f8334ae4e': Limit check on maxChannels for SoundPool.
Diffstat (limited to 'media/jni/soundpool')
-rw-r--r--media/jni/soundpool/SoundPool.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/media/jni/soundpool/SoundPool.cpp b/media/jni/soundpool/SoundPool.cpp
index 0812650..ce80f92 100644
--- a/media/jni/soundpool/SoundPool.cpp
+++ b/media/jni/soundpool/SoundPool.cpp
@@ -44,23 +44,27 @@ SoundPool::SoundPool(jobject soundPoolRef, int maxChannels, int streamType, int
LOGV("SoundPool constructor: maxChannels=%d, streamType=%d, srcQuality=%d",
maxChannels, streamType, srcQuality);
- if (maxChannels > 32) {
- LOGW("App requested %d channels, capped at 32", maxChannels);
- maxChannels = 32;
+ // check limits
+ mMaxChannels = maxChannels;
+ if (mMaxChannels < 1) {
+ mMaxChannels = 1;
+ }
+ else if (mMaxChannels > 32) {
+ mMaxChannels = 32;
}
+ LOGW_IF(maxChannels != mMaxChannels, "App requested %d channels", maxChannels);
mQuit = false;
mSoundPoolRef = soundPoolRef;
mDecodeThread = 0;
- mMaxChannels = maxChannels;
mStreamType = streamType;
mSrcQuality = srcQuality;
mAllocated = 0;
mNextSampleID = 0;
mNextChannelID = 0;
- mChannelPool = new SoundChannel[maxChannels];
- for (int i = 0; i < maxChannels; ++i) {
+ mChannelPool = new SoundChannel[mMaxChannels];
+ for (int i = 0; i < mMaxChannels; ++i) {
mChannelPool[i].init(this);
mChannels.push_back(&mChannelPool[i]);
}