diff options
author | Steve Kondik <steve@cyngn.com> | 2016-03-07 03:43:14 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2016-03-08 17:34:54 -0800 |
commit | 47f8c7303c9e2054f1492b02b6c7472385c52dc9 (patch) | |
tree | 99179985590f64d6c01051365deaa59552d1d582 /services/audiopolicy/service/AudioPolicyService.h | |
parent | 0479d7c79a7fd6f112e8dc7e45c009cf6602dbaa (diff) | |
download | frameworks_av-47f8c7303c9e2054f1492b02b6c7472385c52dc9.zip frameworks_av-47f8c7303c9e2054f1492b02b6c7472385c52dc9.tar.gz frameworks_av-47f8c7303c9e2054f1492b02b6c7472385c52dc9.tar.bz2 |
audiopolicy: Defer release of output session effects
* Some effects modules are racy and don't tolerate being destroyed
and immediately resurrected on the same session. This is
the common case when switching tracks, and the use of default
output effects makes the problem even worse. Certain apps
which handle gapless in a sloppy way are also to blame.
* Instead of immediately nuking the entire descriptor with the
stream, just decrease the refcount and defer it for 10 seconds.
If it needs resurrected, the refcount will be increased and
the delayed release command will not shoot it in the face.
Change-Id: I068dd72c4180023a74eb9ccbe8a180f6f0683dbf
Diffstat (limited to 'services/audiopolicy/service/AudioPolicyService.h')
-rw-r--r-- | services/audiopolicy/service/AudioPolicyService.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/services/audiopolicy/service/AudioPolicyService.h b/services/audiopolicy/service/AudioPolicyService.h index 27a62f4..9b17a26 100644 --- a/services/audiopolicy/service/AudioPolicyService.h +++ b/services/audiopolicy/service/AudioPolicyService.h @@ -235,6 +235,10 @@ public: audio_unique_id_t sessionId, bool added); void doOnOutputSessionEffectsUpdate(audio_stream_type_t stream, audio_unique_id_t sessionId, bool added); + void releaseOutputSessionEffectsDelayed(audio_io_handle_t output, + audio_stream_type_t stream, + audio_unique_id_t sessionId, + int delayMs); private: AudioPolicyService() ANDROID_API; @@ -268,7 +272,8 @@ private: UPDATE_AUDIOPATCH_LIST, SET_AUDIOPORT_CONFIG, DYN_POLICY_MIX_STATE_UPDATE, - EFFECT_SESSION_UPDATE + EFFECT_SESSION_UPDATE, + RELEASE_OUTPUT_SESSION_EFFECTS, }; AudioCommandThread (String8 name, const wp<AudioPolicyService>& service); @@ -313,6 +318,10 @@ private: void insertCommand_l(AudioCommand *command, int delayMs = 0); void effectSessionUpdateCommand(audio_stream_type_t stream, audio_unique_id_t sessionId, bool added); + void releaseOutputSessionEffectsCommand(audio_io_handle_t output, + audio_stream_type_t stream, + audio_unique_id_t sessionId, + int delayMs = 0); private: class AudioCommandData; @@ -416,6 +425,13 @@ private: bool mAdded; }; + class ReleaseOutputSessionEffectsData : public AudioCommandData { + public: + audio_io_handle_t mOutput; + audio_stream_type_t mStream; + audio_unique_id_t mSessionId; + }; + Mutex mLock; Condition mWaitWorkCV; Vector < sp<AudioCommand> > mAudioCommands; // list of pending commands |