Loading services/audioflinger/AudioMixer.cpp +8 −7 Original line number Original line Diff line number Diff line Loading @@ -159,7 +159,6 @@ int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId) if (names != 0) { if (names != 0) { int n = __builtin_ctz(names); int n = __builtin_ctz(names); ALOGV("add track (%d)", n); ALOGV("add track (%d)", n); mTrackNames |= 1 << n; // assume default parameters for the track, except where noted below // assume default parameters for the track, except where noted below track_t* t = &mState.tracks[n]; track_t* t = &mState.tracks[n]; t->needs = 0; t->needs = 0; Loading @@ -175,10 +174,10 @@ int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId) // no initialization needed // no initialization needed // t->prevAuxLevel // t->prevAuxLevel // t->frameCount // t->frameCount t->channelCount = 2; t->channelCount = audio_channel_count_from_out_mask(channelMask); t->enabled = false; t->enabled = false; t->format = 16; t->format = 16; t->channelMask = AUDIO_CHANNEL_OUT_STEREO; t->channelMask = channelMask; t->sessionId = sessionId; t->sessionId = sessionId; // setBufferProvider(name, AudioBufferProvider *) is required before enable(name) // setBufferProvider(name, AudioBufferProvider *) is required before enable(name) t->bufferProvider = NULL; t->bufferProvider = NULL; Loading @@ -196,12 +195,14 @@ int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId) t->mMixerFormat = AUDIO_FORMAT_PCM_16_BIT; t->mMixerFormat = AUDIO_FORMAT_PCM_16_BIT; status_t status = initTrackDownmix(&mState.tracks[n], n, channelMask); status_t status = initTrackDownmix(&mState.tracks[n], n, channelMask); if (status == OK) { if (status != OK) { return TRACK0 + n; ALOGE("AudioMixer::getTrackName invalid channelMask (%#x)", channelMask); return -1; } } ALOGE("AudioMixer::getTrackName(0x%x) failed, error preparing track for downmix", mTrackNames |= 1 << n; channelMask); return TRACK0 + n; } } ALOGE("AudioMixer::getTrackName out of available tracks"); return -1; return -1; } } Loading services/audioflinger/FastMixer.cpp +1 −5 Original line number Original line Diff line number Diff line Loading @@ -224,17 +224,13 @@ void FastMixer::onStateChange() AudioBufferProvider *bufferProvider = fastTrack->mBufferProvider; AudioBufferProvider *bufferProvider = fastTrack->mBufferProvider; ALOG_ASSERT(bufferProvider != NULL && fastTrackNames[i] == -1); ALOG_ASSERT(bufferProvider != NULL && fastTrackNames[i] == -1); if (mixer != NULL) { if (mixer != NULL) { // calling getTrackName with default channel mask and a random invalid name = mixer->getTrackName(fastTrack->mChannelMask, AUDIO_SESSION_OUTPUT_MIX); // sessionId (no effects here) name = mixer->getTrackName(AUDIO_CHANNEL_OUT_STEREO, -555); ALOG_ASSERT(name >= 0); ALOG_ASSERT(name >= 0); fastTrackNames[i] = name; fastTrackNames[i] = name; mixer->setBufferProvider(name, bufferProvider); mixer->setBufferProvider(name, bufferProvider); mixer->setParameter(name, AudioMixer::TRACK, AudioMixer::MAIN_BUFFER, mixer->setParameter(name, AudioMixer::TRACK, AudioMixer::MAIN_BUFFER, (void *) mixBuffer); (void *) mixBuffer); // newly allocated track names default to full scale volume // newly allocated track names default to full scale volume mixer->setParameter(name, AudioMixer::TRACK, AudioMixer::CHANNEL_MASK, (void *)(uintptr_t)fastTrack->mChannelMask); mixer->enable(name); mixer->enable(name); } } generations[i] = fastTrack->mGeneration; generations[i] = fastTrack->mGeneration; Loading Loading
services/audioflinger/AudioMixer.cpp +8 −7 Original line number Original line Diff line number Diff line Loading @@ -159,7 +159,6 @@ int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId) if (names != 0) { if (names != 0) { int n = __builtin_ctz(names); int n = __builtin_ctz(names); ALOGV("add track (%d)", n); ALOGV("add track (%d)", n); mTrackNames |= 1 << n; // assume default parameters for the track, except where noted below // assume default parameters for the track, except where noted below track_t* t = &mState.tracks[n]; track_t* t = &mState.tracks[n]; t->needs = 0; t->needs = 0; Loading @@ -175,10 +174,10 @@ int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId) // no initialization needed // no initialization needed // t->prevAuxLevel // t->prevAuxLevel // t->frameCount // t->frameCount t->channelCount = 2; t->channelCount = audio_channel_count_from_out_mask(channelMask); t->enabled = false; t->enabled = false; t->format = 16; t->format = 16; t->channelMask = AUDIO_CHANNEL_OUT_STEREO; t->channelMask = channelMask; t->sessionId = sessionId; t->sessionId = sessionId; // setBufferProvider(name, AudioBufferProvider *) is required before enable(name) // setBufferProvider(name, AudioBufferProvider *) is required before enable(name) t->bufferProvider = NULL; t->bufferProvider = NULL; Loading @@ -196,12 +195,14 @@ int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId) t->mMixerFormat = AUDIO_FORMAT_PCM_16_BIT; t->mMixerFormat = AUDIO_FORMAT_PCM_16_BIT; status_t status = initTrackDownmix(&mState.tracks[n], n, channelMask); status_t status = initTrackDownmix(&mState.tracks[n], n, channelMask); if (status == OK) { if (status != OK) { return TRACK0 + n; ALOGE("AudioMixer::getTrackName invalid channelMask (%#x)", channelMask); return -1; } } ALOGE("AudioMixer::getTrackName(0x%x) failed, error preparing track for downmix", mTrackNames |= 1 << n; channelMask); return TRACK0 + n; } } ALOGE("AudioMixer::getTrackName out of available tracks"); return -1; return -1; } } Loading
services/audioflinger/FastMixer.cpp +1 −5 Original line number Original line Diff line number Diff line Loading @@ -224,17 +224,13 @@ void FastMixer::onStateChange() AudioBufferProvider *bufferProvider = fastTrack->mBufferProvider; AudioBufferProvider *bufferProvider = fastTrack->mBufferProvider; ALOG_ASSERT(bufferProvider != NULL && fastTrackNames[i] == -1); ALOG_ASSERT(bufferProvider != NULL && fastTrackNames[i] == -1); if (mixer != NULL) { if (mixer != NULL) { // calling getTrackName with default channel mask and a random invalid name = mixer->getTrackName(fastTrack->mChannelMask, AUDIO_SESSION_OUTPUT_MIX); // sessionId (no effects here) name = mixer->getTrackName(AUDIO_CHANNEL_OUT_STEREO, -555); ALOG_ASSERT(name >= 0); ALOG_ASSERT(name >= 0); fastTrackNames[i] = name; fastTrackNames[i] = name; mixer->setBufferProvider(name, bufferProvider); mixer->setBufferProvider(name, bufferProvider); mixer->setParameter(name, AudioMixer::TRACK, AudioMixer::MAIN_BUFFER, mixer->setParameter(name, AudioMixer::TRACK, AudioMixer::MAIN_BUFFER, (void *) mixBuffer); (void *) mixBuffer); // newly allocated track names default to full scale volume // newly allocated track names default to full scale volume mixer->setParameter(name, AudioMixer::TRACK, AudioMixer::CHANNEL_MASK, (void *)(uintptr_t)fastTrack->mChannelMask); mixer->enable(name); mixer->enable(name); } } generations[i] = fastTrack->mGeneration; generations[i] = fastTrack->mGeneration; Loading