summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.h
Commit message (Collapse)AuthorAgeFilesLines
* AudioFlinger: add specific mutex for client listsEric Laurent2014-05-131-15/+4
| | | | | | | | | | | | | 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
* audioflinger: refactor thread config eventsEric Laurent2014-05-091-57/+114
| | | | | | | | | | | 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
* Add a per-thread heap that is read-only to clientsGlenn Kasten2014-05-071-0/+11
| | | | Change-Id: I401263566ca20fbfb565689c8fa99458d3b283b2
* Add FIXMEs to createRecord for fast captureGlenn Kasten2014-03-311-1/+1
| | | | Change-Id: I759be200fae32969212c52a409f46f2e704081e3
* Revert "Revert "Convert AudioFlinger mSinkBuffer to flexible format""Andy Hung2014-03-131-3/+6
| | | | This reverts commit e2a9c29f35e0c09782558542fc4cf9823779590e.
* Revert "Convert AudioFlinger mSinkBuffer to flexible format"Eric Laurent2014-03-131-6/+3
| | | | | | | This reverts commit e7e676fd2866fa4898712c4effa9e624e969c182. Bug: 13450717. Change-Id: Ib80b0d14428fecce33c62003a1fcf83f71cee03b
* Convert AudioFlinger mSinkBuffer to flexible formatAndy Hung2014-03-101-3/+6
| | | | | Change-Id: I618d9c99a5f6f8c8d6a9f4b2d19e82c9ddc3b06e Signed-off-by: Andy Hung <hunga@google.com>
* Add mEffectBuffer to AudioFlingerAndy Hung2014-03-101-0/+35
| | | | | Change-Id: Icf97c50040bc127723d56eb4d2fb6e790a7253d9 Signed-off-by: Andy Hung <hunga@google.com>
* Add MixerBuffer for accumulation of float audioAndy Hung2014-02-271-0/+23
| | | | | | | | 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-1/+1
| | | | | Change-Id: I4d1d18d716fa3ad8c0e7cc87f5a2823422f504eb Signed-off-by: Andy Hung <hunga@google.com>
* Rename mMixBuffer to mSinkBuffer in AudioFlingerAndy Hung2014-02-271-2/+3
| | | | | Change-Id: I1f55630425b8ce36e9df2aaf64e06a8960b69a47 Signed-off-by: Andy Hung <hunga@google.com>
* Multi-client recording continuedGlenn Kasten2014-02-181-6/+0
| | | | | | | | | 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-3/+0
| | | | Change-Id: I611a63e63acf3eb17e2072c1a77b91fe9e62e36a
* Add _l suffix to readInputParameters/OutputParametersGlenn Kasten2014-02-181-5/+5
| | | | | | | They are always called while thread mutex is locked, or in the thread constructor. Change-Id: I56df71563a52a5cd6cea6fc0914df993519e1b74
* Multi-client recordingGlenn Kasten2014-02-181-26/+19
| | | | | | 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-1/+1
|\ | | | | | | Change-Id: I7b1cc71057b2bd4f771e7bcf508a8c3abd6017ce
| * Make frameworks/av 64-bit compatibleKévin PETIT2014-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Fix whitespaceGlenn Kasten2014-02-071-2/+2
| | | | | | | | Change-Id: I9add0872030a26933f6b6dad1be299154611cc56
* | Merge "AudioFlinger: Offload track transition fix"Eric Laurent2014-02-071-1/+2
|\ \
| * | AudioFlinger: Offload track transition fixHaynes Mathew George2014-02-061-1/+2
| | | | | | | | | | | | | | | | | | | | | Trigger state changes in OffloadThread on adding a new offload track. Bug: 12530661 Change-Id: I95b62764c7ac041d470702e86b951f812eb0e70f
* | | Merge "AudioFlinger: Modify flush handling for offload path"Eric Laurent2014-02-071-2/+0
|\ \ \ | |/ /
| * | AudioFlinger: Modify flush handling for offload pathHaynes Mathew George2014-02-061-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Do not allow an offload track to directly control the offload thread behavior. OffloadThread can check for any pending flush reporting by its active tracks and decide to flush the HW or not. Bug: 12530661 Change-Id: Ib33f023c942f6c091b618004136b153c38a6eef6
* | | Merge "Fix IoConfigEvent constructor initializer list"Glenn Kasten2014-02-071-1/+1
|\ \ \ | |/ / |/| |
| * | Fix IoConfigEvent constructor initializer listGlenn Kasten2014-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | Fortunately this bug never showed up, because the parameter field has not been used yet. Change-Id: I2b36e2b7e1dcc2039c494fc5ea4994d262435aac
* | | Fix unused parameter warnings in audioGlenn Kasten2014-02-031-3/+3
|/ / | | | | | | Change-Id: I665ba3358dd9502f0adec70d486e7bf8a2e1b0fe
* | Merge "Replace control block frameCount_ by explicit in/out parameter"Glenn Kasten2014-01-241-2/+2
|\ \
| * | Replace control block frameCount_ by explicit in/out parameterGlenn Kasten2013-12-201-2/+2
| | | | | | | | | | | | | | | | | | in IAudioFlinger::createTrack and IAudioFlinger::openRecord Change-Id: I09c644c80e92c8e744b1b99055988a2588b2a83d
* | | AudioRecord::getInputFramesLost() cleanupGlenn Kasten2014-01-141-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug that if the binder call failed (for example if the IAudioFlinger binder is dead), then getInputFramesLost was returning garbage. Now it correctly returns zero, which is the error value for this method. The type declarations for getInputFramesLost were inconsistent: a mixture of unsigned int, size_t, and uint32_t. Now it returns uint32_t everywhere, which is what the underlying HAL API returns. Added a FIXME about the side effect behavior. This will need review for multi-client. Change-Id: Ifa2e117a87dbd0c1f2c892a31d1c3dd919bf1a0a
* | Change mActiveTrack to mActiveTracks vectorGlenn Kasten2013-11-201-2/+4
| | | | | | | | | | | | The size of mActiveTracks is still limited to 1 for now. Change-Id: Ia6b06b25d8c4709f087110ae29c589999407a2a2
* | am 06d62548: am d7e59228: audioflinger: do not use raw pointer for tracksEric Laurent2013-11-151-1/+1
|\ \ | |/ | | | | | | * commit '06d6254823b8f7a46690369e57b5f149c94c9f65': audioflinger: do not use raw pointer for tracks
| * audioflinger: do not use raw pointer for tracksEric Laurent2013-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | Commit 9da3d95 surfaced a problem caused by the use of a raw pointer to a track in offload thread implementation. Pointers to tracks should always be weak or strong pointers. Bug: 11708529. Change-Id: Ic48632532d186c9be8261f73cefdf824b9fbbd2b
* | Pull HAL reads out of RecordThread resampleGlenn Kasten2013-11-081-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the resample was indirectly calling HAL read from within the BufferProvider's getNextBuffer. Now the HAL read is done ahead of time into a circular buffer, and the getNextBuffer just reads out of that memory. This change will permit some future planned features. Also removed the mono to mono resampling optimization, as that optimization will no longer be valid in the future. Change-Id: I59f5016a2df91078d697c37a7dec2d9d9f44542e
* | Rename standby methodsGlenn Kasten2013-11-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | ThreadBase::standby() returns the value of mStandby. RecordThread::standby() "overrode" ThreadBase::standby(), but with a different meaning and no return value. This meant you couldn't access the parent's class definition within RecordThread. This could be confusing, so this CL renames RecordThread::standby() to standbyIfNotAlreadyInStandby(). Change-Id: I9196ee12701dd2dccdfaed922af2d7b8e8774676
* | am 7f8f7585: am fd477974: AudioFlinger: more fixes for offload audio lostEric Laurent2013-10-281-0/+1
|\ \ | |/ | | | | | | * commit '7f8f758506a95d6fe5c0e52aa7b5ef82fb18861a': AudioFlinger: more fixes for offload audio lost
| * AudioFlinger: more fixes for offload audio lostEric Laurent2013-10-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | mStandby being false was not a reliable indication that something had been written to audio HAL. Considering the last track in mActiveTracks vector as the latest activated track was wrong as this is a SortedVector. Bug: 11247103. Change-Id: I397d011c5afcdd779def3fe25aaae7669a472cfc
| * Assign blame for playback wakelocks.Marco Nelissen2013-10-251-1/+7
| | | | | | | | | | | | | | | | | | | | | | Set a work source for the playback wakelock, so that playback is counted against the requesting app instead of the media server. Cherrypicked from master. b/9464621 Change-Id: I7329f88a288a95a582a78005a1c3d16a5a611e31
* | Assign blame for playback wakelocks.Marco Nelissen2013-10-251-1/+7
| | | | | | | | | | | | | | Set a work source for the playback wakelock, so that playback is counted against the requesting app instead of the media server. Change-Id: I7329f88a288a95a582a78005a1c3d16a5a611e31
* | am 6edd8ca5: am 6a51d7ed: audioflinger: fix track terminated before playingEric Laurent2013-10-181-2/+2
|\ \ | |/ | | | | | | * commit '6edd8ca5b7e3d169db4314d2b994bc9d48e9e082': audioflinger: fix track terminated before playing
| * audioflinger: fix track terminated before playingEric Laurent2013-10-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | When a track is terminated before any audio was written, we should not send a drain request to the HAL. The drain will be ignored and we will wait the async callback for ever. Also fix a potential deadlock by not deleting a track with the thread mutex held: mPreviousTrack changed from a sp to a raw pointer. Bug: 11247103. Change-Id: I0a4b47b099204c7c326d45d700234ab8f72d8eae
* | am 8580679e: am 014e7fa2: Make Audio wakelock names less unique.Narayan Kamath2013-10-151-0/+2
|\ \ | |/ | | | | | | * commit '8580679e1780617d978d28a43e932314b86608ce': Make Audio wakelock names less unique.
| * Make Audio wakelock names less unique.Narayan Kamath2013-10-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These wakelocks now show up in the client process, where they might cause wakelock overflows if AudioFlinger threads die often. The client process should be agnostic of audio flinger threading, so don't make the wakelock names rely on audioflinger thread names. Wakelock names now depend only on the audio flinger thread type, and not the ID itself. bug: 11200551 Change-Id: Ia1f71b569cb7502d617b77596abc245f461a6ec0
* | am b5677882: am 8097068d: Merge "Better recording wake lock accounting" into ↵Marco Nelissen2013-10-041-2/+3
|\ \ | |/ | | | | | | | | | | klp-dev * commit 'b5677882cf9a34bd3f2daf76d10951282ea9b083': Better recording wake lock accounting
| * Better recording wake lock accountingMarco Nelissen2013-10-031-2/+3
| | | | | | | | | | | | | | | | | | Count wake lock use against the app that initiated the recording, not against the media server. b/10985160 Change-Id: Iae6e6c030b7f1c6081d9c79725d6990f60dadaaa
* | am 0adc67df: Merge "audioflinger: fix crash when starting offload thread" ↵Eric Laurent2013-09-301-6/+6
|\ \ | |/ | | | | | | | | | | into klp-dev * commit '0adc67dfc5cedb211c36f06849681a60a32f5805': audioflinger: fix crash when starting offload thread
| * audioflinger: fix crash when starting offload threadEric Laurent2013-09-261-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing a sp to parent thread to AsyncCallbackThread() constructor causes a strong reference to be acquired on the OffloadThread inside its constructor which causes an early launch of the thread loop with unpredictable consequences. Pass a wp to parent thread instead. Also move the creation of the AsyncCallbackThread to readOutputParameters() where mUseAsyncWrite is initialized which makes more sense. Also change the type of AsyncCallbackThread parent thread to PlaybackThread instead of OffloadThread to allow a broder use of non blocking write which in theory is not limited to audio offload use case. Bug: 8174034. Change-Id: I4b093b022030cd4f5eb8b8e477333e91098a6549
* | am c6bed216: am a3b97ad2: Merge "audioflinger: implement getTimestamp() for ↵Eric Laurent2013-09-201-0/+2
|\ \ | |/ | | | | | | | | | | offloaded tracks" into klp-dev * commit 'c6bed216e3a759a855ac4b9b743fbaed2d5929c1': audioflinger: implement getTimestamp() for offloaded tracks
| * Merge "audioflinger: implement getTimestamp() for offloaded tracks" into klp-devEric Laurent2013-09-201-0/+2
| |\
| | * audioflinger: implement getTimestamp() for offloaded tracksEric Laurent2013-09-201-0/+2
| | | | | | | | | | | | | | | Bug: 9587132. Change-Id: Ie9d5f4cca96306d08bc9a2dbd6edd8953096702d
* | | am ce3e7cb0: am fbb2609f: Merge "audioflinger: fix lost offload thread ↵Eric Laurent2013-09-201-1/+3
|\ \ \ | |/ / | | | | | | | | | | | | | | | resume event" into klp-dev * commit 'ce3e7cb0bd09e7861d417b7d45c1e5921f10a93f': audioflinger: fix lost offload thread resume event
| * | audioflinger: fix lost offload thread resume eventEric Laurent2013-09-191-1/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was possible that a resume request signaled by addTrack_l() while waiting for an async write callback is lost. This is because mSignalPending was not set and waitingAsyncCallback_l() would pause the thread loop before executing prepareTracks_l(). The fix consists in using signal_l() method to wake the thread loop o that mSignalPending is set. Also make sure that sleepTime is reset to 0 when resuming to make sure that we write any remaining bytes to the HAL. Bug: 10810347. Change-Id: If9a3b22cc3b9e6eb384a56c48c40e6258d0896ad