audioflinger: fix auxiliary effect attachment
Auxiliary effects (Reverb) are global effects and as such follow
the default rule which is to attach them to the output thread that
handles music streams by default. This causes a problem when several
threads are eligible to handle music streams as tracks can be attached
to either thread based on criteria unknown when teh effect is created.
The fix consists in moving the auxiliary effect if necessary when an
AudioTrack is attached to it and this track is not on the same
output thread.
Bug 6608561.
Change-Id: Ib32c3cabc731b2046aba728be1771982999c6069
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 384306c..cfd718f 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -253,6 +253,7 @@
int listenerSession,
sync_event_callback_t callBack,
void *cookie);
+
private:
audio_mode_t getMode() const { return mMode; }
@@ -543,6 +544,7 @@
// set audio mode to all effect chains
void setMode(audio_mode_t mode);
// get effect module with corresponding ID on specified audio session
+ sp<AudioFlinger::EffectModule> getEffect(int sessionId, int effectId);
sp<AudioFlinger::EffectModule> getEffect_l(int sessionId, int effectId);
// add and effect module. Also creates the effect chain is none exists for
// the effects audio session
@@ -1287,6 +1289,8 @@
PlaybackThread *primaryPlaybackThread_l() const;
uint32_t primaryOutputDevice_l() const;
+ sp<PlaybackThread> getEffectThread_l(int sessionId, int EffectId);
+
// server side of the client's IAudioTrack
class TrackHandle : public android::BnAudioTrack {
public: