summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Effects.cpp
Commit message (Collapse)AuthorAgeFilesLines
* DO NOT MERGE - audioflinger: fix recursive mutex lock in EffectHandle.Eric Laurent2017-03-221-7/+25
| | | | | | | | | | | | | | | Bug: 33661708 Bug: 32707507 Bug: 32095713 Test: run CTS AudioEffectTest#test5_0Command, Custom binder test CVE-2017-0479 CVE-2017-0480 Change-Id: I03f674f126c191143bd8bdfe236f793e975826a5 (cherry picked from commit 31a4598a1908b3ccac7ddb33c511ce66840aa911) (cherry picked from commit 8415635765380be496da9b4578d8f134a527d86b)
* DO NOT MERGE - improve audio effect framwework thread safetyEric Laurent2017-03-221-86/+138
| | | | | | | | | | | | | | | | | | | | | | - 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>)
* Fix security vulnerability: potential OOB write in audioserverrago2017-03-131-0/+16
| | | | | | | | | Bug: 32705438 Bug: 32703959 Test: cts security test Change-Id: I8900c92fa55b56c4c2c9d721efdbabe6bfc8a4a4 (cherry picked from commit e275907e576601a3579747c3a842790bacf111e2) (cherry picked from commit b0bcddb44d992e74140a3f5eedc7177977ea8e34)
* Effect: Use local cached data for Effect commitAndy Hung2017-03-131-19/+38
| | | | | | | | | Test: POC, Cts Effect, BassBoost, EnvReverb, Equalizer, Test: LoudnessEnhancer, PresetReverb, Virtualizer, Visualizer Bug: 32220769 Change-Id: Iea96ba0daf71691ee8954cca4ba1c10fe827626e (cherry picked from commit dd79ccda92c1e9b982b2d0f8877d98e5258fbb73) (cherry picked from commit a155de4d70e0b9ac8fc02b2bdcbb2e8e6cca46ff)
* Effects: Check get parameter command sizeAndy Hung2017-02-031-0/+7
| | | | | | | | | | Test: Custom test. Bug: 32438594 Bug: 32624850 Bug: 32635664 Change-Id: I9b1315e2c02f11bea395bfdcf5c1ccddccbad8a6 (cherry picked from commit 3d34cc76e315dfa8c3b1edf78835b0dab4980505) (cherry picked from commit 26965db50a617f69bdefca0d7533796c80374f2c)
* Merge tag 'android-6.0.1_r72' into HEADJessica Wagantall2016-10-061-0/+23
|\ | | | | | | | | | | Android 6.0.1 Release 72 (M4B30X) Change-Id: I617426a3fbf7a8d013c5be838ad4c80a00b61a5f
| * Add EFFECT_CMD_SET_PARAM parameter checkingAndy Hung2016-08-261-0/+29
| | | | | | | | | | | | Fix merge conflict to mnc-mr3-release Bug: 30204301 Change-Id: Ib9c3ee1c2f23c96f8f7092dd9e146bc453d7a290
* | Merge tag 'android-6.0.1_r61' into HEADJessica Wagantall2016-08-021-0/+6
|\ \ | | | | | | | | | | | | | | | Android 6.0.1 Release 61 (MOB30Z) Change-Id: Ic86e42d5fb8f81fe5c4f58d2e76852829c609760
| * | Check effect command reply size in AudioFlingerAndy Hung2016-06-231-0/+6
| |/ | | | | | | | | Bug: 29251553 Change-Id: I1bcc1281f1f0542bb645f6358ce31631f2a8ffbf
* | Revert "Audio Effects are not processing first buffer"Gabriele M2016-01-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | This causes a short and loud noise when turning off effects while an audio track is playing or when an audio track is started with audio effects enabled. The noise appears to be non-existent if the volume level is set to its maximum. This reverts commit d15a8bd157cb531716bd3e15561f557e74588801. Change-Id: I2b8dd3447d673b4b98018710bc10c1eeb282598e
* | libaudioflinger: avoid s/w effect processing in case of Direct PCMvivek mehta2015-12-191-3/+7
| | | | | | | | | | | | | | - Check Direct PCM usecase with Offload - do not process s/w effect when direct PCM is enabled Change-Id: I2eb843b17558e60cf36daff0c5fbdf50dccf99ca
* | Audio Effects are not processing first bufferLucas Gomez Jimenez2015-11-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current implementation in AudioFlinger set the effects to state IDLE when they are created. Later on when the effect is enabled by the client, the state changes to STARTING. Then when the audio playback starts, the AudioFlinger thread loop calls EffectChain::process_l() to perform the effects processing. However this method will first call process() and then updateState(), so the firstprocess won't do anything because the effect is in STARTING state. After the call to updateState, the state is moved to ACTIVE and then next calls to process_l() will work as expected. Change-Id: I9dfd3d5a0e53403034eb42f9366e1b3cdc5249c0
* | Direct_PCM: add support for effectsvivek mehta2015-10-061-1/+2
| | | | | | | | | | | | - add support for effects on direct pcm output Change-Id: I2fbac63c623bf51a03e5e91828369739d33329f3
* | audio: init rc to avoid effect's fault statewjiang2015-10-061-6/+6
|/ | | | | | | | Effect command doesn't necessarily fill cmd return code into &cmdStatus, so we should initialize cmdStatus to avoid uninitialized value propagates to upper stack caller. Change-Id: I5694616c9d3d66071241958f54a03b8d3b9d881e
* Fix for audio effects in offload path for mono contentRicardo Garcia2015-05-281-1/+9
| | | | | | | | Effects path is always stereo, and it should be initialized as thus even if the source is mono. Fixed condition check before initialization. bug: 18157592 Change-Id: Idd7241931e4ba6085fd804345128d898c8511e11
* Remove redundant semicolon from namespace closingGlenn Kasten2015-03-031-1/+1
| | | | Change-Id: I163f9d3d216c283ae1160ce4802e5247cf44fba7
* audioflinger: fix pre processing transfer between record threads.Eric Laurent2014-10-021-10/+26
| | | | | | | | | | | | 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-10/+16
| | | | | | | | | | | | | 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-4/+24
| | | | | | | | | | | | | | | | | | | | 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
* Fix to support mono in effect buffer allocation.Ricardo Garcia2014-08-111-1/+4
| | | | | | | | Since effects are now enabled for recording, mono cases are possible and needed to be correctly allocated. Bug: 16917961 Change-Id: I760fc421f9f90fabb3f0deadd5f9dc61cd284371
* MediaServer crashing and audio effects not applied to TTS.Ricardo Garcia2014-08-061-1/+6
| | | | | | | | | A memclear in the EffectChain was out of bounds. Bug 15432115 Bug 16845751 Change-Id: Ib0adc7fa730d630bb71fb87d51163a26149b16e2
* AudioFlinger: add specific mutex for client listsEric Laurent2014-05-131-2/+2
| | | | | | | | | | | | | Add a specific mutex to protect access to mClients and mNotificationClients lists. This avoids locking the main AudioFlinger mutex from inside thread loops and allows not to worry about cross deadlocks when sending a config event with status reply while keeping the ThreadBase or AudioFlinger mutex locked. As a way of consequence, remove notification client list passed to processConfigEvents_l() and audioConfigChanged() as the list can now be accessed by locking client mutex only. Change-Id: I228022204b6709a8bb60cc96d9514a6ffe59b62e
* resolved conflicts for merge of 566be7c3 to masterNarayan Kamath2014-02-111-13/+13
|\ | | | | | | Change-Id: I7b1cc71057b2bd4f771e7bcf508a8c3abd6017ce
| * Make frameworks/av 64-bit compatibleKévin PETIT2014-02-111-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | Contains the necessary changes to make frameworks/av build and work on a 64-bit machine. Signed-off-by: Craig Barber <craig.barber@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com> Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Change-Id: I725feaae50ed8eee25ca2c947cf15aee1f395c43
* | Merge "Fix clang warnings in AudioFlinger"Glenn Kasten2014-02-101-2/+2
|\ \
| * | Fix clang warnings in AudioFlingerGlenn Kasten2014-02-101-2/+2
| | | | | | | | | | | | Change-Id: I0fa61025c979709ad7d655bc717df5f194b6089e
* | | Pretty up audioflinger dumpsysMarco Nelissen2014-02-101-35/+143
|/ / | | | | | | Change-Id: I57e44b4c36b99f7149542bbcf9645521c6152dfa
* | Fix unused parameter warnings in audioGlenn Kasten2014-02-031-1/+1
| | | | | | | | Change-Id: I665ba3358dd9502f0adec70d486e7bf8a2e1b0fe
* | Fix bug in creation of EffectHandle when out of memoryGlenn Kasten2013-11-201-8/+10
| | | | | | | | | | | | | | | | 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
* | am 3424d6e1: am 1adf20ce: Merge "fix volume and effect enable delay on ↵Eric Laurent2013-10-011-5/+17
|\ \ | |/ | | | | | | | | | | offloaded tracks" into klp-dev * commit '3424d6e17637e0743ddf3bf4688af8ee36e69264': fix volume and effect enable delay on offloaded tracks
| * fix volume and effect enable delay on offloaded tracksEric Laurent2013-09-301-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Volume: add a method to wake up the mediaserver playback thread when a volume command is received on an offloaded track. Effects: call effect chain process on offloaded playback threads asynchronously from writes to allow effect state updates while waiting for async write callback. Bug: 10796540. Change-Id: Id2747ae88783575d1d7ffd6fc86fbd054ab2c739
* | am a2340b30: Merge "Don\'t call audio effect process on offloaded playback ↵Jean-Michel Trivi2013-09-301-3/+4
|\ \ | |/ | | | | | | | | | | threads" into klp-dev * commit 'a2340b3059b9d6e4286d0db7069df477c164df0c': Don't call audio effect process on offloaded playback threads
| * Don't call audio effect process on offloaded playback threadsJean-Michel Trivi2013-09-261-3/+4
| | | | | | | | | | | | | | | | | | An audio effect process command is not meant to be called for playback threads belonging to offloaded playback. Bug 10933817 Change-Id: Idc7b6a0224791bbf8d61648474d3c288617c498f
* | am bf5e2397: am 5baf2af5: more support for audio effect offloadEric Laurent2013-09-181-5/+44
|\ \ | |/ | | | | | | * commit 'bf5e23979a03da96ce1d63126c480103232f174b': more support for audio effect offload
| * more support for audio effect offloadEric Laurent2013-09-181-5/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | am 8a910716: am 6ca83fad: Merge "audioflinger: no effects on offloaded ↵Eric Laurent2013-09-091-11/+23
|\ \ | |/ | | | | | | | | | | tracks" into klp-dev * commit '8a910716892d17a2ac62c7e9884af0e9d75b26bc': audioflinger: no effects on offloaded tracks
| * audioflinger: no effects on offloaded tracksEric Laurent2013-09-091-11/+23
| | | | | | | | | | | | | | | | | | | | | | 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
* | Use curly braces in 'if' to make it easier to add logsGlenn Kasten2013-08-131-1/+2
|/ | | | Change-Id: I58b33fefdd8bf703647414157a99a3223be3531c
* AudioFlinger: offload playback, non-blocking writeEric Laurent2013-07-251-19/+26
| | | | | | | | | | | | | | | | | | | | | | | | - 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
* Make AudioFlinger::instantiate() more resilient when called from separate moduleGlenn Kasten2013-07-191-0/+1
| | | | | Bug: 8834855 Change-Id: I4cd842cdfb09d2aaaaab9df9ac3bec6179709bd3
* AudioFlinger: do not cache audio device when 0.Eric Laurent2013-06-061-1/+1
| | | | | | | | | AudioFlinger should not cache the audio device passed to the audio HAL when it is AUDIO_DEVICE_NONE but keep previous valid selection instead. Bug: 9323399. Change-Id: I6f9480e55a21be4115453e6a5eebc5cf2536c476
* audioflinger: add effect config status checkEric Laurent2013-04-021-12/+51
| | | | | | | | | | Check the result of the effect engine configuration command and do not attempt to send parameters to, enable, or process the effect if configuration fails. Bug 8512027 Change-Id: I8c78a05d79fba36b1a387aa5cf2700612301ac91
* AudioFlinger files reorganizationEric Laurent2012-11-191-0/+1684
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