summaryrefslogtreecommitdiffstats
path: root/include/media/AudioTrack.h
Commit message (Collapse)AuthorAgeFilesLines
* 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
|\ \
| * | Make AudioRecord and AudioTrack comments more similarGlenn Kasten2013-08-021-1/+3
| |/ | | | | | | Change-Id: I122a7cf7bfc162090cb27f37c325db7a23985bc7
* | Remove default parameters for AudioTrackGlenn Kasten2013-08-021-11/+11
|/ | | | | | The defaults aren't needed; all users must know these values. Change-Id: I0c1c97cb80bfea8e69a7cfa53ec85a91a8d48bb5
* 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
* libmedia: offloaded playback supportRichard Fitzgerald2013-07-251-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | - start() returns a status so that upper layers can recreate a non offloaded track in case of error. - Added states to handle offloaded tracks specific: - waiting for stream end (drain) notification by audio flinger - allow pause while waiting for stream end notification - getPosition() queries the render position directly from audio HAL. - disable APIs not applicable to offloaded tracks - Modified track restoring behavior for invalidated offloaded tracks: just send the callback and wait for upper layers to create a new track. - Added wait for stream end management in audio track client proxy. Similar to obtainBuffer and should be factored in. Change-Id: I0fc48117946364cb255afd653195498891f622bd Signed-off-by: Eric Laurent <elaurent@google.com>
* Add commentsGlenn Kasten2013-07-101-0/+2
| | | | Change-Id: Ifbf3a46a4183c8abc0feee1c588953ab10303cc1
* Public API changes for audio offload support.Richard Fitzgerald2013-06-271-3/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: this does _not_ include all private member variables added to classes as part of offload support. Only public/protected functions and stubs functions/variables needed to make the changes buildable. - isOffloadSupported() added to audio policy service A stub implementation is required to build, this always returns false - setParameters() added to IAudioTrack A stub implementation is required to build, this always returns INVALID_OPERATION - CBlk flag for stream end - Change AudioSystem::getRenderPosition() to take an audio_output_t so caller can specify which output to query - Add AudioSystem::isOffloadSupported() This is fully implemented down to the AudioFlinger function AudioPolicyServer::isOffloadSupported() which is just a stub that always returns false. - Add EVENT_STREAM_END to AudioTrack interface. STREAM_END is used to signal when the hardware has actually finished playing all the data it was sent. - Add event type enumeration to media player interface AudioSink callbacks so that the same callback can be used to handle multiple types of event. For offloaded tracks we also have to handle STREAM_END and TEAR_DOWN events - Pass audio_offload_info_t to various functions used for opening outputs, tracks and audio players. This passes additional information about the compressed stream down to the HAL when using offload. For publicly-available APIs this is an optional parameter (for some of the internal and low-level APIs around the HAL interface it is mandatory) - Add getParameters() and setParameters() API to AudioTrack Currently dummy implementations. - Change AudioPlayer contructor so that it takes a set of bitflags defining what options are required. This replaces the original bool which only specified whether to use deep buffering. - Changes to StageFright class definition related to handling tearing-down of an offloaded track when we need to switch back to software decode - Define new StageFright utility functions used for offloaded tracks Currently dummy implementations. - AudioFlinger changes to use extended audio_config_t. Fills in audio_offload_info_t member if this info is passed in when opening an output. - libvideoeditor changes required to add the new event type parameter to AudioSink callback functions - libmediaplayerservice changes required to add the new event type parameter to AudioSink callback functions Change-Id: I3ab41138aa1083d81fe83b886a9b1021ec7320f1 Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Eric Laurent <elaurent@google.com>