diff options
author | Eric Laurent <elaurent@google.com> | 2013-07-26 17:16:50 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2013-12-17 13:41:37 -0800 |
commit | 5e49afd05566820517747b9a8071c99ec0918328 (patch) | |
tree | 0dd9697822c0bd70f03bb776bc78e2da60f28991 /media/libmedia | |
parent | a67c76538fff102cd44b2f38dd073df5f2a33605 (diff) | |
download | frameworks_av-5e49afd05566820517747b9a8071c99ec0918328.zip frameworks_av-5e49afd05566820517747b9a8071c99ec0918328.tar.gz frameworks_av-5e49afd05566820517747b9a8071c99ec0918328.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.
Change-Id: I997e5248cfd4017aeceb4e11689324ded2a5bc88
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 9730b03..42516bc 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; } |