summaryrefslogtreecommitdiffstats
path: root/media/libmedia/SoundPool.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-10-30 09:47:17 -0700
committerGlenn Kasten <gkasten@google.com>2013-10-30 11:07:29 -0700
commit79c5786cf5a5d572cfcf21c3d40613d86bb4093a (patch)
tree05012ba90e2f15a20bce8982e88f0dd538f79231 /media/libmedia/SoundPool.cpp
parentd21952fe5bc94f7bb6ee729f806c0e641fdb1a0d (diff)
downloadframeworks_av-79c5786cf5a5d572cfcf21c3d40613d86bb4093a.zip
frameworks_av-79c5786cf5a5d572cfcf21c3d40613d86bb4093a.tar.gz
frameworks_av-79c5786cf5a5d572cfcf21c3d40613d86bb4093a.tar.bz2
Clean up channel mask handling
Use type audio_channel_mask_t instead of uint32_t. Use function audio_channel_out_mask_from_count() to convert from channel count to channel mask instead of hard-coded assumption. Rename 'channels' to 'channelMask' to avoid confusion with channel count. Change-Id: I21a85e668458b773d108f95c2381eef9c4816251
Diffstat (limited to 'media/libmedia/SoundPool.cpp')
-rw-r--r--media/libmedia/SoundPool.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/media/libmedia/SoundPool.cpp b/media/libmedia/SoundPool.cpp
index 22e9fad..b420c95 100644
--- a/media/libmedia/SoundPool.cpp
+++ b/media/libmedia/SoundPool.cpp
@@ -600,16 +600,15 @@ void SoundChannel::play(const sp<Sample>& sample, int nextChannelID, float leftV
// wrong audio audio buffer size (mAudioBufferSize)
unsigned long toggle = mToggle ^ 1;
void *userData = (void *)((unsigned long)this | toggle);
- uint32_t channels = (numChannels == 2) ?
- AUDIO_CHANNEL_OUT_STEREO : AUDIO_CHANNEL_OUT_MONO;
+ audio_channel_mask_t channelMask = audio_channel_out_mask_from_count(numChannels);
// do not create a new audio track if current track is compatible with sample parameters
#ifdef USE_SHARED_MEM_BUFFER
newTrack = new AudioTrack(streamType, sampleRate, sample->format(),
- channels, sample->getIMemory(), AUDIO_OUTPUT_FLAG_FAST, callback, userData);
+ channelMask, sample->getIMemory(), AUDIO_OUTPUT_FLAG_FAST, callback, userData);
#else
newTrack = new AudioTrack(streamType, sampleRate, sample->format(),
- channels, frameCount, AUDIO_OUTPUT_FLAG_FAST, callback, userData,
+ channelMask, frameCount, AUDIO_OUTPUT_FLAG_FAST, callback, userData,
bufferFrames);
#endif
oldTrack = mAudioTrack;