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>
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 @@
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);