summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Tracks.cpp
diff options
context:
space:
mode:
authorRicardo Garcia <rago@google.com>2015-04-18 14:47:04 -0700
committerRicardo Garcia <rago@google.com>2015-04-22 10:57:24 -0700
commit5a8a95de6dad1a3bcf3da5a37b35766e89086e13 (patch)
tree64b82016eaef26f51b75470714172c06287c9c56 /services/audioflinger/Tracks.cpp
parentea44f41bb142555e747cc11382296e94af99d312 (diff)
downloadframeworks_av-5a8a95de6dad1a3bcf3da5a37b35766e89086e13.zip
frameworks_av-5a8a95de6dad1a3bcf3da5a37b35766e89086e13.tar.gz
frameworks_av-5a8a95de6dad1a3bcf3da5a37b35766e89086e13.tar.bz2
Use AudioPlaybackRate to hold TimestretchBufferProvider parameters
Use this struct to handle the parameters for TimestretchBufferProvider all across the system. Add stretch mode and fallback mode to TimestretchBuffer Provider. Change-Id: I19099924a7003c62e48bb6ead56c785cb129fba2
Diffstat (limited to 'services/audioflinger/Tracks.cpp')
-rw-r--r--services/audioflinger/Tracks.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index da2d634..c6e9745 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -906,11 +906,9 @@ status_t AudioFlinger::PlaybackThread::Track::getTimestamp(AudioTimestamp& times
// FIXME Not accurate under dynamic changes of sample rate and speed.
// Do not use track's mSampleRate as it is not current for mixer tracks.
uint32_t sampleRate = mAudioTrackServerProxy->getSampleRate();
- float speed, pitch;
- mAudioTrackServerProxy->getPlaybackRate(&speed, &pitch);
- uint32_t unpresentedFrames =
- ((double) playbackThread->mLatchQ.mUnpresentedFrames * sampleRate * speed)
- / playbackThread->mSampleRate;
+ AudioPlaybackRate playbackRate = mAudioTrackServerProxy->getPlaybackRate();
+ uint32_t unpresentedFrames = ((double) playbackThread->mLatchQ.mUnpresentedFrames *
+ sampleRate * playbackRate.mSpeed)/ playbackThread->mSampleRate;
// FIXME Since we're using a raw pointer as the key, it is theoretically possible
// for a brand new track to share the same address as a recently destroyed
// track, and thus for us to get the frames released of the wrong track.