summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-09-20 09:36:34 -0700
committerEric Laurent <elaurent@google.com>2013-09-20 09:36:34 -0700
commitaccc147666bfd37fc8b4ef745f18a8c751555ec2 (patch)
treea091aa566ed09e8efe881a16e3806ee4169de3f0 /services/audioflinger/Threads.cpp
parent5baf2af52cd186633b7173196c1e4a4cd3435f22 (diff)
downloadframeworks_av-accc147666bfd37fc8b4ef745f18a8c751555ec2.zip
frameworks_av-accc147666bfd37fc8b4ef745f18a8c751555ec2.tar.gz
frameworks_av-accc147666bfd37fc8b4ef745f18a8c751555ec2.tar.bz2
audioflinger: implement getTimestamp() for offloaded tracks
Bug: 9587132. Change-Id: Ie9d5f4cca96306d08bc9a2dbd6edd8953096702d
Diffstat (limited to 'services/audioflinger/Threads.cpp')
-rw-r--r--services/audioflinger/Threads.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 7d0ecac..242e020 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2340,6 +2340,22 @@ void AudioFlinger::PlaybackThread::removeTracks_l(const Vector< sp<Track> >& tra
}
+status_t AudioFlinger::PlaybackThread::getTimestamp_l(AudioTimestamp& timestamp)
+{
+ if (mNormalSink != 0) {
+ return mNormalSink->getTimestamp(timestamp);
+ }
+ if (mType == OFFLOAD && mOutput->stream->get_presentation_position) {
+ uint64_t position64;
+ int ret = mOutput->stream->get_presentation_position(
+ mOutput->stream, &position64, &timestamp.mTime);
+ if (ret == 0) {
+ timestamp.mPosition = (uint32_t)position64;
+ return NO_ERROR;
+ }
+ }
+ return INVALID_OPERATION;
+}
// ----------------------------------------------------------------------------
AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output,