summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Effects.h
Commit message (Collapse)AuthorAgeFilesLines
* DO NOT MERGE - improve audio effect framwework thread safetyEric Laurent2017-03-221-11/+26
| | | | | | | | | | | | | | | | | | | | | | - Reorganize handle effect creation code to make sure the effect engine is created with both thread and effect chain mutex held. - Reorganize handle disconnect code to make sure the effect engine is released with both thread and effect chain mutex held. - Protect IEffect interface methods in EffectHande with a Mutex. - Only pin effect if the session was acquired first. - Do not use strong pointer to EffectModule in EffectHandles: only the EffectChain has a single strong reference to the EffectModule. Bug: 32707507 CVE-2017-0479 CVE-2017-0480 CVE-2017-0499 Change-Id: Ia1098cba2cd32cc2d1c9dfdff4adc2388dfed80e (cherry picked from commit b378b73dd7480b584340b8028802c9ca2d625123) (cherry picked from commit 22e26d8ee73488c58ba3e7928e5da155151abfd0 with backport by <sultanxda@gmail.com>)
* audioflinger: fix pre processing transfer between record threads.Eric Laurent2014-10-021-0/+3
| | | | | | | | | | | | Fix two problems remaining with pre processing effects transfer from one record thread to the next in case of tear down due to device connection: 1 - the enabled state of the effects was not communicated to the new HAL input stream. 2 - the effects saved in orphan chains list were not transfered to the new thread when a AudioRecord was created. Bug: 17757378. Change-Id: I0923c98470db3b51154dc89846157780a4c21e86
* audioflinger: fix failure to indicate volume to effectEric Laurent2014-10-011-0/+7
| | | | | | | | | | | | | If an effect is added and enabled after a track is started it will not receive current volume information because volume is indicated only to active effects and if there is a volume change. Add a flag to force EffectChain::setVolume_l() to pass volume indication to all effects each time an effect is enabled. Bug: 17572556. Change-Id: I6b68488c9aca8b2095fb210aa124d02e4f759660
* audioflinger: fix pre processing effect leakEric Laurent2014-09-151-0/+3
| | | | | | | | | | | | | | | | | | | | When a capture thread was closed, the effects attached to this thread were left dangling and the associated effect chain destroyed. When their last client was disconnected, the effects were not released properly from the effect library because the destruction process could not be completed without the effect being attached to a thread. A similar problem prevented a RecordTrack to be properly released if its client was destroyed after the capture thread. The fix consists in allowing the effect or record track to be properly released even if its parent thread cannot be promoted. Also save any effect chain still present on a closed capture thread in case a new client wants to reuse the effects on the same session later. Bug: 17110064. Change-Id: I5cd644daa357afd1f3548f9bcb28e6152d95fdb8
* Pass stereo gains as packed minifloatGlenn Kasten2014-05-191-0/+1
| | | | | | | | | | This will allow (eventually) a greater dynamic range for gains. However there are still a few remaining places in effects and mixer that will also need to be changed in order to get the full benefit. Also fixes a minor bug: was not checking for NaN in AudioTrack C++. Change-Id: I63bce9e82e0a61546d8ff475fb94bcb700d99c96
* Fix clang warnings in AudioFlingerGlenn Kasten2014-02-101-1/+1
| | | | Change-Id: I0fa61025c979709ad7d655bc717df5f194b6089e
* Fix bug in creation of EffectHandle when out of memoryGlenn Kasten2013-11-201-0/+1
| | | | | | | | If there is insufficient client memory to create the EffectHandle, it was returning a handle which would be useless. Now it correctly reports the out-of-memory error back to client. Change-Id: I894e65d5d17df39383032c1527be6ccd35f578bb
* fix deadlock in audioflinger::createEffect()Eric Laurent2013-09-251-0/+4
| | | | | | | | | | commit 5baf2af5 introduced a regression by calling getOutputForEffect() with AudioFLinger main mutex locked. The locking order must always be AudioPolicyService mutex then AudioFlinger then ThreadBase mutex. Bug: 10916796. Change-Id: Ide34a2d84dbb06dbb35abd0640d91b01b0ac4d40
* more support for audio effect offloadEric Laurent2013-09-181-2/+7
| | | | | | | | | | | | | | | | Offloading of audio effects is now enabled for offloaded output threads. If an effect not supporting offload is enabled, the AudioTrack is invalidated so that it can be recreated in PCM mode. Fix some issues in effect proxy related to handling of effect commands to offloaded and non offloaded effects. Also fixed a bug on capture index in software Visualizer effect. Bug: 8174034. Change-Id: Ib23d3c2d5a652361b0aaec7faee09102f2b18fce
* audioflinger: no effects on offloaded tracksEric Laurent2013-09-091-0/+4
| | | | | | | | | | | Invalidate offloaded tracks when an effect is enabled so that the track is recreated in PCM mode and the effect can be applied. This is temporary until effect offloading is implemented. Bug: 8174034. Change-Id: I77b8b54a10db6cb8334be76d863ea7e720eaad09
* AudioFlinger: offload playback, non-blocking writeEric Laurent2013-07-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | - Added specialized playback thread class for offload playback, derived from directoutput thread. This thread type handles specific state transitions for offloaded tracks and offloading commands (pause/resume/drain/flush..) to audio HAL. As opposed to other threads, does not go to standby if the track is paused. - Added support for asynchronous write and drain operations at audio HAL. Use a thread to handle async callback events from HAL: this avoids locking playback thread mutex when executing the callback and cause deadlocks when calling audio HAL functions with the playback thread mutex locked. - Better accouting for track activity: call start/stop and release Output methods in audio policy manager when tracks are actually added and removed from the active tracks list. Added a command thread in audio policy service to handle stop/release commands asynchronously and avoid deadlocks with playback thread. - Track terminated status is not a state anymore. This condition is othogonal to state to permitted state transitions while terminated. Change-Id: Id157f4b3277620568d8eace7535d9186602564de
* AudioFlinger files reorganizationEric Laurent2012-11-191-0/+359
Audioflinger.cpp and Audioflinger.h files must be split to improve readability and maintainability. This CL splits the files as follows: AudioFlinger.cpp split into: - AudioFlinger.cpp: implementation of IAudioflinger interface and global methods - AFThreads.cpp: implementation of ThreadBase, PlaybackThread, MixerThread, DuplicatingThread, DirectOutputThread and RecordThread. - AFTracks.cpp: implementation of TrackBase, Track, TimedTrack, OutputTrack, RecordTrack, TrackHandle and RecordHandle. - AFEffects.cpp: implementation of EffectModule, EffectChain and EffectHandle. AudioFlinger.h is modified by inline inclusion of header files containing the declaration of complex inner classes: - AFThreads.h: ThreadBase, PlaybackThread, MixerThread, DuplicatingThread, DirectOutputThread and RecordThread - AFEffects.h: EffectModule, EffectChain and EffectHandle AFThreads.h includes the follownig headers inline: - AFTrackBase.h: TrackBase - AFPlaybackTracks: Track, TimedTrack, OutputTrack - AFRecordTracks: RecordTrack Change-Id: I512ebc3a51813ab7a4afccc9a538b18125165c4c