summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use new channel count functions for audio masksAndy Hung2014-05-161-1/+1
| | | | | Change-Id: Ia658ab4b6320d19fdb50f123c930918724ff0ef3 Signed-off-by: Andy Hung <hunga@google.com>
* Add client side support for more AUDIO_FORMAT_PCM_*Glenn Kasten2014-05-071-7/+19
| | | | | | | As much as possible, the checks for specific formats are done on server side. The only exception is 8-bit, which needs a client side workaround. Change-Id: I52fe086c039460c8dac009de03b67eb54c56a836
* Fix bug for direct track with PCM != 16-bitGlenn Kasten2014-05-021-1/+2
| | | | | | | | | | | | The AUDIO_FORMAT_PCM_8_BIT format was being converted to AUDIO_FORMAT_PCM_16_BIT on client side even for direct tracks. That conversion was incorrect; it should only be done for mixed tracks. Also remove checks for specific PCM formats in the generic part of server side of createTrack. Those format checks should only be done by the thread. This will allow direct tracks for PCM 8-bit, PCM 24-bit, etc. Change-Id: If5b9fd79f8642ed93e2aeabcaf4809b2ed798978
* Use AUDIO_INTERLEAVE_* constantsGlenn Kasten2014-04-301-1/+1
| | | | Change-Id: I6609fa75c9a57fc4ca3887d626a2f4fb8b6593a1
* Use symbol AUDIO_IO_HANDLE_NONE from <system/audio.h>Glenn Kasten2014-03-261-5/+5
| | | | Change-Id: Id6b1aa17558eb73e17f22b8eab6cd02e00a96dff
* Merge "Use symbolic constants from <system/audio.h>"Glenn Kasten2014-03-261-6/+6
|\
| * Use symbolic constants from <system/audio.h>Glenn Kasten2014-03-251-6/+6
| | | | | | | | | | | | | | | | AUDIO_INTERLEAVE_* AUDIO_STREAM_MIN AUDIO_SESSION_ALLOCATE Change-Id: I31dd6f327204685e50716079ce21c4ba206dff11
* | Merge "Remove streamType parameter from AudioSystem::getLatency()"Glenn Kasten2014-03-261-1/+1
|\ \
| * | Remove streamType parameter from AudioSystem::getLatency()Glenn Kasten2014-03-251-1/+1
| |/ | | | | | | Change-Id: Ie7346e93436ddc215cad7d16be555dcb6c277d54
* | Remove dead codeGlenn Kasten2014-03-261-20/+0
|/ | | | Change-Id: I0878d11451c7bbbf96b59f5fe0cd97ba1f033aa9
* Remove name output parameter from createTrackGlenn Kasten2014-03-141-3/+1
| | | | | | | It was only used for one log. A better solution will be a per-track unique ID. Change-Id: Ia440e02ae4a5a4019a9a2d08970e1ee93ac4c3a3
* Merge "AudioTrack non-blocking write"Jean-Michel Trivi2014-03-111-2/+3
|\
| * AudioTrack non-blocking writeJean-Michel Trivi2014-03-031-2/+3
| | | | | | | | | | | | Bug 7531968 Change-Id: I6d0e79fa8cab5b6eb36bcc34977f4cf0d7eec8ea
* | Fix freeze on pauseMarco Nelissen2014-03-101-1/+1
| | | | | | | | | | | | | | isOffloaded() tries to lock mLock again. We should be calling isOffloaded_l() b/13394633 Change-Id: I155be6fee937f894d8e6c974e593223ab6014ade
* | Merge "Simplify AudioTrack stream end and fix race"Glenn Kasten2014-03-071-17/+15
|\ \
| * | Simplify AudioTrack stream end and fix raceGlenn Kasten2013-09-291-17/+15
| | | | | | | | | | | | | | | Bug: 10994052 Change-Id: Ib2e38e7a600bcffef8cbc68c1722e40fbbc7ea67
* | | AudioTrack: When paused, return cached playback positionHaynes Mathew George2014-03-061-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An offload output can be re-used between two audio tracks having the same configuration. A timestamp query for a paused track while the other is running would return an incorrect time. To fix this, cache the playback position on a pause() and return this time when requested until the track is resumed. Bug: 12826612. Change-Id: I324112ea9827e52fff53ef44cd8513c8d85a0bc4
* | | Merge "Make openRecord_l more like createTrack_l for fast tracks: part 1"Glenn Kasten2014-02-281-2/+2
|\ \ \
| * | | Make openRecord_l more like createTrack_l for fast tracks: part 1Glenn Kasten2014-02-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the transfer mode to distinguish use cases, as the presence of a callback handler is not sufficient. For example, the track could be configured for synchronous transfer with write() or read(), and also have a callback handler for position updates. But that does not mean the track can operate in fast track mode. Change-Id: I2a7f1f0ca98e68efe180b524496985109d8ce291
* | | | Fix type of AudioTrack/AudioRecord parameter frameCountGlenn Kasten2014-02-281-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | It's size_t consistently Change-Id: I29638ef59ac773218025f2403a3508a307b487e0
* | | | Fix type of AudioTrack/AudioRecord parameter notificationFramesGlenn Kasten2014-02-281-5/+5
|/ / / | | | | | | | | | | | | | | | It's uint32_t consistently Change-Id: If8298c7e9aeea2b951fe47b675adbdf48d104846
* | | Simplify error handling after track creationGlenn Kasten2014-02-251-1/+3
| | | | | | | | | | | | | | | | | | | | | IAudioFlinger::createTrack and IAudioFlinger::openRecord both guarantee that (status == OK) == (sp<> != 0). Change-Id: I91cb4f7e843019efb65cace7ba146f7da7aa5b59
* | | Unify comments and whitespace between AudioTrack and AudioRecordGlenn Kasten2014-02-241-0/+3
| | | | | | | | | | | | Change-Id: I5320a6b2d7f7077cb12d7da4f2ca30a940100bf2
* | | Update channel fields at same place in AudioTrack and AudioRecordGlenn Kasten2014-02-241-4/+3
| | | | | | | | | | | | Change-Id: I4b649feeef47e7968a9fa3a460217017ca9b05fe
* | | Add log at entry to set() in AudioTrack and AudioRecordGlenn Kasten2014-02-241-0/+5
| |/ |/| | | | | Change-Id: Ife23b88474c1d62c0cf682c1a310d951f2c0f54a
* | Track pid for each sessionMarco Nelissen2014-02-111-8/+21
| | | | | | | | | | | | so they can be properly freed. Change-Id: I6f389035bc29e74e7c367c1c6d0252b180f666b3
* | resolved conflicts for merge of 566be7c3 to masterNarayan Kamath2014-02-111-4/+4
|\ \ | | | | | | | | | Change-Id: I7b1cc71057b2bd4f771e7bcf508a8c3abd6017ce
| * | Make frameworks/av 64-bit compatibleKévin PETIT2014-02-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 build after merge from AOSPGlenn Kasten2014-02-101-8/+4
| | | | | | | | | | | | Change-Id: I1cd3432c02db1600e49ade67e6a89e39e7a8d3ed
* | | am 4e12dade: am 4361749d: Merge "AudioTrack: Never try to use the fast path ↵Glenn Kasten2014-02-101-0/+6
|\ \ \ | |/ / | | | | | | | | | | | | | | | 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-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | AudioTrack: fix position callback after restoreEric Laurent2013-12-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When restoring an AudioTrack, the next position callback point should not be modified and set ahead of current buffer head. Otherwise, as frames are dropped, the new position is never reached and an application relying on position callbacks to reload the buffer would be stalled. Bug: 11868603. Change-Id: I93b2a311642a0c89944b78bcc0482d4ceed98ae4
| * | update offloaded audio track sampling rateEric Laurent2013-12-171-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | AudioPlayer must read the sampling rate from offloaded audio sinks whenever a new time position is computed as the decoder can update the sampling rate on the fly. Change-Id: I997e5248cfd4017aeceb4e11689324ded2a5bc88
* | | Use printf format %#x for audio_format_t in logsGlenn Kasten2014-02-071-1/+1
| | | | | | | | | | | | Change-Id: I1c611d1037685d52ccc84efe0fccd6413ec938e9
* | | AudioTrack: fix obtainBuffer timeout calculationEric Laurent2014-01-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AudioTrack::obtainBuffer() passes a pointer to a timeout variable that has gone out of scope when calling ClientProxy::obtainBuffer(). Same fix for AudioRecord. Bug: 11968591. Change-Id: I22af8f94fa2f8cc54ab5c25c89167c805e754317
* | | Remove the redundant parameters from createTrack_l()Glenn Kasten2014-01-241-62/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AudioRecord::openRecord_l() code was refactored earlier to remove the redundant parameters: > Change-Id: I124dce344b1d11c2dd66ca5e2c9aec0c52c230e2 This changelist refactors AudioTrack similarly. Change-Id: Iefd2bd662870ea81d04eff7b7c26f9c8b0dadd26
* | | Refactor code related to I/O handles to reduce chance for leaksGlenn Kasten2014-01-241-42/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The AudioRecord input handle code was refactored earlier to fix a potential handle leak, and to simplify the code: > Change-Id: I124dce344b1d11c2dd66ca5e2c9aec0c52c230e2 This changelist refactors AudioTrack similarly, and adds further cleanup of both AudioTrack and AudioRecord. We attempt to implement the rules for referencing counting I/O handles, but there is still the possibility of a handle leak if the client process dies after allocating the handle reference but before releasing it. That issue is being tracked separately. Details: - AudioSystem::getOutput() is now called within createTrack_l - restoreTrack_l was missing offload info now it has the info available, but is not yet being called for offloaded tracks - AudioTrack::getOutput() is now const - Remove getOutput_l() Change-Id: I44a0a623d24fc5847bcac0939c276400568adbca
* | | Merge "Replace control block frameCount_ by explicit in/out parameter"Glenn Kasten2014-01-241-2/+4
|\ \ \
| * | | Replace control block frameCount_ by explicit in/out parameterGlenn Kasten2013-12-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | in IAudioFlinger::createTrack and IAudioFlinger::openRecord Change-Id: I09c644c80e92c8e744b1b99055988a2588b2a83d
* | | | Merge "Make copy of audio_offload_info_t for future use"Glenn Kasten2014-01-171-0/+10
|\ \ \ \
| * | | | Make copy of audio_offload_info_t for future useGlenn Kasten2014-01-161-0/+10
| | | | | | | | | | | | | | | | | | | | Change-Id: I515970aa0660418d5d1640fb1bf477e112c89bdd
* | | | | Merge "Move up initialization of mFormat, mStreamType, and mSharedBuffer ↵Glenn Kasten2014-01-171-3/+7
|\ \ \ \ \ | |/ / / / | | | | | | | | | | earlier"
| * | | | Move up initialization of mFormat, mStreamType, and mSharedBuffer earlierGlenn Kasten2014-01-161-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will allow removal of most of the parameter list to createTrack_l. Also check for valid stream type at client so we can log a better error message. Change-Id: Ia7176896d47fbb49106119fca26d9de8e7efe859
* | | | | Merge "Cleanup createTrack error handling"Glenn Kasten2014-01-171-1/+6
|\ \ \ \ \ | |/ / / /
| * | | | Cleanup createTrack error handlingGlenn Kasten2014-01-161-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to cleanup done earlier for openRecord in this CL: > Change-Id: I84897dd7d30b370640b54e928f230604b873cb68 Bug: 10888816 Change-Id: I804a47f898e0319a60a9bd58906bbb037e45cc25
* | | | | Merge "Remove dead code in AudioTrack::processAudioBuffer"Glenn Kasten2014-01-171-1/+0
|\ \ \ \ \
| * | | | | Remove dead code in AudioTrack::processAudioBufferGlenn Kasten2014-01-161-1/+0
| |/ / / / | | | | | | | | | | | | | | | Change-Id: I0baefe9dc08bb5ec45d34698fc764caa160789d2
* | | | | Merge "Improve logs in AudioTrack::getMinFrameCount"Glenn Kasten2014-01-171-0/+6
|\ \ \ \ \
| * | | | | Improve logs in AudioTrack::getMinFrameCountGlenn Kasten2014-01-161-0/+6
| |/ / / / | | | | | | | | | | | | | | | Change-Id: I8b478e6abdded26a43f32c131931939e9ae36fd7
* | | | | Merge "Unify comments between AudioTrack and AudioRecord"Glenn Kasten2014-01-171-2/+3
|\ \ \ \ \ | |/ / / / |/| | | |