diff options
author | Glenn Kasten <gkasten@google.com> | 2013-08-29 09:01:02 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2013-08-29 09:19:07 -0700 |
commit | 53cec22821072719ee02c856e9ac2dda2496c570 (patch) | |
tree | 1ac72eaf3ba6059680f8c3d7e39ae58a9e03adc8 /include/media | |
parent | ce70374bf105f8a6160bf5dd70affea012b2a464 (diff) | |
download | frameworks_av-53cec22821072719ee02c856e9ac2dda2496c570.zip frameworks_av-53cec22821072719ee02c856e9ac2dda2496c570.tar.gz frameworks_av-53cec22821072719ee02c856e9ac2dda2496c570.tar.bz2 |
Add IAudioTrack::getTimestamp()
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
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/AudioTrack.h | 5 | ||||
-rw-r--r-- | include/media/IAudioTrack.h | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index ebb7ef3..453c106 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -227,6 +227,7 @@ public: * - INVALID_OPERATION: AudioTrack is already initialized * - BAD_VALUE: invalid parameter (channelMask, format, sampleRate...) * - NO_INIT: audio server or audio hardware not initialized + * If status is not equal to NO_ERROR, don't call any other APIs on this AudioTrack. * If sharedBuffer is non-0, the frameCount parameter is ignored and * replaced by the shared buffer's total allocated size in frame units. * @@ -249,7 +250,7 @@ public: transfer_type transferType = TRANSFER_DEFAULT, const audio_offload_info_t *offloadInfo = NULL); - /* Result of constructing the AudioTrack. This must be checked + /* Result of constructing the AudioTrack. This must be checked for successful initialization * before using any AudioTrack API (except for set()), because using * an uninitialized AudioTrack produces undefined results. * See set() method above for possible return codes. @@ -646,7 +647,7 @@ protected: bool isOffloaded() const { return (mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != 0; } - // may be changed if IAudioTrack is re-created + // Next 3 fields may be changed if IAudioTrack is re-created, but always != 0 sp<IAudioTrack> mAudioTrack; sp<IMemory> mCblkMemory; audio_track_cblk_t* mCblk; // re-load after mLock.unlock() diff --git a/include/media/IAudioTrack.h b/include/media/IAudioTrack.h index 1014403..afac4ae 100644 --- a/include/media/IAudioTrack.h +++ b/include/media/IAudioTrack.h @@ -26,6 +26,7 @@ #include <binder/IMemory.h> #include <utils/LinearTransform.h> #include <utils/String8.h> +#include <media/AudioTimestamp.h> namespace android { @@ -86,6 +87,9 @@ public: /* Send parameters to the audio hardware */ virtual status_t setParameters(const String8& keyValuePairs) = 0; + + /* Return NO_ERROR if timestamp is valid */ + virtual status_t getTimestamp(AudioTimestamp& timestamp) = 0; }; // ---------------------------------------------------------------------------- |