summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/TrackBase.h
Commit message (Collapse)AuthorAgeFilesLines
* audioflinger: fix pre processing effect leakEric Laurent2014-09-151-0/+1
| | | | | | | | | | | | | | | | | | | | 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-3/+32
| | | | | | | | | | | | | | | | | | 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
* Allow track buffer "allocation" to be from pipeGlenn Kasten2014-05-221-1/+8
| | | | Change-Id: Ib9ac170f8e8b7746b3588157a56cbee3b753a1cb
* Pull up mFlags and isFastTrack from Track to TrackBaseGlenn Kasten2014-05-131-0/+3
| | | | Change-Id: I6bd48292310be4e05758a11f617f50585904422d
* IAudioFlinger::openRecord returns IMemory(s)Glenn Kasten2014-05-091-1/+5
| | | | | | | | 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
* Multi-client recordingGlenn Kasten2014-02-181-1/+3
| | | | | | Supports multiple clients both at native sample rate and with resampling. Change-Id: Icea55b4fd30751761b7debaa3ce016c79e712d8d
* Assign blame for playback wakelocks.Marco Nelissen2013-10-251-0/+3
| | | | | | | 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
* Clean up error handling in createTrack and openRecordGlenn Kasten2013-08-121-0/+1
| | | | | | | | | | | | | | | Outside callers now use initCheck() to determine whether a TrackBase has been created successfully, instead of relying on internal knowledge. Previously, callers needed to know that a TrackBase was only valid if it's getCbk() != 0. For a Track (playback), they needed to know to also check the track's name (track index). Now, outsiders can just call initCheck(). Other changes: - Return a 0 reference if track creation fails - Remove a dead line of code in AudioFlinger::openRecord Change-Id: If374924a3f6fd27906f625aa83dd0a1e3f506e00
* Remove obsolete TrackBase::getBuffer()Glenn Kasten2013-08-061-9/+0
| | | | Change-Id: Ic39c7baa9538080bfec114bf18ff9b9986c93fed
* Treat mChannelCount as uint32_t consistentlyGlenn Kasten2013-07-291-1/+1
| | | | | | mChannelCount was 8-, 16-, or 32-bits Change-Id: I2cc2fedf3e33144e5c8bbd9894763282d9217f63
* Remove obsolete mBufferEndGlenn Kasten2013-07-291-2/+0
| | | | Change-Id: I507c6109d66000bb30933ca23b912a1316f55e5e
* Remove obsolete TrackBase::step(), mStepCount, mStepServerFailedGlenn Kasten2013-07-291-5/+0
| | | | Change-Id: I6347096f066b8b19451c6472db7b0671f0cf7702
* Merge "Remove obsolete TrackBase::reset()"Glenn Kasten2013-07-261-1/+0
|\
| * Remove obsolete TrackBase::reset()Glenn Kasten2013-07-251-1/+0
| | | | | | | | Change-Id: I38100b7e28a12d7af8cb40ae3f4d9cb4a0ebe701
* | AudioFlinger: offload playback, non-blocking writeEric Laurent2013-07-251-4/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | - 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
* New control block for AudioTrack and AudioRecordGlenn Kasten2013-06-121-1/+1
| | | | | | | | Main differences between old and new control block: - removes the mutex, which was a potential source of priority inversion - circular indices into shared buffer, which is now always a power-of-2 size Change-Id: I4e9b7fa99858b488ac98a441fa70e31dbba1b865
* Miscellaneous cleanupGlenn Kasten2013-03-041-3/+1
| | | | | | | | | | Abbreviation framesReady to fRdy for new systrace. Put inline const on one line. Use local copy of mState in state. Improve logging. Line length 100. Change-Id: I8201c3ce0e53fd464fd33d02544e52c342d40b68
* Update tee sinkGlenn Kasten2013-02-221-0/+3
| | | | | | | | | | Implement rotation to reduce long-term storage use. Implement optional per-track tee. Dynamically enable at runtime based on property, instead of at compile-time. Dynamic frame count not yet implemented. Bug: 8223560 Change-Id: I3706443c6ec0cb0c6656dc288715a02ad5fea63a
* Start isolating control block accesses in a proxyGlenn Kasten2012-12-121-2/+7
| | | | | | | | | | | | | | | | | | | | | The proxy object will eventually be the only code that understands the details of the control block. This should make it easier to change the control block in the future. Initial set of control block fields that are isolated: - sample rate - send level - volume Prepare for streaming/static separation by adding a union to the control block for the new fields. Fix bug in handling of max sample rate on a track. It was only checking at re-configuration, not at each mix. Simplify OutputTrack::obtainBuffer. Change-Id: I2249f9d04f73a911a922ad1d7f6197292c74cd92
* AudioFlinger files reorganizationEric Laurent2012-11-191-0/+139
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