summaryrefslogtreecommitdiffstats
path: root/include/media/AudioTrack.h
Commit message (Collapse)AuthorAgeFilesLines
* audio policy: new getOutputForAttr() prototype.Eric Laurent2014-11-251-5/+6
| | | | | | | | | | | | | | | | | | | | | | | Update getOutputForAttr() prototype and group all logic dealing with audio attributes to stream type conversion in audio policy manager. getOutputForAttr(): - specifies the audio session (for future use) - returns a status code - receives either stream type (for legacy) or audio attributes - returns an updated streamtype Remove logic dealing with legacy stream types to attributes conversion from AudioTrack. Use correct type for audio sessions in other APIs (startOutput() ...). releaseOutput() specifies the audio session (for future use). Bug: 18067208. Change-Id: I1bfbe9626c04c7955d77f8a70aecfad2cb204817
* Fix AudioTrack offloaded timestamp handling.Andy Hung2014-09-171-1/+10
| | | | | | | | | | getTimestamp for offloaded tracks now returns WOULD_BLOCK for situations where the timestamp is unavailable due to the previous track still flushing or the timestamp is stale. It is fixed for normal playback conditions. Bug: 14659809 Bug: 17428188 Change-Id: Ic9ec07ccabc604236979769db5c4ea2dec252660
* Clean up AudioTrack position and timestamp handlingGlenn Kasten2014-09-111-2/+18
| | | | | | | | | | | | | | | | | | | Replace epoch concept by observing and accumulating server delta positions. The advantage of using server deltas instead of absolute values is that they (1) are not sensitive to 32-bit wraparound, (2) are not sensitive to server behavior for stop(), and (3) prepare for future 64-bit client positions without requiring 64-bit positions on server. Add comments to AudioTrack::getTimestamp() and friends that the timestamp output parameter is undefined on error. Don't allow getTimestamp to return a negative frame position after stop(). Accumulate the client released frames, which may be useful for a future API. Bug: 11815245 Change-Id: I652940fa2db2f34a78c012a3ead0d9204fa29c6e
* Support for audio attributes on audio output of media playerJean-Michel Trivi2014-07-011-3/+5
| | | | Change-Id: Iae4995c98e64add1ab9e6c8ae6501515032755f5
* AudioTrack: add support for compressed audioEric Laurent2014-06-191-0/+9
| | | | | | | | | Add support for compressed audio playback by use of an AudioTrack attached to a direct output thread. Bug: 9428304. Change-Id: I4a61be9cf0e31003ca85935d6e0ee38ca8192e03
* AudioTrack construction with audio attributesJean-Michel Trivi2014-06-171-1/+8
| | | | | | | | | | | | Store audio attributes in AudioTrack class. When an AudioTrack is "set" with non null audio attributes, derive a stream type that reflects the attributes. When an AudioTrack is "set" without attributes, and only has a stream type, derive default audio attributes. Change-Id: I322b91fa9a7e193118960c5e78cdddd85d66f9ad
* Add client side support for more AUDIO_FORMAT_PCM_*Glenn Kasten2014-05-071-2/+3
| | | | | | | 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
* Merge "Use symbol AUDIO_IO_HANDLE_NONE from <system/audio.h>"Glenn Kasten2014-03-261-1/+2
|\
| * Use symbol AUDIO_IO_HANDLE_NONE from <system/audio.h>Glenn Kasten2014-03-261-1/+2
| | | | | | | | Change-Id: Id6b1aa17558eb73e17f22b8eab6cd02e00a96dff
* | Update commentsGlenn Kasten2014-03-261-10/+2
|/ | | | Change-Id: I5776313b9b49072cd666d28880f0d07cc73f827b
* Use symbolic constants from <system/audio.h>Glenn Kasten2014-03-251-5/+0
| | | | | | | | AUDIO_INTERLEAVE_* AUDIO_STREAM_MIN AUDIO_SESSION_ALLOCATE Change-Id: I31dd6f327204685e50716079ce21c4ba206dff11
* Remove name output parameter from createTrackGlenn Kasten2014-03-141-1/+0
| | | | | | | 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-1/+4
|\
| * AudioTrack non-blocking writeJean-Michel Trivi2014-03-031-1/+4
| | | | | | | | | | | | Bug 7531968 Change-Id: I6d0e79fa8cab5b6eb36bcc34977f4cf0d7eec8ea
* | AudioTrack: When paused, return cached playback positionHaynes Mathew George2014-03-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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
* | Fix type of AudioTrack/AudioRecord parameter frameCountGlenn Kasten2014-02-281-3/+3
| | | | | | | | | | | | It's size_t consistently Change-Id: I29638ef59ac773218025f2403a3508a307b487e0
* | Fix type of AudioTrack/AudioRecord parameter notificationFramesGlenn Kasten2014-02-281-3/+3
|/ | | | | | It's uint32_t consistently Change-Id: If8298c7e9aeea2b951fe47b675adbdf48d104846
* Track pid for each sessionMarco Nelissen2014-02-111-3/+7
| | | | | | so they can be properly freed. Change-Id: I6f389035bc29e74e7c367c1c6d0252b180f666b3
* Fix clang warnings in AudioFlingerGlenn Kasten2014-02-101-1/+1
| | | | Change-Id: I0fa61025c979709ad7d655bc717df5f194b6089e
* Remove the redundant parameters from createTrack_l()Glenn Kasten2014-01-241-7/+1
| | | | | | | | | | 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-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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 "Make copy of audio_offload_info_t for future use"Glenn Kasten2014-01-171-0/+3
|\
| * Make copy of audio_offload_info_t for future useGlenn Kasten2014-01-161-0/+3
| | | | | | | | Change-Id: I515970aa0660418d5d1640fb1bf477e112c89bdd
* | Merge "Move up initialization of mFormat, mStreamType, and mSharedBuffer ↵Glenn Kasten2014-01-171-1/+1
|\ \ | |/ | | | | earlier"
| * Move up initialization of mFormat, mStreamType, and mSharedBuffer earlierGlenn Kasten2014-01-161-1/+1
| | | | | | | | | | | | | | | | | | 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 "Unify comments between AudioTrack and AudioRecord"Glenn Kasten2014-01-171-3/+4
|\ \ | |/ |/|
| * Unify comments between AudioTrack and AudioRecordGlenn Kasten2014-01-141-6/+8
| | | | | | | | Change-Id: I00a1025e2891a1c96218b3c2187eaddda6614ebc
* | Merge "Document AudioTrack mFrameCount and mReqFrameCount better"Glenn Kasten2014-01-151-3/+4
|\ \
| * | Document AudioTrack mFrameCount and mReqFrameCount betterGlenn Kasten2014-01-101-3/+4
| | | | | | | | | | | | | | | | | | and remove unnecessary initialization of mFrameCount in set(). Change-Id: I9effeb0a6dd035ca02fe77f6992c55d9515b4df6
* | | Merge "Use AUDIO_SESSION_ALLOCATE instead of 0"Glenn Kasten2014-01-151-3/+3
|\ \ \ | |_|/ |/| |
| * | Use AUDIO_SESSION_ALLOCATE instead of 0Glenn Kasten2013-12-201-3/+3
| | | | | | | | | | | | | | | | | | | | | Also fix a couple of places where we were using AUDIO_SESSION_OUTPUT_MIX, which happens to also be equal to 0, but has a different meaning. Change-Id: I90e39be3b89f5021a96d9e3b8d10929013ca977f
* | | Document locking rules for mFlags, and fix discrepanciesGlenn Kasten2014-01-141-2/+7
| | | | | | | | | | | | Change-Id: Id45ba544cc84133ed5e578fb4fd8a11b62211dc1
* | | Remove obsolete AudioTrack::processStreamEnd()Glenn Kasten2014-01-131-2/+0
| |/ |/| | | | | Change-Id: I7c01b9d2e109acf8c393d2c3b7b1985f6647d96c
* | Cleanup AudioTrack::getMinFrameCount error handlingGlenn Kasten2014-01-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Guarantee to return a non-zero frameCount for return status NO_ERROR; Return the correct specific status_t if any of the AudioSystem APIs fail, instead of the generic NO_INIT. API change: getMinFramCount no longer defaults to zero on error, so callers _must_ check the return status. This change makes getMinFrameCount more like other APIs. All known callers were reviewed, and they do check the return status. Change-Id: I4a8342a75ee89a068c23c84b8380ed9d1b968507
* | Fix some (but not all) unused parameter warningsGlenn Kasten2013-12-191-1/+1
|/ | | | Change-Id: Ia99e23a0b46db3f3e6aa46f9018e63c14f4af369
* update offloaded audio track sampling rateEric Laurent2013-11-221-1/+1
| | | | | | | | 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
* 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 b2059ff3: am f8f15b05: Merge "Fix race condition in AudioTrack::pause ↵Glenn Kasten2013-10-161-0/+1
|\ | | | | | | | | | | | | followed by start" into klp-dev * commit 'b2059ff384eee8ffb70a7ec8fc5570405201c734': Fix race condition in AudioTrack::pause followed by start
| * Fix race condition in AudioTrack::pause followed by startGlenn Kasten2013-10-161-0/+1
| | | | | | | | | | Bug: 11148722 Change-Id: Iec88f00c8510363d4418e4b8d5b34feb06ecf04d
* | am f2c643c8: am 3b3cfcfa: Merge "Fix slow AudioTrack and AudioRecord ↵Glenn Kasten2013-09-201-4/+6
|\ \ | |/ | | | | | | | | | | destruction" into klp-dev * commit 'f2c643c89e405b57c7ce42067b876fb80031e5fa': Fix slow AudioTrack and AudioRecord destruction
| * Fix slow AudioTrack and AudioRecord destructionGlenn Kasten2013-09-201-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two causes for the slowness: When thread was paused, it used nanosleep and sleep. These usually run to completion (except for POSIX signal, which we avoid because it is low-level). Instead, replace the nanosleep and sleep by condition timed wait, as that can be made to return early by a condition signal. Another advantage of condition timed wait is that a condition wait was already being used at top of thread loop, so it is a simpler change. The AudioRecord destructor was missing a proxy interrupt that was correct in AudioTrack. This proxy interrupt is needed in case another thread is blocked in proxy obtainBuffer. Does not address the 1 second polling for NS_WHENEVER. Bug: 10822765 Change-Id: Id665994551e87e4d7da9c7b015f424fd7a0b5560
* | am f94b2946: am 56b59224: Merge "Add IAudioTrack::getTimestamp()" into klp-devGlenn Kasten2013-08-291-2/+3
|\ \ | |/ | | | | | | * commit 'f94b2946a511c5cbb6b9001449ca8278cb332bda': Add IAudioTrack::getTimestamp()
| * Add IAudioTrack::getTimestamp()Glenn Kasten2013-08-291-2/+3
| | | | | | | | | | | | | | | | | | | | with dummy implementation in AudioFlinger::TrackHandle, and implement AudioTrack::getTimestamp() using IAudioTrack. Also document invariant that mAudioTrack and control block are always non-0 after successful initialization. Change-Id: I9861d1454cff7decf795d5d5898ac7999a9f3b7e
* | am 73e4f3d4: am 865f6f24: Merge "New AudioTrack C++ API for audio ↵Glenn Kasten2013-08-291-0/+16
|\ \ | |/ | | | | | | | | | | timestamps" into klp-dev * commit '73e4f3d44f7022b03943ae34f08363e049e4b46f': New AudioTrack C++ API for audio timestamps
| * New AudioTrack C++ API for audio timestampsGlenn Kasten2013-08-281-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new API is intended to replace latency(), especially for A/V sync. The application will receive periodic timestamp notifications. The period is unspecified, but will likely be more frequent after a pause or stop, set position, underrun, display on/off change, route change, or when audio framework notices drift. It will be up to the higher level application (e.g. Stagefright) to reconstruct a clock that updates more frequently. The current latency() method doesn't indicate when latency changes due to screen on/off state, route changes, etc. Includes squahsed change-Id: I2082f8752040be0c234b1a6f1be2e269abf2ce7c Dummy implementation of AudioTrack:getTimestamp() Rename AudioTrack::Timestamp to AudioTimestamp. Renaming and pulling up to a higher level allows more modules to use it. Change-Id: Ibf7f6a207c3f8d8697f25ede2cd5200697fadb86 (cherry picked from commit dd69eb893867634fd169c03204a6ad7c74b351e7)
* | WhitespaceGlenn Kasten2013-08-131-1/+0
| | | | | | | | Change-Id: Id3ccc183a03421330d0498faaa62a45915cdc3d6
* | CommentsGlenn Kasten2013-08-131-1/+2
|/ | | | Change-Id: I56f82904cb3855bad6f33ad1ff4ddf66a61c5720
* Merge "Cleanup comments for the new control block implementation"Glenn Kasten2013-08-071-15/+3
|\
| * Cleanup comments for the new control block implementationGlenn Kasten2013-08-021-15/+3
| | | | | | | | | | | | | | | | There was some obsolete and incomplete text left over after the new control block code was submitted. This cleans up all those comments to be accurate again. Change-Id: Ic52f5869cb723cde25d709514d6deea6aa6f20aa
* | Merge "Make AudioRecord and AudioTrack comments more similar"Glenn Kasten2013-08-051-1/+3
|\ \