summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy/AudioPolicyService.cpp
Commit message (Collapse)AuthorAgeFilesLines
* am bf2751a5: am 7ccc6b9b: Merge "fix audio patch leak." into lmp-mr1-devEric Laurent2015-01-201-2/+4
|\ | | | | | | | | * commit 'bf2751a5ea6a306c2ba51a0658ec10aa889a81fa': fix audio patch leak.
| * fix audio patch leak.Eric Laurent2015-01-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | Always wait for status when executing a create audio patch command in audio policy service command thread. The returned patch handle must be passed back to audio policy manager so that the patch can be modified later. Failing to do so causes a leak of patch descriptors in audio flinger. Bug: 19032387. Change-Id: I5462d1437fac244d9c5e38f2c7b8e1a4c01d2b75
* | am bf14c62e: am 72bf901c: Merge "audio policy: new getOutputForAttr() ↵Eric Laurent2014-11-261-3/+7
|\ \ | |/ | | | | | | | | | | prototype." into lmp-mr1-dev * commit 'bf14c62e7973ed793a3b00c2c67beca4484c1c7a': audio policy: new getOutputForAttr() prototype.
| * audio policy: new getOutputForAttr() prototype.Eric Laurent2014-11-251-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update getOutputForAttr() prototype and group all logic dealing with audio attributes to stream type conversion in audio policy manager. getOutputForAttr(): - specifies the audio session (for future use) - returns a status code - receives either stream type (for legacy) or audio attributes - returns an updated streamtype Remove logic dealing with legacy stream types to attributes conversion from AudioTrack. Use correct type for audio sessions in other APIs (startOutput() ...). releaseOutput() specifies the audio session (for future use). Bug: 18067208. Change-Id: I1bfbe9626c04c7955d77f8a70aecfad2cb204817
* | am 568689b1: am 3a2a32b5: Merge "AudioSystem: fix cross deadlock" into ↵Eric Laurent2014-11-211-7/+10
|\ \ | |/ | | | | | | | | | | lmp-mr1-dev * commit '568689b169d8b0ae2cc252b88602db5e5acaa604': AudioSystem: fix cross deadlock
| * AudioSystem: fix cross deadlockEric Laurent2014-11-201-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not hold gLockAPS when calling AudioPolicyService::registerClient() in get_audio_policy_service(). registerClient() will need to acquire the AudioPolicyService mutex and if at the same time a method called from AudioPolicyService (with mutex held) calls back into AudioSystem and get_audio_policy_service() a cross deadlock occurs. Same preventive fix for get_audio_flinger(). Use a separate mutex for notification client list in AudioPolicyService. This prevents deadlocking if registerClient() is called as a consequence of AudioFlinger calling back into AudioPolicyManager while executing a method with AudioPolicyService locked Bug: 18403952. Bug: 18450065. Change-Id: Ia832e41aede8bc6c843fc615508fbdd74e0863b5
* | Update calls to IInterface::asBinder()Marco Nelissen2014-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | to use the new static version. Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a Conflicts: media/libmedia/IAudioFlinger.cpp media/libmedia/IMediaPlayer.cpp media/libstagefright/CameraSource.cpp
* | Include AudioPolicyInterface.h only when needed.Chih-Hung Hsieh2014-11-141-0/+1
|/ | | | | | | | | | Both legacy and non-legacy AudioPolicyInterface define extern "C" functions createAudioPloicyManager and destroyAudioPloicyManager. Standard C++ does not allow overloading of extern C functions. g++ did not catch this problem but clang++ does. Change-Id: I80869cdb26e7721777e53d4eff71c5c733044abf
* audio policy: Fix for voice call audio lossHaynes Mathew George2014-10-151-0/+20
| | | | | | | | | | | | | | Audio Policy service filters out one of the create patch commands when it finds two pending commands with the same patch handles. Due to this routing command is not received to audio HAL and the voice call set up fails. Fix this by filtering create patch commands only when they are issued on the same output. authored-by: Karthik Reddy Katta <a_katta@codeaurora.org> Bug: 17787282 Change-Id: If36f0ab71e9b72d6a8eb61d31f762bc5e1683b89
* audio policy: move intializations to onFirstRef()Eric Laurent2014-10-101-0/+4
| | | | | | Bug: 17896324. Change-Id: I3bb74f5397142ac354bd815eb362e5ddacdcb463
* audio policy: fix lockup during mediaserver restartEric Laurent2014-10-071-35/+40
| | | | | | | | | | | | | | | When pre or post processing effects are applied by audio policy service automatically there is a potential lockup if the first call into AudioPolicyService is made while creating one of those effects. This is because effects are created with AudioPolicyService mutex held and effect creation calls into methods (e.g registerClient()) which also acquire the mutex. The fix consists in adding a new mutex to AudioPolicyEffects class and not hold the AudioPolicyService mutex when calling methods in of class. Bug: 17830596. Change-Id: Ie61c3671d3147f46e99ba208f39c1a3bf180779f
* audio: fix stream type for accessibility usageEric Laurent2014-09-251-1/+1
| | | | | | | | | Make sure that accessibility prompts are heard when a ringtone is active by forcing stream type to AUDIO_STREAM_RING when phone state is AUDIO_MODE_RINGTONE. Bug: 17558149. Change-Id: Ia3bead8052fca5cbf282c267f7b9b06014fef628
* audio policy service: filter out delayed audio patch commands if needed.Eric Laurent2014-09-051-1/+35
| | | | | | | | | | As for set parameters commands, create or release audio patch commands modifying the same patch handle should be filtered by the audio policy service command thread so that an immediate command is not overridden by a pending delayed command. Bug: 17379728. Change-Id: I6aa4652b4bfec59eebd3c3cb7d1d9ac1bc1d6e49
* -Making sure mAudioCommands list is empty before going to sleep.Ricardo Garcia2014-07-241-5/+7
| | | | | | -Wake_lock release before sleeping or quitting threadLoop(). Change-Id: Icab53d7984a3ba3eaf13e514667b4d60f40cbcd6
* Remove execute bitGlenn Kasten2014-07-211-0/+0
| | | | Change-Id: I1cf0c0d9375779b3074af12f4cbf9c1ec07bf4ff
* audio policy: add rules to select audio parametersEric Laurent2014-07-111-2/+2
| | | | | | | | | | Added rules to select most appropriate sampling rate, format and channel mask from an input or output profile. Moved mFlags from IOProfile to its base class AudioPort. Removed bogus mChannelMask member in DeviceDescriptor class. Improveed dump of dynamic parameters in AudioPort. Change-Id: Ic09d320386002a8bafee4a28db00b1001a386678
* frameworks: av: services: audiopolicy: Added AudioPolicyEffectsbryant_liu2014-07-011-326/+3
| | | | | | Manage pre- and postprocessing effects defined in audio_effects.conf Change-Id: Idea1478e3d434f8ff66907adb3c77663db78d583
* Merge "audio policy: use factory to create audio policy manager"Eric Laurent2014-06-101-2/+2
|\
| * audio policy: use factory to create audio policy managerEric Laurent2014-06-101-2/+2
| | | | | | | | | | | | | | | | Use the class factory to create the audio policy mamager instead of AudioPolicyManager class constructor and use a pointer to an AudioPolicyInterface. Change-Id: Ibb5a8eee5d597db67cf13f279c909181cfee9949
* | audio policy service: fix potential deadlock in destructorEric Laurent2014-06-081-8/+16
|/ | | | | | | | | | | | | In the AudioCommandThread loop, release mLock before releasing the strong reference on the service as AudioPolicyService destructor calls AudioCommandThread::exit() which acquires mLock. Also check exiPending in thread loop before processing pending commands or sleeping. Bug: 15449050. Change-Id: I148bf21bd67ef721b5b5ee2c1a6afb185c59daa3
* audio policy: add audio port gain controlEric Laurent2014-05-301-0/+29
| | | | | | | | | | Implement setAudioPortConfig() API to configure an audio port. Currently limited to gain control. Bug: 14815883. Change-Id: Ic1b268e5ba5c277e9f5b8fa63c81dd7c0b250024
* audio policy: add routing update client interfaceEric Laurent2014-05-291-1/+132
| | | | | | | | | | | | | Added IAudioPolicyServiceClient client binder interface for client process to receive notifications from AudioPolicyService when audio ports are added/removed or audio patches created/released. The audio patches owned by a given client are automatically released when this client binder dies. Bug: 14815883. Change-Id: I6013f6aec03b50565cffb1ad2cd1f0f8852032c5
* DO NOT MERGE - audioflinger: first patch panel implementation.Eric Laurent2014-05-281-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | Added a new PatchPanel subclass to AudioFlinger to handle audio ports and audio patches configuration and connection. The first implementation does not add new functionnality. AudioPolicyManager uses patch panel interface to control device routing. AudioFlinger: - Added PatchPanel class. The first implementation does not add new functionnality. PatchPanel handles routing commands for audio HAL after 3.0 or converts to setParameters for audio HALs before 3.0. - Added config events to ThreadBase to control synchronized audio patch connection. AudioPolicyManager: - Use PatchPanel API to control device selection isntead of setParameters. - New base class AudioPort common to audio device descriptors and input output stream profiles. This class is RefBase and groups attributes common to audio ports. - Use same device selection flow for input as for outputs: getNewInputDevice -> getDeviceForInptusiource -> setInputDevice Change-Id: Idaa5a883b19a45816651c58cac697640dc717cd9
* audiopolicy: refactor audio command threadsEric Laurent2014-05-121-110/+74
| | | | | | | | | | | - Use strong pointers for command data to avoid transfering ownership of the object to receiver thread. This avoids waiting for the command acknowlegement to proceed with next command on server side. - Use a separate mutex for each command condition. - Factor in duplicated code to send commands. Change-Id: Ib0526e7c4fa64a71ad4015f477c6361727c6f40a
* audio policy: cleanup AudioPolicyService destructorEric Laurent2014-05-071-3/+1
| | | | | | | No need to clear strong pointers in the destuctor. Add explicit exit() command to mOutputCommandThread. Change-Id: I60bb248fe6a20bfd8a55358ef139692b93df0238
* am 71171988: am f655acf1: am 8fb04d47: Merge "Fix memory leak when filtering ↵Eric Laurent2014-05-061-3/+11
| | | | | | | commands in insertCommand_l()" * commit '711719885d7563068579abf347c366cf6bc906f5': Fix memory leak when filtering commands in insertCommand_l()
* Merge "audio policy: add option to use new policy manager"Eric Laurent2014-03-211-3/+27
|\
| * audio policy: add option to use new policy managerEric Laurent2014-03-181-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add build option USE_LEGACY_AUDIO_POLICY to use either new audio policy manager in local AudioPolicyManager.cpp or the legacy AudioPolicyManagerBase.cpp via the policy HAL. New features will be implemented only by the new audio policy manager. Platform customiization will be by config file or new policy HAL. AudioPolicyClientImplLegacy.cpp copied from AudioPolicyClientImpl.cpp AudioPolicyInterfaceImplLegacy.cpp copied from AudioPolicyInterfaceImpl.cpp New implementations of AudioPolicyInterface and AudioPolicyClient talking directly to AudioPolicyManager. Change-Id: I7a320883a1de13de2c9295343e996addf2f3c154
* | am 0c282de7: am 77658a06: Merge "AudioPolicyService: malloc/delete pair"Glenn Kasten2014-03-181-1/+1
|/ | | | | * commit '0c282de73240b1efce64558ab2fa0a8be1f4292b': AudioPolicyService: malloc/delete pair
* audio policy: split implementationEric Laurent2014-03-111-640/+30
| | | | | | | | | | | | | | | Split audio policy service implementation to ease further evolution: AudioPolicyInterfaceImpl.cpp contains the implementation of IAudioPolicyService interface AudioPolicyClientImpl.cpp contains the implementation of the AudioPolicyManager client interface AudioPolicyService.cpp contains the rest of the code mostly command threads implementation and pre processing management. AudioPolicyService.cpp: Change-Id: Ic48ba165532ef66e84a30894d01f750ed6619d02
* move audio policy service to a separate libraryEric Laurent2014-03-111-0/+1695
Change-Id: Ibc3ef07aa9860b7fd4f9aaff27b0dbe0dcbf1cbf