Enable FastTrack timestamps
Bug: 26413951
Change-Id: I99a69241a0bcd69f6bfebf785cac6d9ee1e2cd5f
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index e17e47e..132ae38 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -2167,11 +2167,6 @@
// Set false here to cover all the error return cases.
mPreviousTimestampValid = false;
- // FIXME not implemented for fast tracks; should use proxy and SSQ
- if (mFlags & AUDIO_OUTPUT_FLAG_FAST) {
- return INVALID_OPERATION;
- }
-
switch (mState) {
case STATE_ACTIVE:
case STATE_PAUSED:
@@ -2201,7 +2196,10 @@
// The presented frame count must always lag behind the consumed frame count.
// To avoid a race, read the presented frames first. This ensures that presented <= consumed.
- status_t status = mAudioTrack->getTimestamp(timestamp);
+
+ // FastTrack timestamps are read through shared memory; otherwise use Binder.
+ status_t status = (mFlags & AUDIO_OUTPUT_FLAG_FAST) ?
+ mProxy->getTimestamp(×tamp) : mAudioTrack->getTimestamp(timestamp);
if (status != NO_ERROR) {
ALOGV_IF(status != WOULD_BLOCK, "getTimestamp error:%#x", status);
return status;