summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.cpp
diff options
context:
space:
mode:
authorPaul Lind <plind@mips.com>2012-08-01 18:49:49 -0700
committerPaul Lind <plind@mips.com>2012-08-01 18:49:49 -0700
commit3c0a0e8541846427db0587c2fffb90f60ee680b0 (patch)
tree5ec5cfb29970fe635f34145ba9642f96fd91e9b7 /services/audioflinger/AudioMixer.cpp
parentffd99cb795c92caee7f4bd0b26af9ae37b100fc3 (diff)
downloadframeworks_av-3c0a0e8541846427db0587c2fffb90f60ee680b0.zip
frameworks_av-3c0a0e8541846427db0587c2fffb90f60ee680b0.tar.gz
frameworks_av-3c0a0e8541846427db0587c2fffb90f60ee680b0.tar.bz2
Fix initialization of audio mixer track resources for MIPS.
The value 1 << 32 (maxNumTracks defaults to 32) is surprisingly not defined in C, and differs on MIPS than the other arch. Therefore the track resources were not initialized properly, resulting in failure to play any audio. The fix allows the mConfiguredNames bitmask to be correctly set to all 1's in the 32-track case, for all arch. Change-Id: Ied3e1305952e9567602e2cd76c5ef3acb0809ee0 Signed-off-by: Paul Lind <plind@mips.com>
Diffstat (limited to 'services/audioflinger/AudioMixer.cpp')
-rw-r--r--services/audioflinger/AudioMixer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 0c8b3ce..3e4c55e 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -93,8 +93,12 @@ bool AudioMixer::isMultichannelCapable = false;
effect_descriptor_t AudioMixer::dwnmFxDesc;
+// Ensure mConfiguredNames bitmask is initialized properly on all architectures.
+// The value of 1 << x is undefined in C when x >= 32.
+
AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate, uint32_t maxNumTracks)
- : mTrackNames(0), mConfiguredNames((1 << maxNumTracks) - 1), mSampleRate(sampleRate)
+ : mTrackNames(0), mConfiguredNames((maxNumTracks >= 32 ? 0 : 1 << maxNumTracks) - 1),
+ mSampleRate(sampleRate)
{
// AudioMixer is not yet capable of multi-channel beyond stereo
COMPILE_TIME_ASSERT_FUNCTION_SCOPE(2 == MAX_NUM_CHANNELS);