diff options
author | Glenn Kasten <gkasten@google.com> | 2013-08-30 13:28:22 -0700 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2013-09-03 15:19:03 -0700 |
commit | fe346c707f59d763ded93bc3d27b51f0c0408258 (patch) | |
tree | 3e6f12ac7b37bc8ef10845c4c7ccdcfef4b51cd5 /media | |
parent | 4d0815d694e5a2edb3ce48427de50f55d0f84c0b (diff) | |
download | frameworks_av-fe346c707f59d763ded93bc3d27b51f0c0408258.zip frameworks_av-fe346c707f59d763ded93bc3d27b51f0c0408258.tar.gz frameworks_av-fe346c707f59d763ded93bc3d27b51f0c0408258.tar.bz2 |
Fix miscellanous AudioTrack::getTimestamp() bugs
Check that get_presentation_position is non-NULL before calling.
AudioTrack::getTimestamp not implemented for fast tracks.
Fix typo in Track::getTimestamp().
Fix bugs in AudioTrack::getTimestamp after stop:
- getTimestamp while stopped is not allowed.
- stop, start, getTimestamp now returns the correct value.
Change-Id: Ie8d9dc1f28d8927634e04175a68b147ffc2ea8eb
Diffstat (limited to 'media')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 13 | ||||
-rw-r--r-- | media/libnbaio/AudioStreamOutSink.cpp | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 176197c..744faee 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -1714,7 +1714,18 @@ status_t AudioTrack::setParameters(const String8& keyValuePairs) status_t AudioTrack::getTimestamp(AudioTimestamp& timestamp) { AutoMutex lock(mLock); - return mAudioTrack->getTimestamp(timestamp); + // FIXME not implemented for fast tracks; should use proxy and SSQ + if (mFlags & AUDIO_OUTPUT_FLAG_FAST) { + return INVALID_OPERATION; + } + if (mState != STATE_ACTIVE && mState != STATE_PAUSED) { + return INVALID_OPERATION; + } + status_t status = mAudioTrack->getTimestamp(timestamp); + if (status == NO_ERROR) { + timestamp.mPosition += mProxy->getEpoch(); + } + return status; } String8 AudioTrack::getParameters(const String8& keys) diff --git a/media/libnbaio/AudioStreamOutSink.cpp b/media/libnbaio/AudioStreamOutSink.cpp index b2de8a2..e4341d7 100644 --- a/media/libnbaio/AudioStreamOutSink.cpp +++ b/media/libnbaio/AudioStreamOutSink.cpp @@ -81,6 +81,9 @@ status_t AudioStreamOutSink::getNextWriteTimestamp(int64_t *timestamp) { status_t AudioStreamOutSink::getTimestamp(AudioTimestamp& timestamp) { + if (mStream->get_presentation_position == NULL) { + return INVALID_OPERATION; + } // FIXME position64 won't be needed after AudioTimestamp.mPosition is changed to uint64_t uint64_t position64; int ok = mStream->get_presentation_position(mStream, &position64, ×tamp.mTime); |