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
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index db67be6..2042050 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -727,9 +727,13 @@
status_t AudioFlinger::PlaybackThread::Track::getTimestamp(AudioTimestamp& timestamp)
{
+ // Client should implement this using SSQ; the unpresented frame count in latch is irrelevant
+ if (isFastTrack()) {
+ return INVALID_OPERATION;
+ }
sp<ThreadBase> thread = mThread.promote();
if (thread == 0) {
- return false;
+ return INVALID_OPERATION;
}
Mutex::Autolock _l(thread->mLock);
PlaybackThread *playbackThread = (PlaybackThread *)thread.get();