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 --- include/media/AudioSystem.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'include/media/AudioSystem.h') diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 35b06ba..be1d114 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -32,7 +32,9 @@ namespace android { typedef void (*audio_error_callback)(status_t err); typedef void (*dynamic_policy_callback)(int event, String8 regId, int val); typedef void (*effect_session_callback)(int event, - audio_stream_type_t stream, audio_unique_id_t sessionId, bool added); + audio_stream_type_t stream, audio_unique_id_t sessionId, + audio_output_flags_t flags, audio_channel_mask_t channelMask, + uid_t uid, bool added); class IAudioFlinger; class IAudioPolicyService; @@ -423,8 +425,10 @@ private: virtual void onAudioPatchListUpdate(); virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state); virtual void onOutputSessionEffectsUpdate(audio_stream_type_t stream, - audio_unique_id_t sessionId, - bool added); + audio_session_t sessionId, + audio_output_flags_t flags, + audio_channel_mask_t channelMask, + uid_t uid, bool added); private: Mutex mLock; -- 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 --- include/media/AudioSystem.h | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'include/media/AudioSystem.h') diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index be1d114..26a0bb2 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -31,10 +31,6 @@ namespace android { typedef void (*audio_error_callback)(status_t err); typedef void (*dynamic_policy_callback)(int event, String8 regId, int val); -typedef void (*effect_session_callback)(int event, - audio_stream_type_t stream, audio_unique_id_t sessionId, - audio_output_flags_t flags, audio_channel_mask_t channelMask, - uid_t uid, bool added); class IAudioFlinger; class IAudioPolicyService; @@ -96,7 +92,6 @@ public: static void setErrorCallback(audio_error_callback cb); static void setDynPolicyCallback(dynamic_policy_callback cb); - static status_t setEffectSessionCallback(effect_session_callback cb); // helper function to obtain AudioFlinger service handle static const sp get_audio_flinger(); @@ -424,11 +419,6 @@ private: virtual void onAudioPortListUpdate(); virtual void onAudioPatchListUpdate(); virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state); - virtual void onOutputSessionEffectsUpdate(audio_stream_type_t stream, - audio_session_t sessionId, - audio_output_flags_t flags, - audio_channel_mask_t channelMask, - uid_t uid, bool added); private: Mutex mLock; @@ -448,7 +438,6 @@ private: static sp gAudioFlinger; static audio_error_callback gAudioErrorCallback; static dynamic_policy_callback gDynPolicyCallback; - static effect_session_callback gEffectSessionCallback; static size_t gInBuffSize; // previous parameters for recording buffer size queries -- 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 --- include/media/AudioSystem.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/media/AudioSystem.h') diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 26a0bb2..3f4a610 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -31,6 +31,8 @@ namespace android { typedef void (*audio_error_callback)(status_t err); typedef void (*dynamic_policy_callback)(int event, String8 regId, int val); +typedef void (*audio_session_callback)(int event, + sp& session, bool added); class IAudioFlinger; class IAudioPolicyService; @@ -92,6 +94,7 @@ public: static void setErrorCallback(audio_error_callback cb); static void setDynPolicyCallback(dynamic_policy_callback cb); + static status_t setAudioSessionCallback(audio_session_callback cb); // helper function to obtain AudioFlinger service handle static const sp get_audio_flinger(); @@ -319,6 +322,8 @@ public: audio_io_handle_t *handle); static status_t stopAudioSource(audio_io_handle_t handle); + static status_t listAudioSessions(audio_stream_type_t streams, + Vector< sp> &sessions); // ---------------------------------------------------------------------------- @@ -419,6 +424,7 @@ private: virtual void onAudioPortListUpdate(); virtual void onAudioPatchListUpdate(); virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state); + virtual void onOutputSessionEffectsUpdate(sp& info, bool added); private: Mutex mLock; @@ -438,6 +444,7 @@ private: static sp gAudioFlinger; static audio_error_callback gAudioErrorCallback; static dynamic_policy_callback gDynPolicyCallback; + static audio_session_callback gAudioSessionCallback; static size_t gInBuffSize; // previous parameters for recording buffer size queries -- cgit v1.1