Loading services/audioflinger/AudioMixer.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -42,12 +42,15 @@ namespace android { // ---------------------------------------------------------------------------- AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) : mTrackNames(0), mSampleRate(sampleRate) AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate, uint32_t maxNumTracks) : mTrackNames(0), mConfiguredNames((1 << maxNumTracks) - 1), mSampleRate(sampleRate) { // AudioMixer is not yet capable of multi-channel beyond stereo COMPILE_TIME_ASSERT_FUNCTION_SCOPE(2 == MAX_NUM_CHANNELS); ALOG_ASSERT(maxNumTracks <= MAX_NUM_TRACKS, "maxNumTracks %u > MAX_NUM_TRACKS %u", maxNumTracks, MAX_NUM_TRACKS); LocalClock lc; mState.enabledTracks= 0; Loading Loading @@ -107,7 +110,7 @@ AudioMixer::~AudioMixer() int AudioMixer::getTrackName() { uint32_t names = ~mTrackNames; uint32_t names = (~mTrackNames) & mConfiguredNames; if (names != 0) { int n = __builtin_ctz(names); ALOGV("add track (%d)", n); Loading services/audioflinger/AudioMixer.h +8 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ namespace android { class AudioMixer { public: AudioMixer(size_t frameCount, uint32_t sampleRate); AudioMixer(size_t frameCount, uint32_t sampleRate, uint32_t maxNumTracks = MAX_NUM_TRACKS); /*virtual*/ ~AudioMixer(); // non-virtual saves a v-table, restore if sub-classed Loading Loading @@ -189,11 +190,17 @@ private: int32_t *outputTemp; int32_t *resampleTemp; int32_t reserved[2]; // FIXME allocate dynamically to save some memory when maxNumTracks < MAX_NUM_TRACKS track_t tracks[MAX_NUM_TRACKS]; __attribute__((aligned(32))); }; // bitmask of allocated track names, where bit 0 corresponds to TRACK0 etc. uint32_t mTrackNames; // bitmask of configured track names; ~0 if maxNumTracks == MAX_NUM_TRACKS, // but will have fewer bits set if maxNumTracks < MAX_NUM_TRACKS const uint32_t mConfiguredNames; const uint32_t mSampleRate; state_t mState __attribute__((aligned(32))); Loading Loading
services/audioflinger/AudioMixer.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -42,12 +42,15 @@ namespace android { // ---------------------------------------------------------------------------- AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate) : mTrackNames(0), mSampleRate(sampleRate) AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate, uint32_t maxNumTracks) : mTrackNames(0), mConfiguredNames((1 << maxNumTracks) - 1), mSampleRate(sampleRate) { // AudioMixer is not yet capable of multi-channel beyond stereo COMPILE_TIME_ASSERT_FUNCTION_SCOPE(2 == MAX_NUM_CHANNELS); ALOG_ASSERT(maxNumTracks <= MAX_NUM_TRACKS, "maxNumTracks %u > MAX_NUM_TRACKS %u", maxNumTracks, MAX_NUM_TRACKS); LocalClock lc; mState.enabledTracks= 0; Loading Loading @@ -107,7 +110,7 @@ AudioMixer::~AudioMixer() int AudioMixer::getTrackName() { uint32_t names = ~mTrackNames; uint32_t names = (~mTrackNames) & mConfiguredNames; if (names != 0) { int n = __builtin_ctz(names); ALOGV("add track (%d)", n); Loading
services/audioflinger/AudioMixer.h +8 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,8 @@ namespace android { class AudioMixer { public: AudioMixer(size_t frameCount, uint32_t sampleRate); AudioMixer(size_t frameCount, uint32_t sampleRate, uint32_t maxNumTracks = MAX_NUM_TRACKS); /*virtual*/ ~AudioMixer(); // non-virtual saves a v-table, restore if sub-classed Loading Loading @@ -189,11 +190,17 @@ private: int32_t *outputTemp; int32_t *resampleTemp; int32_t reserved[2]; // FIXME allocate dynamically to save some memory when maxNumTracks < MAX_NUM_TRACKS track_t tracks[MAX_NUM_TRACKS]; __attribute__((aligned(32))); }; // bitmask of allocated track names, where bit 0 corresponds to TRACK0 etc. uint32_t mTrackNames; // bitmask of configured track names; ~0 if maxNumTracks == MAX_NUM_TRACKS, // but will have fewer bits set if maxNumTracks < MAX_NUM_TRACKS const uint32_t mConfiguredNames; const uint32_t mSampleRate; state_t mState __attribute__((aligned(32))); Loading