summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.h
Commit message (Collapse)AuthorAgeFilesLines
* audioflinger: set flush pending on invalidating offload trackHaynes Mathew George2016-08-191-1/+3
| | | | | | | | | | | | | | | | | | On invalidating an offload track, the IAudioTrack instance is destroyed and the offload output is released. If it so happens that APM::getOutputForAttr for the new IAudioTrack is called before OffloadThread::prepareTracks_l checks and removes an invalid track, the same output can get reused. The side effect of this is data present in HAL and below from before the invalidate will be rendered before data from the new seek position is rendered. This is unexpected. To fix this, set hint to issue flush when an offload track is invalidated. Bug: 28566885 CRs-Fixed: 1002438 Change-Id: Ib6c38a3abb600598b87591bac90d03b7150d5216
* Combine 'DTS Sound (TruMedia) Postpro support in frameworks/av for Android ↵jinamdar2016-02-011-1/+19
| | | | | | | | | | | | | 6.0' as a single patch. Signed-off-by: jinamdar <jaydeep.inamdar@dts.com> (cherry picked from commit d3668da66643d4cc39058fb65c8db0742748f70f) Conflicts: services/audioflinger/AudioFlinger.cpp services/audioflinger/Threads.cpp Change-Id: I67e3ba100ff40058919ba827b806aea7bdbaf4bb
* audioflinger: Don't do float conversion in upmix/downmix for legacy ALSAArne Coucheron2015-12-071-0/+5
| | | | | | | | | Legacy ALSA really hates floating point, and it's breaking mic input when doing things like audio recording. Use the old conversion routine for legacy ALSA. Change-Id: I616f4cd42fa0e4d7595dd61ed2d36c4fa7052c53
* audio: add support to enable Direct PCM outputvivek mehta2015-10-061-0/+1
| | | | | | allow effects in case outout is direct pcm Change-Id: I2ad7eacf11642a4ca9f892b61124293d0dc503a9
* audio: several fixes in audio routing callbacksEric Laurent2015-07-101-9/+11
| | | | | | | | | | | | | | | | | | | | | | - 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
* reduce number of binder calls from mediaserverEric Laurent2015-06-261-0/+1
| | | | | | | | | | | | | | | Reduce the number of audio port, audio patch and IO config changed binder calls from mediaserver to client processes: - Do not call IO config changed callback if selected device is the same as previously selected one on a given audio flinger playback or capture thread. - Do not call the audio port or audo patch list update callback on a client if this client as no listener registered. Bug: 22045560. Change-Id: If780e105404de79b7cb5c80c27b793ceb6b1c423
* Reduce log messages on AudioFlinger throttleAndy Hung2015-06-181-0/+2
| | | | | Bug: 21858740 Change-Id: I8f291b64c1033867bb57ffceaa3b7d94aa998715
* AudioFlinger: flush stream when switching tracksPhil Burk2015-06-111-2/+5
| | | | | | | | | For direct threads, when recycling a stream, perform a flush so that the frame position is reset. Bug: 21145353 Change-Id: I08611cd64bb249a9659c44f9e4c47e7455f4838f Signed-off-by: Phil Burk <philburk@google.com>
* Throttle MixerThread data pull to no more than twice expected rateAndy Hung2015-06-031-0/+3
| | | | | | | | | | | | This helps prevent underruns with NuPlayer and other applications which set up buffers that are close to minimum size or use deep buffers, and rely on a double-buffering sleep strategy to fill. Enabled by default. Disabled by setting af.thread.throttle 0 Bug: 19062223 Bug: 21198655 Change-Id: Ia52b48e0c99588af5db53c43fede2afd775b8899
* audio flinger: add suffix to time variables namesEric Laurent2015-05-271-5/+5
| | | | | | | | | | | Add suffix to clarify units for the following variables: standbyTime -> mStandbyTimeNs standbyDelay -> mStandbyDelayNs activeSleepTime -> mActiveSleepTimeUs idleSleepTime -> mIdleSleepTimeUs sleepTime -> mSleepTimeUs Change-Id: I7f5d602c39e0ef3f6fe9ef99eaf1b351c7bd4fc3
* audio flinger: do not call JAVA services until system is readyEric Laurent2015-05-201-9/+22
| | | | | | | | Wait for system ready indication form AudioService before enabling calls to scheduling service or power manager. Bug: 11520969. Change-Id: I221927394f4a08fd86c9d457e55dd0e07949f0cf
* audio flinger: fix fuzz test crashEric Laurent2015-05-081-0/+2
| | | | | | | | | | | | | | | | Clear output stream pointer in duplicating thread when the main output to which it is attached is closed. Also do not forward master mute and volume commands to duplicating threads as this is not applicable. Also fix logic in AudioFlinger::primaryPlaybackThread_l() that could accidentally return a duplicating thread. This never happens because the primary thread is always first in the list. Bug: 20731946. Change-Id: Ic8869699836920351b23d09544c50a258d3fb585
* Implement audio device callbackEric Laurent2015-05-061-0/+1
| | | | | | | | | | | | | | | | | | | | Add class AudioSystem::AudioDeviceCallback notifying AudioSystem clients upon device selection change on a given input or output thread. Maintain a list of installed callback per I/O handle in AudioSystem and call registered callbacks when an OPEN of CONFIG_CHANGED event is received on IAudioFlingerClient::ioConfigChanged(). Add methods to AudioTrack and AudioRecord to add and remove device change callbacks. Add methods to AudioTrack and AudioRecord to query currently selected device. ioConfigChanged() events now convey the audio patch describing the input or output thread routing. Fix AudioRecord failure to start when invalidation is handled by start(). Change-Id: I9e938adf025fa712337c63b1e02a8c18f2a20d39
* Merge "AudioTrack: fix direct tracks not pausing" into mnc-devPhil Burk2015-05-021-2/+3
|\
| * AudioTrack: fix direct tracks not pausingPhil Burk2015-05-011-2/+3
| | | | | | | | | | | | | | | | | | | | When a Direct Track is paused and the HAL does not support pause() and resume() then the HW never gets paused. The app can just keep writing data, which gets played. Bug: 18899620 Change-Id: Ice0f360956ff7ca425f6f24a0a2a8640d8b43fa8 Signed-off-by: Phil Burk <philburk@google.com>
* | AudioSystem: refactor audio config cache and callbacksEric Laurent2015-05-011-12/+11
|/ | | | | | | | | | | | | | | 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
* PatchPanel: do not use setParameters() internally.Eric Laurent2015-04-281-0/+4
| | | | | | | | | | | | | | 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
* Add floating and multichannel record to AudioFlingerAndy Hung2015-04-221-6/+11
| | | | Change-Id: Ia388fb012a0b6d81613ef87142a97d76836338f9
* Make record buffer in RecordThread variable formatAndy Hung2015-04-211-1/+1
| | | | Change-Id: Id4bb9b973eeea16946fba3bc084c7ac270d9fa33
* Improve ResamplerBufferProviderAndy Hung2015-04-081-2/+31
| | | | Change-Id: I3cc3af221ad5797ff219d75227350733afa180db
* Add RecordBufferConverter for RecordThread data processingAndy Hung2015-04-081-0/+81
| | | | Change-Id: Ia3aab8590cd41e8a7cba0a7345d70d2866d92045
* Update commentsGlenn Kasten2015-03-131-1/+1
| | | | Change-Id: I37d3c4ce22b74fe8581a886fe5a7f9fef8266dad
* Rename mName to mThreadName and kNameLength to kThreadNameLengthGlenn Kasten2015-03-061-2/+2
| | | | Change-Id: I0adfcdcab7923a07a840ec0e04528cb8bfc41f10
* am 69158e3e: am 6ab33981: am 610255e8: Merge "audioflinger: pause HW A/V ↵Eric Laurent2015-01-071-0/+3
|\ | | | | | | | | | | | | sync output when AudioTrack underruns" into lmp-mr1-dev * commit '69158e3e7b565a5ca131a2efaa9b76615ca80cbb': audioflinger: pause HW A/V sync output when AudioTrack underruns
| * audioflinger: pause HW A/V sync output when AudioTrack underrunsEric Laurent2014-12-191-0/+3
| | | | | | | | | | | | | | | | | | Do not standby, starve or feed 0s to the audio HAL on direct output using HW A/V sync mode. Bug: 17883772. Change-Id: I11e6c97ec24360d75f9b602814d40a54b60cb7a7
* | Line length 100Glenn Kasten2014-12-301-1/+2
| | | | | | | | Change-Id: I6c8fe626a3825fa9e139319656d682a57b887c97
* | am 85aca658: am d33712d7: am 145cf5d8: Merge "audioflinger: implement ↵Eric Laurent2014-12-171-4/+5
|\ \ | |/ | | | | | | | | | | pause/resume for direct outputs" into lmp-mr1-dev * commit '85aca658ac7d20584b0647427256df50a5f243ef': audioflinger: implement pause/resume for direct outputs
| * audioflinger: implement pause/resume for direct outputsEric Laurent2014-12-161-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend pause/resume support to direct output threads (was only for offload threads). If the HAL implements pause/resume, track pause/resume is forwarded to the HAL. Pause, flush, resume sequence is respected by executing the HAL calls in the playback thread (same as offload). Make sure the track flags on client side are consistent with the flags on server side. Bug: 17883772. Change-Id: I89b360d69818f7a9204bd36e3ec63a79e106ecf1
* | am 72215491: am 1a475921: am 223fd5c9: audio: new routing strategies and ↵Eric Laurent2014-11-261-3/+1
|\ \ | |/ | | | | | | | | | | stream types * commit '72215491c60fbcdb9a2f0be782e24e39cca249c5': audio: new routing strategies and stream types
| * audio: new routing strategies and stream typesEric Laurent2014-11-211-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Improve dumpsys for output threadsGlenn Kasten2014-10-221-0/+3
|/ | | | | | | Display output thread type and flags. Also add units and use consistent spelling. Change-Id: I19eb627f41c4887b6ad0543024a8477a99890798
* Fix uncertainty of one normal mix buffer in AudioTrack::getTimestampGlenn Kasten2014-10-021-1/+4
| | | | | | | | | | The per-thread timestamp latch was not synchronized with the per-track released frames. Now the value of each track's released frames is latched along with the timestamp. Bug: 17531839 Bug: 17669342 Change-Id: I9d50c8c6a5de55a3f4561ac40e20d497376c1257
* Merge "Revert "Fix uncertainty of one normal mix buffer in ↵Glenn Kasten2014-10-011-1/+0
|\ | | | | | | AudioTrack::getTimestamp"" into lmp-dev
| * Revert "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp"Glenn Kasten2014-10-011-1/+0
| | | | | | | | | | | | | | | | This reverts commit 54464ba861aaafd11ee5645f5d1ecd1171c6e9fe. Bug: 17733142. Change-Id: I9886d40032b2f7d96bee03e600e14f78943d8052
* | Merge "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp" ↵Glenn Kasten2014-09-301-0/+1
|\ \ | |/ | | | | into lmp-dev
| * Fix uncertainty of one normal mix buffer in AudioTrack::getTimestampGlenn Kasten2014-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | The per-thread timestamp latch was not synchronized with the per-track released frames. Now the value of each track's released frames is latched along with the timestamp. Bug: 17531839 Bug: 17669342 Change-Id: I96252782911bd42a2534cc4030521b7eeb99a7b9
* | audioflinger: forward flush to direct output streamsEric Laurent2014-09-291-3/+2
|/ | | | | | | | Track flush should be forwarded to the audio HAL when playing on a direct output stream. Bug: 17704953. Change-Id: Iafc94327fe9aebf1d4eaa97b76c6767b7ac5babe
* audioflinger: fix pre processing effect leakEric Laurent2014-09-151-3/+0
| | | | | | | | | | | | | | | | | | | | 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
* audio flinger: add patch connection between hw modulesEric Laurent2014-07-241-1/+14
| | | | | | | | | | | | | | | | | | 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
* Return negotiated format with HAL in AudioFlingerAndy Hung2014-07-101-2/+6
| | | | | | | | Fixes an issue caused by extended precision and the FastMixer when the format to the FastMixer was returned instead of the HAL format. Change-Id: I2be9d55d5c87d82e46b5200b07fcdd986ebde08a
* 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
* | Use sp<> instead of raw pointer for FastMixerGlenn Kasten2014-06-241-2/+2
| | | | | | | | | | | | | | This avoids worry about the thread lifetime during tear-down. Bug: 15858655 Change-Id: I896d24317bd6f53a574645cdf4cd514eaa205dd5
* | Use of fast capture by normal captureGlenn Kasten2014-06-021-1/+39
|/ | | | | | | 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
* audioflinger: first patch panel implementation.Eric Laurent2014-05-271-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge "Add format parameter to getTrackName() and track_t"Andy Hung2014-05-231-3/+6
|\
| * Add format parameter to getTrackName() and track_tAndy Hung2014-05-191-3/+6
| | | | | | | | | | Change-Id: Ia152a839014e235fbfb656104c15d7c1b456d02e Signed-off-by: Andy Hung <hunga@google.com>
* | Allow track buffer "allocation" to be from pipeGlenn Kasten2014-05-221-0/+2
|/ | | | Change-Id: Ib9ac170f8e8b7746b3588157a56cbee3b753a1cb