From a4123803d0a0e9e0c69faa4207d357cc74a65d58 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Wed, 6 Apr 2016 18:35:02 -0700 Subject: audiopolicy: Be a little smarter with auto-attach * The edge cases, ZOMG! * Instead of relying on effects to be automatically attached, let's just always notify userspace and send a bit more information. This lets the application decide if effects should be attached rather than relying on a hard-coded configuration file. * Perform the setup in getOutputForAttr, but do it on the command thread so we don't block the client. OPO-593 Change-Id: I3900b349f2e895d51fa3a3dcc2de0c4bdf6dbc08 --- services/audiopolicy/service/AudioPolicyEffects.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'services/audiopolicy/service/AudioPolicyEffects.h') diff --git a/services/audiopolicy/service/AudioPolicyEffects.h b/services/audiopolicy/service/AudioPolicyEffects.h index 7988515..6364e40 100644 --- a/services/audiopolicy/service/AudioPolicyEffects.h +++ b/services/audiopolicy/service/AudioPolicyEffects.h @@ -91,6 +91,11 @@ public: audio_stream_type_t stream, int audioSession); + status_t doAddOutputSessionEffects(audio_io_handle_t output, + audio_stream_type_t stream, + int audioSession, + audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE, + audio_channel_mask_t channelMask = 0, uid_t uid = 0); private: -- cgit v1.1 From 32ef0556ae58ff6b7c6fe6fb0a17d3ff7f01de31 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Tue, 19 Apr 2016 02:41:45 -0700 Subject: audiopolicy: Clean up the mess * Since we're not using the policy directly to auto-attach, let's clean it up and remove the unused stuff. * Also fixes notifications for session release. This reverts commit 47f8c7303c9e2054f1492b02b6c7472385c52dc9. Change-Id: Ibe65f427773c6ef012dde4f289d10e4089c094ea --- services/audiopolicy/service/AudioPolicyEffects.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'services/audiopolicy/service/AudioPolicyEffects.h') diff --git a/services/audiopolicy/service/AudioPolicyEffects.h b/services/audiopolicy/service/AudioPolicyEffects.h index 6364e40..1c251e0 100644 --- a/services/audiopolicy/service/AudioPolicyEffects.h +++ b/services/audiopolicy/service/AudioPolicyEffects.h @@ -86,11 +86,6 @@ public: audio_stream_type_t stream, int audioSession); - // For deferred release - status_t doReleaseOutputSessionEffects(audio_io_handle_t output, - audio_stream_type_t stream, - int audioSession); - status_t doAddOutputSessionEffects(audio_io_handle_t output, audio_stream_type_t stream, int audioSession, -- cgit v1.1 From 244deea89aaf3c5dfa8bd369a845276ae501cb5a Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Fri, 22 Apr 2016 18:26:43 -0700 Subject: audiopolicy: Revert all session callback patches. * This has been rearchitected in a better way, as this feature turns out to be more difficult than it seems. * Reverting all of this stuff and rolling it into a single commit. This reverts commit c27a16c33c78a36482336a16199b1b8be794cea4. This reverts commit 32ef0556ae58ff6b7c6fe6fb0a17d3ff7f01de31. This reverts commit 489c9fb62f02e1d23d6d6c89b22f7d19c596e65e. This reverts commit a4123803d0a0e9e0c69faa4207d357cc74a65d58. This reverts commit e13b58b988ab642d4ae5ca6d0a89013510714956. This reverts commit 47f8c7303c9e2054f1492b02b6c7472385c52dc9. This reverts commit 0479d7c79a7fd6f112e8dc7e45c009cf6602dbaa. Change-Id: Iaed9f198d806aa414c95960713e8187c98db248b --- services/audiopolicy/service/AudioPolicyEffects.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'services/audiopolicy/service/AudioPolicyEffects.h') diff --git a/services/audiopolicy/service/AudioPolicyEffects.h b/services/audiopolicy/service/AudioPolicyEffects.h index 1c251e0..3845050 100644 --- a/services/audiopolicy/service/AudioPolicyEffects.h +++ b/services/audiopolicy/service/AudioPolicyEffects.h @@ -31,8 +31,6 @@ namespace android { -class AudioPolicyService; - // ---------------------------------------------------------------------------- // AudioPolicyEffects class @@ -46,7 +44,7 @@ public: // The constructor will parse audio_effects.conf // First it will look whether vendor specific file exists, // otherwise it will parse the system default file. - AudioPolicyEffects(AudioPolicyService *audioPolicyService); + AudioPolicyEffects(); virtual ~AudioPolicyEffects(); // NOTE: methods on AudioPolicyEffects should never be called with the AudioPolicyService @@ -86,12 +84,6 @@ public: audio_stream_type_t stream, int audioSession); - status_t doAddOutputSessionEffects(audio_io_handle_t output, - audio_stream_type_t stream, - int audioSession, - audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE, - audio_channel_mask_t channelMask = 0, uid_t uid = 0); - private: // class to store the description of an effects and its parameters @@ -200,8 +192,6 @@ private: KeyedVector< audio_stream_type_t, EffectDescVector* > mOutputStreams; // Automatic output effects are unique for audiosession ID KeyedVector< int32_t, EffectVector* > mOutputSessions; - - AudioPolicyService *mAudioPolicyService; }; }; // namespace android -- cgit v1.1 From 3f9eb321481de3e118632a594bf1b0c9001c281c Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Fri, 22 Apr 2016 18:32:39 -0700 Subject: audiopolicy: Add AudioSessionInfo API * This patch introduces a new API which allows applications to query the state of the audio effects system, and receive callbacks with the necessary information to attach effects to any stream. * In the future, this may come as part of the AudioPort system, but since that's an active area of development by Google, we will dodge it for now. * The policy now simply keeps a refcounted list of objects which hold various bits of stream metadata. Callbacks are sent on stream open/close to applications which might be listening for them. Change-Id: I2d554d36e1378f4eb7b276010a3bfe8345c22ecd --- services/audiopolicy/service/AudioPolicyEffects.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'services/audiopolicy/service/AudioPolicyEffects.h') diff --git a/services/audiopolicy/service/AudioPolicyEffects.h b/services/audiopolicy/service/AudioPolicyEffects.h index 3845050..a95d49f 100644 --- a/services/audiopolicy/service/AudioPolicyEffects.h +++ b/services/audiopolicy/service/AudioPolicyEffects.h @@ -31,6 +31,8 @@ namespace android { +class AudioPolicyService; + // ---------------------------------------------------------------------------- // AudioPolicyEffects class @@ -44,7 +46,7 @@ public: // The constructor will parse audio_effects.conf // First it will look whether vendor specific file exists, // otherwise it will parse the system default file. - AudioPolicyEffects(); + AudioPolicyEffects(AudioPolicyService *audioPolicyService); virtual ~AudioPolicyEffects(); // NOTE: methods on AudioPolicyEffects should never be called with the AudioPolicyService @@ -84,6 +86,19 @@ public: audio_stream_type_t stream, int audioSession); + status_t updateOutputAudioSessionInfo(audio_io_handle_t output, + audio_stream_type_t stream, + int audioSession, + audio_output_flags_t flags, + audio_channel_mask_t channelMask, uid_t uid); + + status_t releaseOutputAudioSessionInfo(audio_io_handle_t output, + audio_stream_type_t stream, + int audioSession); + + status_t listAudioSessions(audio_stream_type_t streams, + Vector< sp> &sessions); + private: // class to store the description of an effects and its parameters @@ -192,6 +207,10 @@ private: KeyedVector< audio_stream_type_t, EffectDescVector* > mOutputStreams; // Automatic output effects are unique for audiosession ID KeyedVector< int32_t, EffectVector* > mOutputSessions; + // Stream info for session events + KeyedVector< int32_t, sp > mOutputAudioSessionInfo; + + AudioPolicyService *mAudioPolicyService; }; }; // namespace android -- cgit v1.1