diff options
author | Andy Hung <hunga@google.com> | 2014-09-12 14:43:11 -0700 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2014-09-17 23:07:05 +0000 |
commit | 7f1bc8af1c46695191bf7e2aba6467f3616629c0 (patch) | |
tree | 905b0091037bea59f81df3cc6e49c2cfd1d7d24d /include/media/AudioTrack.h | |
parent | 90869c2bef1bc47394a9f603ccebb62b2592fd2b (diff) | |
download | frameworks_av-7f1bc8af1c46695191bf7e2aba6467f3616629c0.zip frameworks_av-7f1bc8af1c46695191bf7e2aba6467f3616629c0.tar.gz frameworks_av-7f1bc8af1c46695191bf7e2aba6467f3616629c0.tar.bz2 |
Fix AudioTrack offloaded timestamp handling.
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
Diffstat (limited to 'include/media/AudioTrack.h')
-rw-r--r-- | include/media/AudioTrack.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h index 72e51f9..b5256f0 100644 --- a/include/media/AudioTrack.h +++ b/include/media/AudioTrack.h @@ -580,7 +580,14 @@ public: * Caution: calling this method too often may be inefficient; * if you need a high resolution mapping between frame position and presentation time, * consider implementing that at application level, based on the low resolution timestamps. - * Returns NO_ERROR if timestamp is valid. + * Returns NO_ERROR if timestamp is valid. + * WOULD_BLOCK if called in STOPPED or FLUSHED state, or if called immediately after + * start/ACTIVE, when the number of frames consumed is less than the + * overall hardware latency to physical output. In WOULD_BLOCK cases, + * one might poll again, or use getPosition(), or use 0 position and + * current time for the timestamp. + * INVALID_OPERATION if called on a FastTrack, wrong state, or some other error. + * * The timestamp parameter is undefined on return, if status is not NO_ERROR. */ status_t getTimestamp(AudioTimestamp& timestamp); @@ -747,6 +754,8 @@ protected: // reset by stop() but continues monotonically // after new IAudioTrack to restore mPosition, // and could be easily widened to uint64_t + int64_t mStartUs; // the start time after flush or stop. + // only used for offloaded and direct tracks. audio_output_flags_t mFlags; // const after set(), except for bits AUDIO_OUTPUT_FLAG_FAST and AUDIO_OUTPUT_FLAG_OFFLOAD. |