summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/PlaybackTracks.h
Commit message (Collapse)AuthorAgeFilesLines
* AudioTrack: fix spurious retrograde messagesPhil Burk2015-04-291-5/+0
| | | | | | | | | | | The retrograde motion was confused by some positions coming from the DSP on offloaded tracks. So the retrograde check was moved up into AudioTrack.cpp. This allows us to take advantage of the checks for invalid positions based on timing. Bug: 2047891 Change-Id: Ifcad2349201443a7f1711347c203297100449536 Signed-off-by: Phil Burk <philburk@google.com>
* audio flinger: improve device to device audio patchesEric Laurent2015-04-081-0/+1
| | | | | | | Allow creation of audio patches between input and output devices managed by the same audio HW module. Change-Id: I4b83268a4d5c41f3d5905d7581202cf5193efd32
* AudioFlinger: prevent retrograde timestamps for direct modePhil Burk2015-03-231-2/+3
| | | | | | | | | Prevent retrograde motion in the HAL or drivers from making it up through the AudioFlinger to the app. Bug: 19604395 Change-Id: I11d6c0f7cab69e75fd4b4a2a90f64960b4bb6d5a Signed-off-by: Phil Burk <philburk@google.com>
* Allow duplicating thread to use native mixing audio formatAndy Hung2015-01-151-2/+2
| | | | | | | Update OutputTrack to take variable formats. Previously conversion to AUDIO_FORMAT_PCM_16_BIT was required. Change-Id: I4a96a60ddd8d8dfe651405a0bcd4f98c89bc1ade
* audio flinger: add patch connection between hw modulesEric Laurent2014-07-241-8/+34
| | | | | | | | | | | | | | | | | | 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
* AudioTrack: add support for compressed audioEric Laurent2014-06-191-0/+1
| | | | | | | | | Add support for compressed audio playback by use of an AudioTrack attached to a direct output thread. Bug: 9428304. Change-Id: I4a61be9cf0e31003ca85935d6e0ee38ca8192e03
* Fix non-monotonic AudioTrack::getTimestamp after pauseGlenn Kasten2014-06-101-0/+6
| | | | | Bug: 15523502 Change-Id: Ifd4aa7fca197bc041c1620fc3f7d953a8902551a
* Pass stereo gains as packed minifloatGlenn Kasten2014-05-191-1/+1
| | | | | | | | | | 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
* Pull up mFlags and isFastTrack from Track to TrackBaseGlenn Kasten2014-05-131-3/+0
| | | | Change-Id: I6bd48292310be4e05758a11f617f50585904422d
* audioflinger: Handle pause /resume in stopping stateKrishnankutty Kolathappilly2014-03-171-0/+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>
* Pretty up audioflinger dumpsysMarco Nelissen2014-02-101-1/+1
| | | | Change-Id: I57e44b4c36b99f7149542bbcf9645521c6152dfa
* AudioFlinger: Modify flush handling for offload pathHaynes Mathew George2014-02-061-0/+3
| | | | | | | | | 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
* Assign blame for playback wakelocks.Marco Nelissen2013-10-251-3/+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 3424d6e1: am 1adf20ce: Merge "fix volume and effect enable delay on ↵Eric Laurent2013-10-011-0/+1
|\ | | | | | | | | | | | | offloaded tracks" into klp-dev * commit '3424d6e17637e0743ddf3bf4688af8ee36e69264': fix volume and effect enable delay on offloaded tracks
| * fix volume and effect enable delay on offloaded tracksEric Laurent2013-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Volume: add a method to wake up the mediaserver playback thread when a volume command is received on an offloaded track. Effects: call effect chain process on offloaded playback threads asynchronously from writes to allow effect state updates while waiting for async write callback. Bug: 10796540. Change-Id: Id2747ae88783575d1d7ffd6fc86fbd054ab2c739
* | am 8a220740: am dc33c542: Merge "Fix AudioTrack shared memory leak" into klp-devGlenn Kasten2013-09-121-1/+4
|\ \ | |/ | | | | | | * commit '8a220740cd77eb844123d3914190a94513797b40': Fix AudioTrack shared memory leak
| * Fix AudioTrack shared memory leakGlenn Kasten2013-09-111-1/+4
| | | | | | | | | | Bug: 2801375 Change-Id: I50e15164fe310f69ea019dca5b49171a02bc6992
* | am a4a82c5f: am 6466c9e6: Add ExtendedAudioBufferProvider::framesReleased ↵Glenn Kasten2013-09-031-0/+2
|\ \ | |/ | | | | | | | | | | and onTimestamp * commit 'a4a82c5f8f3eccfa10ce30a52cbb4b1c5c983282': Add ExtendedAudioBufferProvider::framesReleased and onTimestamp
| * Add ExtendedAudioBufferProvider::framesReleased and onTimestampGlenn Kasten2013-09-031-0/+2
| | | | | | | | | | | | | | and implement them in SourceAudioBufferProvider using the associated NBAIO_Source, and in Track using the associated AudioTrackServerProxy. Change-Id: I60dc4adba63fc1dc452ff16caf347e4a7c8242c2
* | am 3ae0a58a: am 9841f636: Merge "Add ↵Glenn Kasten2013-08-291-0/+1
|\ \ | |/ | | | | | | | | | | AudioFlinger::PlaybackThread::Track::getTimestamp()" into klp-dev * commit '3ae0a58a83d092d96672295c8a62908478f28a9b': Add AudioFlinger::PlaybackThread::Track::getTimestamp()
| * Add AudioFlinger::PlaybackThread::Track::getTimestamp()Glenn Kasten2013-08-291-0/+1
| | | | | | | | | | | | | | with a dummy implementation initially, and use it in AudioFlinger::TrackHandle::getTimestamp() Change-Id: I2da88fc52a135a7f0d9fd9538986e919dc8ccd3b
* | 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
* Report underruns for fast tracks alsoGlenn Kasten2013-07-311-1/+0
| | | | | | | | | | | | | | | | | | | | | | | This fixes a regression that was introduced earlier by commit 9f80dd223d83d9bb9077fb6baee056cee4eaf7e5 called "New control block for AudioTrack and AudioRecord". That commit broke underrun reporting for fast tracks. Also remove Track::mUnderrunCount, which counted the number of underrun events, and was only used by dumpsys media.audio_flinger. Now dumpsys media.audio_flinger reports the number of underrun frames, Isolated underrun-related control block accesses via the proxy, so that the server is not directly poking around in the control block. The new proxy APIs are AudioTrackServerProxy::getUnderrunFrames() and AudioTrackServerProxy::tallyUnderrunFrames(). getUnderrunFrames() returns a rolling counter for streaming tracks, or zero for static buffer tracks which never underrun, but do a kind of 'pause' at end of buffer. tallyUnderrunFrames() increments the counter by a specified number of frames. Change-Id: Ib31fd73eb17cbb23888ce3af8ff29f471f5bd5a2
* Move control block mName to createTrack() outputGlenn Kasten2013-07-301-0/+1
| | | | | | | This is part of a series of CLs to clean up the shared memory control block, by removing any fields that don't have to be there. Change-Id: I6e51003a1293b6800258c31b22cff2eba42162e7
* AudioFlinger: offload playback, non-blocking writeEric Laurent2013-07-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | - 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-4/+3
| | | | | | | | 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-9/+3
| | | | | | | | | | 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
* Start isolating control block accesses in a proxyGlenn Kasten2012-12-121-2/+1
| | | | | | | | | | | | | | | | | | | | | 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
* Prepare for track invalidation to be done by proxyGlenn Kasten2012-12-121-0/+3
| | | | | | | Don't rely on control block to determine whether track has been marked invalid. Instead, use a local flag that can't be corrupted by client. Change-Id: I783dafe828f93c1c3d2d0e5a08105ea536436efb
* AudioTrack::mute() is unused so remove itGlenn Kasten2012-12-031-7/+0
| | | | | | | If ever needed again, it could be implemented on client side by forcing a track volume of 0. Change-Id: I88a9b4f675b6dca2948549414f9ec2c192d29269
* AudioFlinger files reorganizationEric Laurent2012-11-191-0/+285
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