Loading services/audioflinger/AudioMixer.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -153,8 +153,13 @@ void AudioMixer::setLog(NBLog::Writer *log) mState.mLog = log; } int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId) int AudioMixer::getTrackName(audio_channel_mask_t channelMask, audio_format_t format, int sessionId) { if (!isValidPcmTrackFormat(format)) { ALOGE("AudioMixer::getTrackName invalid format (%#x)", format); return -1; } uint32_t names = (~mTrackNames) & mConfiguredNames; if (names != 0) { int n = __builtin_ctz(names); Loading Loading @@ -193,7 +198,7 @@ int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId) t->auxBuffer = NULL; t->downmixerBufferProvider = NULL; t->mMixerFormat = AUDIO_FORMAT_PCM_16_BIT; t->mFormat = format; status_t status = initTrackDownmix(&mState.tracks[n], n, channelMask); if (status != OK) { ALOGE("AudioMixer::getTrackName invalid channelMask (%#x)", channelMask); Loading services/audioflinger/AudioMixer.h +10 −4 Original line number Diff line number Diff line Loading @@ -104,7 +104,10 @@ public: // For all APIs with "name": TRACK0 <= name < TRACK0 + MAX_NUM_TRACKS // Allocate a track name. Returns new track name if successful, -1 on failure. int getTrackName(audio_channel_mask_t channelMask, int sessionId); // The failure could be because of an invalid channelMask or format, or that // the track capacity of the mixer is exceeded. int getTrackName(audio_channel_mask_t channelMask, audio_format_t format, int sessionId); // Free an allocated track by name void deleteTrackName(int name); Loading @@ -122,6 +125,10 @@ public: size_t getUnreleasedFrames(int name) const; static inline bool isValidPcmTrackFormat(audio_format_t format) { return format == AUDIO_FORMAT_PCM_16_BIT; } private: enum { Loading Loading @@ -198,9 +205,8 @@ private: int32_t sessionId; audio_format_t mMixerFormat; // at this time: AUDIO_FORMAT_PCM_(FLOAT|16_BIT) int32_t padding[1]; audio_format_t mMixerFormat; // output mix format: AUDIO_FORMAT_PCM_(FLOAT|16_BIT) audio_format_t mFormat; // input track format // 16-byte boundary Loading services/audioflinger/FastMixer.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -223,7 +223,8 @@ void FastMixer::onStateChange() AudioBufferProvider *bufferProvider = fastTrack->mBufferProvider; ALOG_ASSERT(bufferProvider != NULL && fastTrackNames[i] == -1); if (mixer != NULL) { name = mixer->getTrackName(fastTrack->mChannelMask, AUDIO_SESSION_OUTPUT_MIX); name = mixer->getTrackName(fastTrack->mChannelMask, fastTrack->mFormat, AUDIO_SESSION_OUTPUT_MIX); ALOG_ASSERT(name >= 0); fastTrackNames[i] = name; mixer->setBufferProvider(name, bufferProvider); Loading services/audioflinger/FastMixerState.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ namespace android { FastTrack::FastTrack() : mBufferProvider(NULL), mVolumeProvider(NULL), mChannelMask(AUDIO_CHANNEL_OUT_STEREO), mGeneration(0) mChannelMask(AUDIO_CHANNEL_OUT_STEREO), mFormat(AUDIO_FORMAT_INVALID), mGeneration(0) { } Loading services/audioflinger/FastMixerState.h +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ struct FastTrack { ExtendedAudioBufferProvider* mBufferProvider; // must be NULL if inactive, or non-NULL if active VolumeProvider* mVolumeProvider; // optional; if NULL then full-scale audio_channel_mask_t mChannelMask; // AUDIO_CHANNEL_OUT_MONO or AUDIO_CHANNEL_OUT_STEREO audio_format_t mFormat; // track format int mGeneration; // increment when any field is assigned }; Loading Loading
services/audioflinger/AudioMixer.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -153,8 +153,13 @@ void AudioMixer::setLog(NBLog::Writer *log) mState.mLog = log; } int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId) int AudioMixer::getTrackName(audio_channel_mask_t channelMask, audio_format_t format, int sessionId) { if (!isValidPcmTrackFormat(format)) { ALOGE("AudioMixer::getTrackName invalid format (%#x)", format); return -1; } uint32_t names = (~mTrackNames) & mConfiguredNames; if (names != 0) { int n = __builtin_ctz(names); Loading Loading @@ -193,7 +198,7 @@ int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId) t->auxBuffer = NULL; t->downmixerBufferProvider = NULL; t->mMixerFormat = AUDIO_FORMAT_PCM_16_BIT; t->mFormat = format; status_t status = initTrackDownmix(&mState.tracks[n], n, channelMask); if (status != OK) { ALOGE("AudioMixer::getTrackName invalid channelMask (%#x)", channelMask); Loading
services/audioflinger/AudioMixer.h +10 −4 Original line number Diff line number Diff line Loading @@ -104,7 +104,10 @@ public: // For all APIs with "name": TRACK0 <= name < TRACK0 + MAX_NUM_TRACKS // Allocate a track name. Returns new track name if successful, -1 on failure. int getTrackName(audio_channel_mask_t channelMask, int sessionId); // The failure could be because of an invalid channelMask or format, or that // the track capacity of the mixer is exceeded. int getTrackName(audio_channel_mask_t channelMask, audio_format_t format, int sessionId); // Free an allocated track by name void deleteTrackName(int name); Loading @@ -122,6 +125,10 @@ public: size_t getUnreleasedFrames(int name) const; static inline bool isValidPcmTrackFormat(audio_format_t format) { return format == AUDIO_FORMAT_PCM_16_BIT; } private: enum { Loading Loading @@ -198,9 +205,8 @@ private: int32_t sessionId; audio_format_t mMixerFormat; // at this time: AUDIO_FORMAT_PCM_(FLOAT|16_BIT) int32_t padding[1]; audio_format_t mMixerFormat; // output mix format: AUDIO_FORMAT_PCM_(FLOAT|16_BIT) audio_format_t mFormat; // input track format // 16-byte boundary Loading
services/audioflinger/FastMixer.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -223,7 +223,8 @@ void FastMixer::onStateChange() AudioBufferProvider *bufferProvider = fastTrack->mBufferProvider; ALOG_ASSERT(bufferProvider != NULL && fastTrackNames[i] == -1); if (mixer != NULL) { name = mixer->getTrackName(fastTrack->mChannelMask, AUDIO_SESSION_OUTPUT_MIX); name = mixer->getTrackName(fastTrack->mChannelMask, fastTrack->mFormat, AUDIO_SESSION_OUTPUT_MIX); ALOG_ASSERT(name >= 0); fastTrackNames[i] = name; mixer->setBufferProvider(name, bufferProvider); Loading
services/audioflinger/FastMixerState.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ namespace android { FastTrack::FastTrack() : mBufferProvider(NULL), mVolumeProvider(NULL), mChannelMask(AUDIO_CHANNEL_OUT_STEREO), mGeneration(0) mChannelMask(AUDIO_CHANNEL_OUT_STEREO), mFormat(AUDIO_FORMAT_INVALID), mGeneration(0) { } Loading
services/audioflinger/FastMixerState.h +1 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ struct FastTrack { ExtendedAudioBufferProvider* mBufferProvider; // must be NULL if inactive, or non-NULL if active VolumeProvider* mVolumeProvider; // optional; if NULL then full-scale audio_channel_mask_t mChannelMask; // AUDIO_CHANNEL_OUT_MONO or AUDIO_CHANNEL_OUT_STEREO audio_format_t mFormat; // track format int mGeneration; // increment when any field is assigned }; Loading