summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-07-26 17:16:50 -0700
committerEric Laurent <elaurent@google.com>2014-03-05 12:17:54 -0800
commitd0115d8c4db2f337030dea706bc0a434c4a03ed6 (patch)
tree239450c60bc4cb8519edeb8985dbc601fe51c652 /media/libmedia
parent7e92abeafb184e8a34213d7149592e95a72601b0 (diff)
downloadframeworks_av-d0115d8c4db2f337030dea706bc0a434c4a03ed6.zip
frameworks_av-d0115d8c4db2f337030dea706bc0a434c4a03ed6.tar.gz
frameworks_av-d0115d8c4db2f337030dea706bc0a434c4a03ed6.tar.bz2
update offloaded audio track sampling rate
AudioPlayer must read the sampling rate from offloaded audio sinks whenever a new time position is computed as the decoder can update the sampling rate on the fly. Bug: 12823955. Change-Id: I997e5248cfd4017aeceb4e11689324ded2a5bc88
Diffstat (limited to 'media/libmedia')
-rw-r--r--media/libmedia/AudioTrack.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 7c4a990..1ab8693 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -603,6 +603,19 @@ uint32_t AudioTrack::getSampleRate() const
}
AutoMutex lock(mLock);
+
+ // sample rate can be updated during playback by the offloaded decoder so we need to
+ // query the HAL and update if needed.
+// FIXME use Proxy return channel to update the rate from server and avoid polling here
+ if (isOffloaded()) {
+ if (mOutput != 0) {
+ uint32_t sampleRate = 0;
+ status_t status = AudioSystem::getSamplingRate(mOutput, mStreamType, &sampleRate);
+ if (status == NO_ERROR) {
+ mSampleRate = sampleRate;
+ }
+ }
+ }
return mSampleRate;
}