summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2012-09-10 18:58:27 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2012-09-10 18:58:27 -0700
commitfe3156ec6fd9fa57dde913fd8567530d095a6550 (patch)
tree2c4b8250d0089a7d9f396d40005f4fefd95f46f3 /services
parent66765846726c02db16a0f024f2217990a90802c0 (diff)
downloadframeworks_av-fe3156ec6fd9fa57dde913fd8567530d095a6550.zip
frameworks_av-fe3156ec6fd9fa57dde913fd8567530d095a6550.tar.gz
frameworks_av-fe3156ec6fd9fa57dde913fd8567530d095a6550.tar.bz2
Communicate audio session ID to downmixer
The audio downmixer effect might need the audio session Id, pass it from the track creation in AudioFlinger to the downmix effect creation in AudioMixer. Change-Id: I5e29540542ae89cf4a0cdb537b3e67f04442a20a
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp11
-rw-r--r--services/audioflinger/AudioFlinger.h6
-rw-r--r--services/audioflinger/AudioMixer.cpp5
-rw-r--r--services/audioflinger/AudioMixer.h4
-rw-r--r--services/audioflinger/FastMixer.cpp5
5 files changed, 17 insertions, 14 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index a5d4c6c..27e2ed2 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -3383,9 +3383,9 @@ void AudioFlinger::PlaybackThread::invalidateTracks(audio_stream_type_t streamTy
}
// getTrackName_l() must be called with ThreadBase::mLock held
-int AudioFlinger::MixerThread::getTrackName_l(audio_channel_mask_t channelMask)
+int AudioFlinger::MixerThread::getTrackName_l(audio_channel_mask_t channelMask, int sessionId)
{
- return mAudioMixer->getTrackName(channelMask);
+ return mAudioMixer->getTrackName(channelMask, sessionId);
}
// deleteTrackName_l() must be called with ThreadBase::mLock held
@@ -3498,7 +3498,7 @@ bool AudioFlinger::MixerThread::checkForNewParameters_l()
readOutputParameters();
mAudioMixer = new AudioMixer(mNormalFrameCount, mSampleRate);
for (size_t i = 0; i < mTracks.size() ; i++) {
- int name = getTrackName_l(mTracks[i]->mChannelMask);
+ int name = getTrackName_l(mTracks[i]->mChannelMask, mTracks[i]->mSessionId);
if (name < 0) break;
mTracks[i]->mName = name;
// limit track sample rate to 2 x new output sample rate
@@ -3828,7 +3828,8 @@ void AudioFlinger::DirectOutputThread::threadLoop_sleepTime()
}
// getTrackName_l() must be called with ThreadBase::mLock held
-int AudioFlinger::DirectOutputThread::getTrackName_l(audio_channel_mask_t channelMask)
+int AudioFlinger::DirectOutputThread::getTrackName_l(audio_channel_mask_t channelMask,
+ int sessionId)
{
return 0;
}
@@ -4293,7 +4294,7 @@ AudioFlinger::PlaybackThread::Track::Track(
// 16 bit because data is converted to 16 bit before being stored in buffer by AudioTrack
mCblk->frameSize = audio_is_linear_pcm(format) ? mChannelCount * sizeof(int16_t) : sizeof(uint8_t);
// to avoid leaking a track name, do not allocate one unless there is an mCblk
- mName = thread->getTrackName_l(channelMask);
+ mName = thread->getTrackName_l(channelMask, sessionId);
mCblk->mName = mName;
if (mName < 0) {
ALOGE("no more track names available");
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 5ffa5a6..c956861 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -1086,7 +1086,7 @@ public:
// Allocate a track name for a given channel mask.
// Returns name >= 0 if successful, -1 on failure.
- virtual int getTrackName_l(audio_channel_mask_t channelMask) = 0;
+ virtual int getTrackName_l(audio_channel_mask_t channelMask, int sessionId) = 0;
virtual void deleteTrackName_l(int name) = 0;
// Time to sleep between cycles when:
@@ -1202,7 +1202,7 @@ public:
protected:
virtual mixer_state prepareTracks_l(Vector< sp<Track> > *tracksToRemove);
- virtual int getTrackName_l(audio_channel_mask_t channelMask);
+ virtual int getTrackName_l(audio_channel_mask_t channelMask, int sessionId);
virtual void deleteTrackName_l(int name);
virtual uint32_t idleSleepTimeUs() const;
virtual uint32_t suspendSleepTimeUs() const;
@@ -1254,7 +1254,7 @@ public:
virtual bool checkForNewParameters_l();
protected:
- virtual int getTrackName_l(audio_channel_mask_t channelMask);
+ virtual int getTrackName_l(audio_channel_mask_t channelMask, int sessionId);
virtual void deleteTrackName_l(int name);
virtual uint32_t activeSleepTimeUs() const;
virtual uint32_t idleSleepTimeUs() const;
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index a9814a1..ab75dd0 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -163,7 +163,7 @@ AudioMixer::~AudioMixer()
delete [] mState.resampleTemp;
}
-int AudioMixer::getTrackName(audio_channel_mask_t channelMask)
+int AudioMixer::getTrackName(audio_channel_mask_t channelMask, int sessionId)
{
uint32_t names = (~mTrackNames) & mConfiguredNames;
if (names != 0) {
@@ -189,6 +189,7 @@ int AudioMixer::getTrackName(audio_channel_mask_t channelMask)
t->enabled = false;
t->format = 16;
t->channelMask = AUDIO_CHANNEL_OUT_STEREO;
+ t->sessionId = sessionId;
// setBufferProvider(name, AudioBufferProvider *) is required before enable(name)
t->bufferProvider = NULL;
t->downmixerBufferProvider = NULL;
@@ -270,7 +271,7 @@ status_t AudioMixer::prepareTrackForDownmix(track_t* pTrack, int trackName)
}
if (EffectCreate(&dwnmFxDesc.uuid,
- -2 /*sessionId*/, -2 /*ioId*/,// both not relevant here, using random value
+ pTrack->sessionId /*sessionId*/, -2 /*ioId not relevant here, using random value*/,
&pDbp->mDownmixHandle/*pHandle*/) != 0) {
ALOGE("prepareTrackForDownmix(%d) fails: error creating downmixer effect", trackName);
goto noDownmixForActiveTrack;
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index 6e34cd1..6333357 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -91,7 +91,7 @@ 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 getTrackName(audio_channel_mask_t channelMask, int sessionId);
// Free an allocated track by name
void deleteTrackName(int name);
@@ -192,7 +192,7 @@ private:
DownmixerBufferProvider* downmixerBufferProvider; // 4 bytes
- int32_t padding;
+ int32_t sessionId;
// 16-byte boundary
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index cdc27a2..13003d9 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -281,8 +281,9 @@ bool FastMixer::threadLoop()
AudioBufferProvider *bufferProvider = fastTrack->mBufferProvider;
ALOG_ASSERT(bufferProvider != NULL && fastTrackNames[i] == -1);
if (mixer != NULL) {
- // calling getTrackName with default channel mask
- name = mixer->getTrackName(AUDIO_CHANNEL_OUT_STEREO);
+ // calling getTrackName with default channel mask and a random invalid
+ // sessionId (no effects here)
+ name = mixer->getTrackName(AUDIO_CHANNEL_OUT_STEREO, -555);
ALOG_ASSERT(name >= 0);
fastTrackNames[i] = name;
mixer->setBufferProvider(name, bufferProvider);