summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioFlinger.h
Commit message (Collapse)AuthorAgeFilesLines
* DO NOT MERGE - improve audio effect framwework thread safetyEric Laurent2017-03-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | - 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: increase shared memory heap sizeEric Laurent2015-10-141-1/+7
| | | | | | Bug: 21093153. Change-Id: I389af11451b01ce49fdb8957e2f322ba1925a62e (cherry picked from commit da73b6c7474aaa5616f0214e238776f12717f32b)
* Fix capture overruns at non-primary sample rateGlenn Kasten2015-07-221-3/+1
| | | | | | | | | and small buffer size. Also: Pull out the magic number "12 ms" to a named constant. Remove obsolete AudioFlinger::mPrimaryOutputSampleRate. Bug: 22662814 Change-Id: I261f75a222c4505a84aad2493d251bd2dea59f68
* audio: several fixes in audio routing callbacksEric Laurent2015-07-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | - audio policy: Force device change to ensure new audio patch creation upon first track activity on a given output. Fix function device_distinguishes_on_address() which could mistake some output device with remote submix input device. - audio flinger: Reduce number of binder calls upon new client registration by only sending ioConfigChanged() callbacks to newly registered client. Fix first patch after output thread creation not triggering an ioConfigChanged() callback. -audio system: Force client registration upon routing callback installation to force new ioConfigChanged() callback from audio flinger. Bug: 22381136. Change-Id: Ieb0d9f92f563a40552eb31bc0499c8ac65f78ce4
* Merge "audio flinger: do not call JAVA services until system is ready" into ↵Eric Laurent2015-05-211-0/+4
|\ | | | | | | mnc-dev
| * audio flinger: do not call JAVA services until system is readyEric Laurent2015-05-201-0/+4
| | | | | | | | | | | | | | | | Wait for system ready indication form AudioService before enabling calls to scheduling service or power manager. Bug: 11520969. Change-Id: I221927394f4a08fd86c9d457e55dd0e07949f0cf
* | Allow creation of output endpoints with channel index masksAndy Hung2015-05-191-0/+9
|/ | | | | Bug: 21301523 Change-Id: I97e578f3da933f7086e4f431a199ed907f04cbc8
* Merge "AudioRecord keeps track of UID" into mnc-devJean-Michel Trivi2015-05-051-0/+1
|\
| * AudioRecord keeps track of UIDJean-Michel Trivi2015-05-051-0/+1
| | | | | | | | | | | | Bug 20832981 Change-Id: If5f3c61fae02d86b9d6fdf411711f854fd56c77d
* | Merge "AudioSystem: refactor audio config cache and callbacks" into mnc-devEric Laurent2015-05-011-1/+2
|\ \ | |/ |/|
| * AudioSystem: refactor audio config cache and callbacksEric Laurent2015-05-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up implementation of audio configuration cache and callback events from AudioFlinger: - Define class AudioIoDescriptor for audio input and output configurations outside of AudioSystem class. - Do not use void * but an AudioIoDescriptor as argument to audio config callbacks from AudioFlinger. - Remove unused configuration events. - Move AudioSystem audio input and output cache from static singletons to members of AudioFlingerClient subclass. Change-Id: I67c196c32c09ce2756af0755ee1fe631040c3270
* | Merge "PatchPanel: do not use setParameters() internally." into mnc-devEric Laurent2015-05-011-0/+1
|\ \ | |/
| * PatchPanel: do not use setParameters() internally.Eric Laurent2015-04-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not use setParameters() with AUDIO_PARAMETER_STREAM_ROUTING when communicating the input or output device selected to playback or record threads, even for HAL version less than 3.0. Use createAudioPatch()/releaseAudioPatch() instead. This allows to send more information on the output or input device being selected. Also fix a regression introduced in L where the output device selection was not communicated to effects on record threads. Change-Id: I4780ada53241d56694b005c992171e173c3bf8f5
* | Respect the record audio app op - mediaSvet Ganov2015-04-291-0/+2
|/ | | | Change-Id: I3a97977b6e9a09355e2008f780d22d480fb7308b
* Add floating and multichannel record to AudioFlingerAndy Hung2015-04-221-6/+6
| | | | Change-Id: Ia388fb012a0b6d81613ef87142a97d76836338f9
* AudioFlinger: call SPDIF wrapper from AudioFlingerPhil Burk2015-03-241-49/+5
| | | | | | | | | | | | | Create an interface layer between the AudioFlinger and the HAL that manages the wrapping and format conversion. Removed unnecessary includes. Handle rate conversion in getRenderPosition(). Try to open HAL with encoded format before wrapping with SPDIF. Bug: 17566660 Change-Id: I00ad888ca15ff0f85b85efb8167c7f5ea761a244 Signed-off-by: Phil Burk <philburk@google.com>
* Add devicesToString, inputFlagsToString, and sourceToStringGlenn Kasten2015-03-061-0/+4
| | | | Change-Id: I0c09d76c204ffc5579f62d2ed1faef07922a5962
* Remove redundant semicolon from namespace closingGlenn Kasten2015-03-031-1/+1
| | | | Change-Id: I163f9d3d216c283ae1160ce4802e5247cf44fba7
* audio: new routing strategies and stream typesEric Laurent2014-11-211-0/+2
| | | | | | | | | | | | | Added new routing strategies and stream type for internal use by audio policy manager and audio flinger: - One for accessibility to allow different routing than media - One for re-routing (remote submix) in preparation of dynamic policies - Added stream type for "internal" audio flinger tracks used for audio patches and duplication. Bug: 18067208. Change-Id: I88f884b552e51e4a49c29125e5a1204cf58ff434
* audioflinger: new HW A/V sync ID allocation flowEric Laurent2014-10-221-0/+3
| | | | | | | | | | | | | The HW A/V sync ID is now allocated by the audio HAL before the output stream is created by a call to global get_parameters() with key AUDIO_PARAMETER_HW_AV_SYNC. When the AudioTrack is created, the HW A/V sync ID is communicated to the output stream by stream set_parameters() with key AUDIO_PARAMETER_STREAM_HW_AV_SYNC. Bug: 17112525. Change-Id: Ia8bc6f3bf9f358aa89f3f56ac554e893a19811ad
* audioflinger: fix pre processing effect leakEric Laurent2014-09-151-0/+20
| | | | | | | | | | | | | | | | | | | | 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
* Merge "Fix effect and mono sink handling." into lmp-devAndy Hung2014-08-071-1/+2
|\
| * Fix effect and mono sink handling.Andy Hung2014-08-081-1/+2
| | | | | | | | | | | | | | | | Do not permit mixing to mono sink in AudioFlinger. Allow effects on mono sink if not Mixer thread (e.g. Record). Bug: 16863095 Change-Id: I8b232fc1fb3f07bf017020c5d4f9ace644dec6d8
* | AudioSystem: add API to query audio HW sync sourceEric Laurent2014-08-061-0/+3
|/ | | | | | | | | | | Add a method to query from the audio HAL the HW sync source used for a given audio session. Modify audio policy to select a direct output with HW sync when requested. Bug: 16132368. Change-Id: I03038f9188f2d389f8a5fd76a671854013a4513e
* Merge "Enable multichannel in AudioFlinger" into lmp-devAndy Hung2014-07-291-1/+1
|\
| * Enable multichannel in AudioFlingerAndy Hung2014-07-281-1/+1
| | | | | | | | Change-Id: Ibdbdc6ea0b87cdcd15432257a3455b11b3ce14b7
* | rename AudioSystem::newAudioSessionId()Eric Laurent2014-07-281-1/+1
| | | | | | | | | | | | | | | | | | Rename AudioSystem::newAudioSessionId() to AudioSystem::newAudioUniqueId() as it can be used also for I/O handles. Bug: 12378680. Change-Id: I611ea3b5eb57a4b0774437f477ee87dc4ccc2cc2
* | AudioFlinger: update openInput() and openOutput()Eric Laurent2014-07-281-17/+22
|/ | | | | | | | | | Add parameters to openInput() and openOutput(): device address, input source. Allow caller to specify a given I/O handle Group parameters in a struct audio_config. Bug: 12378680. Change-Id: I7e9af74c0d996561cc13cbee7d9012d2daf33025
* Add multichannel capability to AudioFlingerAndy Hung2014-07-241-1/+26
| | | | | | But not enabled (kEnableExtendedChannels == false). Change-Id: I62f7e31fbd29ad703a9a02f5d1a280b6972dd423
* audio flinger: add patch connection between hw modulesEric Laurent2014-07-241-2/+19
| | | | | | | | | | | | | | | | | | Add support for audio device connections between different audio hw modules. The patch is performed by creating a bridge between the playback thread connected to the sink device and the record thread connected to the source device using a pair of specialized PlaybackTrack and RecordTrack. - Added PatchTrack and PatchRecord classes. - Added TrackBase type to indicate more clearly the track behavior. - A TrackBase can allocate the buffer or reuse an existing one. - Factored some code in openOutput() and openInput() for internal use by PatchPanel. Bug: 14815883. Change-Id: Ib9515fcda864610458a4bc81fa8f59096ff4d7db
* Add audio_input_flags_t to IAudioFlinger::openInputGlenn Kasten2014-07-171-1/+2
| | | | | | | For backward compatibility, until flags are correctly calculated, we will assume that the request is for a low latency input stream. Change-Id: I76746834e870df00833dc77cbdaa2edd2ffeec95
* Enable extended precision PCM output in AudioFlingerAndy Hung2014-07-081-1/+1
| | | | Change-Id: I7c0907c7b2369681975d8ea0192b722d7ed7a867
* Merge "IAudioFlinger::openRecord now suggests notificationFrames"Glenn Kasten2014-07-021-0/+1
|\
| * IAudioFlinger::openRecord now suggests notificationFramesGlenn Kasten2014-07-031-0/+1
| | | | | | | | Change-Id: I08885cc381d03c522a23289e74f0e1ed46563863
* | Merge "Remove obsolete IAudioFlinger::channelCount()"Glenn Kasten2014-07-021-1/+0
|\ \ | |/ |/|
| * Remove obsolete IAudioFlinger::channelCount()Glenn Kasten2014-06-021-1/+0
| | | | | | | | Change-Id: Ie623edae2e795f9155f1f452fe4e6c7217a4a4c8
* | Add enabling variable for extended precision audioAndy Hung2014-06-251-0/+18
| | | | | | | | | | | | | | | | Set AudioFlinger::kEnableExtendedPrecision = true to enable extended precision. Enabling will be required for devices (such as USB) which report 24 bit or 32 bit sink formats. Change-Id: I0dc1d7a4f7607086d7b536ea0e43aef0e696f2ee
* | Use of fast capture by normal captureGlenn Kasten2014-06-021-0/+2
| | | | | | | | | | | | | | Will only configure fast capture path if the input buffer size is less than 10 ms and the input sample rate is same as the primary output sample rate. Change-Id: I4a7cdc6069d750845412c626d27e83f72a1ab397
* | Add mPrimaryOutputSampleRateGlenn Kasten2014-06-021-0/+3
|/ | | | Change-Id: I46b527fc3f2b5a5720a74b4f0b9a8f2e0d570b09
* audioflinger: first patch panel implementation.Eric Laurent2014-05-271-24/+13
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* IAudioFlinger interface extension for patch panelEric Laurent2014-05-271-0/+38
| | | | Change-Id: Iaabe0a7e315d5725e00a74a6ed40339b98f20330
* Pass stereo gains as packed minifloatGlenn Kasten2014-05-191-3/+0
| | | | | | | | | | 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
* Merge "Explicitly include Configuration.h"Glenn Kasten2014-05-131-0/+1
|\
| * Explicitly include Configuration.hGlenn Kasten2014-05-131-0/+1
| | | | | | | | | | | | | | | | Must include Configuration.h in any source file with #ifdef or #if that depends on Configuration.h. This avoid inconsistencies that could result in subtle bugs. Change-Id: I99fdf19d56e7c73de4e7d672b937336b932a2a00
* | AudioFlinger: add specific mutex for client listsEric Laurent2014-05-131-9/+8
|/ | | | | | | | | | | | | 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
* Merge "Remove obsolete IAudioRecord::getCblk()"Glenn Kasten2014-05-091-1/+0
|\
| * Remove obsolete IAudioRecord::getCblk()Glenn Kasten2014-05-091-1/+0
| | | | | | | | Change-Id: Id20b5efd765b9796b0e391610e06dc928a829ebf
* | Merge "audioflinger: refactor thread config events"Eric Laurent2014-05-091-2/+7
|\ \ | |/ |/|
| * audioflinger: refactor thread config eventsEric Laurent2014-05-091-2/+7
| | | | | | | | | | | | | | | | | | | | | | Merge config events and set parameters messaging mechanism. - setting parameters now uses the config event mechanism - config event now allow to wait for a condition and synchronize caller binder thread with execution thread and return an execution status. - simplify locking mechanism to avoid unlocking the thread mutex while processing events. Change-Id: Ia49cb3e617abec4bacb6c1f9a8cb304c4ed3902e
* | IAudioFlinger::openRecord returns IMemory(s)Glenn Kasten2014-05-091-0/+2
|/ | | | | | | | openRecord() now explicitly returns the control block and data buffer as separate IMemory references. If the IMemory for data buffer is 0, this means it immediately follows the control block. Change-Id: Ic098f88f0e037f8fbe30006689e18cacacf09d06