summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use new channel count functions for audio masksAndy Hung2014-05-161-4/+4
| | | | | Change-Id: Ia658ab4b6320d19fdb50f123c930918724ff0ef3 Signed-off-by: Andy Hung <hunga@google.com>
* Merge "Pull up mFlags and isFastTrack from Track to TrackBase"Glenn Kasten2014-05-141-1/+1
|\
| * Pull up mFlags and isFastTrack from Track to TrackBaseGlenn Kasten2014-05-131-1/+1
| | | | | | | | Change-Id: I6bd48292310be4e05758a11f617f50585904422d
* | AudioFlinger: add specific mutex for client listsEric Laurent2014-05-131-24/+9
|/ | | | | | | | | | | | | 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
* Explicitly ignore return value of __futex_syscall3Glenn Kasten2014-05-091-2/+2
| | | | Change-Id: Ic65f257bfc4a0eff7bdd3c44fab68a3f17e2bd08
* Merge "audioflinger: refactor thread config events"Eric Laurent2014-05-091-316/+301
|\
| * audioflinger: refactor thread config eventsEric Laurent2014-05-091-316/+301
| | | | | | | | | | | | | | | | | | | | | | 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-1/+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
* Add a per-thread heap that is read-only to clientsGlenn Kasten2014-05-071-0/+8
| | | | Change-Id: I401263566ca20fbfb565689c8fa99458d3b283b2
* Fix a couple of fast capture typo bugsGlenn Kasten2014-05-071-2/+2
| | | | | | | AudioRecord constructor was not passing flags through to set(). Server-side check was using wrong kind of channel mask. Change-Id: Ifaa880ec323771e9fd168262be05f3e539f53390
* Use audio_is_linear_pcm()Glenn Kasten2014-05-021-2/+2
| | | | Change-Id: I17b30fdb6dbb6454ad0a20dd703fd603a37a8397
* audioflinger: forward device change to effects in direct threadGlenn Kasten2014-04-141-0/+10
| | | | | | | | | | | | | Device change during offload playback is not informed to effect chain which causes effects still work on unexpected output devices. Add device change notification in direct output thread. Original author wjiang <wjiang@codeaurora.org> CRs-Fixed: 630408 Bug: 14053172 Signed-off-by: Glenn Kasten <gkasten@google.com> Change-Id: I094a99bdf540479cee2fca6614ec35c2fa7d6046
* Change references of Q19.12 to Q4.27 for clarityAndy Hung2014-04-021-1/+1
| | | | | Change-Id: I5beb7daf6ff9bc123ff3582f7c294edcaf8652f6 Signed-off-by: Andy Hung <hunga@google.com>
* Add FIXMEs to createRecord for fast captureGlenn Kasten2014-03-311-8/+12
| | | | Change-Id: I759be200fae32969212c52a409f46f2e704081e3
* Merge "Use LOG_ALWAYS_FATAL instead of LOG_FATAL"Glenn Kasten2014-03-261-9/+9
|\
| * Use LOG_ALWAYS_FATAL instead of LOG_FATALGlenn Kasten2014-03-261-9/+9
| | | | | | | | | | | | | | LOG_FATAL is compiled out in most builds, so the assertion checks were not being performed. Change-Id: I774f0985ab9c5ccecd8989a0f1c940386b73fc35
* | Use symbolic constants from <system/audio.h>Glenn Kasten2014-03-251-1/+1
|/ | | | | | | | AUDIO_INTERLEAVE_* AUDIO_STREAM_MIN AUDIO_SESSION_ALLOCATE Change-Id: I31dd6f327204685e50716079ce21c4ba206dff11
* audioflinger: OffloadThread fix for resume underrunHaynes Mathew George2014-03-171-20/+22
| | | | | | | | AudioFlinger can miss resuming h/w on a pause->resume transition if sufficient data isn't available Bug: 11358524. Change-Id: Ic3c75256290d3515fd4a96dfcc900909fbe5bc15
* audioflinger: Handle pause /resume in stopping stateKrishnankutty Kolathappilly2014-03-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | -Pre-requisite: Perform seek on the clip. After seek the data remaining till EOS is little more than the driver and common block buffering. -Framework state: Offload thread is waiting for signal from the HAL for a free buffer. Audio Player calls sink stop on reaching EOS. Audio track is waiting on obtain buffer for a free space in common block to send the last buffer. The track is moved to stopping state as input EOS is reached. -Issue: Perform pause/ resume in this state(STOPPING), Audio playback does not resume. -Fix Ensure resume is called in stopping state if frames ready is greater than zero. Bug: 12870871 Change-Id: Ib1378c4ee5ce4bea655691e93de0775f7b1d2804 Signed-off-by: Glenn Kasten <gkasten@google.com>
* Make error handling for audio driver initCheck more similarGlenn Kasten2014-03-141-8/+6
| | | | Change-Id: I8222f00f7ac89d52235af0f64f3fee7a8c471e1e
* Replace if/else by switchGlenn Kasten2014-03-141-3/+11
| | | | Change-Id: Ibe96c8fb1f0ba7f850c0561f60769ce63aceba5d
* Whitespace and commentsGlenn Kasten2014-03-141-1/+2
| | | | Change-Id: I99752cca74a459c4746ea4718acb0115439e50bd
* Fix Offload playback in AudioFlingerAndy Hung2014-03-131-2/+3
| | | | | | | | | This fixes Offload playback regression introduced by adding flexible format to mSinkBuffer. Test case is AAC file playback. Bug: 13450717 Change-Id: I0fa11978295ed4793be90c565e5b8abedf156914 Signed-off-by: Andy Hung <hunga@google.com>
* Revert "Revert "Convert AudioFlinger mSinkBuffer to flexible format""Andy Hung2014-03-131-19/+35
| | | | This reverts commit e2a9c29f35e0c09782558542fc4cf9823779590e.
* Revert "Convert AudioFlinger mSinkBuffer to flexible format"Eric Laurent2014-03-131-35/+19
| | | | | | | This reverts commit e7e676fd2866fa4898712c4effa9e624e969c182. Bug: 13450717. Change-Id: Ib80b0d14428fecce33c62003a1fcf83f71cee03b
* Convert AudioFlinger mSinkBuffer to flexible formatAndy Hung2014-03-101-19/+35
| | | | | Change-Id: I618d9c99a5f6f8c8d6a9f4b2d19e82c9ddc3b06e Signed-off-by: Andy Hung <hunga@google.com>
* Add mEffectBuffer to AudioFlingerAndy Hung2014-03-101-21/+75
| | | | | Change-Id: Icf97c50040bc127723d56eb4d2fb6e790a7253d9 Signed-off-by: Andy Hung <hunga@google.com>
* NBAIO::Format_from_SR_C requires audio_format_t parameterGlenn Kasten2014-03-071-1/+1
| | | | Change-Id: I4b65f6ed2f6ca3608b3a5f88f52a93af0b9b1f4a
* Merge "Use larger capture pipe since we support resampling by 6:1"Glenn Kasten2014-03-061-3/+3
|\
| * Use larger capture pipe since we support resampling by 6:1Glenn Kasten2014-02-281-3/+3
| | | | | | | | | | | | | | | | | | This avoids overruns on the client AudioRecord side, without requiring client to use a large buffer. It should not increase input latency, since a newly started AudioRecord always joins the stream starting at the latest data. Change-Id: Ib2b8de75cc40a6a3d493a1f8b46b41220f69264f
* | Rename mSinkFormat to mMixerFormat for AudioMixer::track_tAndy Hung2014-03-011-2/+2
|/ | | | | | | AudioMixer::SINK_FORMAT also changes to AudioMixer::MIXER_FORMAT Change-Id: Ic3f8be77d2c75c082c4fd140bc907e30c304d285 Signed-off-by: Andy Hung <hunga@google.com>
* Add MixerBuffer for accumulation of float audioAndy Hung2014-02-271-10/+90
| | | | | | | | Path into and out of MixerBuffer is set up, but not currently enabled. Change-Id: I9d50752607d22dd2a3d9cc7e053babf8dfb22958 Signed-off-by: Andy Hung <hunga@google.com>
* Rename mixBufferSize to mSinkBufferSize in AudioFlingerAndy Hung2014-02-271-10/+10
| | | | | Change-Id: I4d1d18d716fa3ad8c0e7cc87f5a2823422f504eb Signed-off-by: Andy Hung <hunga@google.com>
* Rename constants for MixBufferSize to SinkBufferSizeAndy Hung2014-02-271-9/+9
| | | | | | | | | Updated variable names are kMinNormalSinkBufferSizeMs kMaxNormalSinkBufferSizeMs Change-Id: I91969eae3f8c10275db8778634cbf05fdec0712b Signed-off-by: Andy Hung <hunga@google.com>
* Rename mMixBuffer to mSinkBuffer in AudioFlingerAndy Hung2014-02-271-25/+25
| | | | | Change-Id: I1f55630425b8ce36e9df2aaf64e06a8960b69a47 Signed-off-by: Andy Hung <hunga@google.com>
* Merge "Account for unreleased frames when predicting resampler needs"Glenn Kasten2014-02-221-20/+28
|\
| * Account for unreleased frames when predicting resampler needsGlenn Kasten2014-02-211-20/+28
| | | | | | | | | | | | | | | | | | | | | | | | Other changes related to resampling: - improve logs - use correct form of assert - don't round up max usable circular buffer sizes to power of 2; this gives more predictable results - add some FIXMEs Bug: 13133176 Change-Id: I8d3c90eed4eb0c0c1fbac3c864e179a2806c2301
* | audioflinger: fix race condition in SyncEvent callbackEric Laurent2014-02-201-2/+5
|/ | | | | | | | | | | | | Now that the SyncEvent callback is implemented by the RecordTrack instead of the RecordThread, there is a possibility that the callback is called after the track deletion. SyncEvent callback now uses a weak pointer instead of a raw pointer as cookie. This allows the callback implementer to acquire a strong reference on the object pointed to by the cookie. Bug: 13114128. Change-Id: Id61b8f06044ed1e52c6f7e7c666cdede68340de2
* Multi-client recording continuedGlenn Kasten2014-02-181-39/+46
| | | | | | | | | Remove mReqChannelCount and mReqSampleRate. Increase number of input frames needed for sample rate converter. Add TODO comments to investigate later. Fix bugs in sample rate conversion. Change-Id: I3aa54b862843d518b6e4ece9a7f52fd27d741629
* Move handleSyncStartEvent and clearSyncStartEvent to RecordTrackGlenn Kasten2014-02-181-31/+7
| | | | Change-Id: I611a63e63acf3eb17e2072c1a77b91fe9e62e36a
* Add _l suffix to readInputParameters/OutputParametersGlenn Kasten2014-02-181-11/+11
| | | | | | | They are always called while thread mutex is locked, or in the thread constructor. Change-Id: I56df71563a52a5cd6cea6fc0914df993519e1b74
* Multi-client recordingGlenn Kasten2014-02-181-287/+334
| | | | | | Supports multiple clients both at native sample rate and with resampling. Change-Id: Icea55b4fd30751761b7debaa3ce016c79e712d8d
* resolved conflicts for merge of 566be7c3 to masterNarayan Kamath2014-02-111-14/+18
|\ | | | | | | Change-Id: I7b1cc71057b2bd4f771e7bcf508a8c3abd6017ce
| * Make frameworks/av 64-bit compatibleKévin PETIT2014-02-111-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | am 5a458ede: am 5930e8eb: Merge "AudioFlinger: Remove code for supporting ↵Glenn Kasten2014-02-101-1/+0
|\ \ | |/ | | | | | | | | | | resampling in fast tracks" * commit '5a458ede3b7d303723fde4b856532bdc3b94971b': AudioFlinger: Remove code for supporting resampling in fast tracks
| * AudioFlinger: Remove code for supporting resampling in fast tracksMartin Storsjo2014-02-051-1/+0
| | | | | | | | | | | | This isn't used at the moment. Change-Id: I4e0fb2af5f7d959dbafd5ddb7defa1c6b8e8636a
* | am 4e12dade: am 4361749d: Merge "AudioTrack: Never try to use the fast path ↵Glenn Kasten2014-02-101-2/+0
|\ \ | |/ | | | | | | | | | | if resampling is required" * commit '4e12dadeec10993d2f77cce96600e73ca0dd86e2': AudioTrack: Never try to use the fast path if resampling is required
| * AudioTrack: Never try to use the fast path if resampling is requiredMartin Storsjo2014-01-311-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unless AudioFlinger was built with FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE enabled, AudioFlinger would deny using the fast path (and internally fall back to the normal codepath) when it realized that resampling was required. Since the buffer size calculations within AudioFlinger don't take resampling into account properly (see the calculation below "AUDIO_OUTPUT_FLAG_FAST denied" in audioflinger/Threads.cpp, just below the hunk that this patch changes), make sure AudioTrack doesn't try to use the fast path if resampling is required. This removes the possibility to enable FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE in AudioFlinger since it AudioTrack now won't even try to use the fast path for content that requires resampling, regardless of the AudioFlinger configuration. Change-Id: Icf0f8ad50bf0fdb84657f518c0120aa0535f23f9
| * audioflinger: fix static track end detectionEric Laurent2014-01-301-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If a static track is not a fast track, prepareTracks_l() must rely on framesReady() to detect end of buffer and remove the track from the active track list. Failing to do so results in the track staying active but not processed by the mixer because in underrun. This leaves the mix buffer content uninitialized and causes the effect process function to accumulate its output onto undefined data. Bug: 12013676. Change-Id: Iad72c921fa18d34811abf7d1073890c093a27725
| * audioflinger: check for condition before waitingHaynes Mathew George2013-12-171-1/+6
| | | | | | | | | | | | | | | | AsyncCallbackThread must check for any condition that has already been satisfied before waiting. Bug: 11824817 Change-Id: Ic8c2090d521ecd6a30b76ee75635258d35eb1eff