diff options
author | Glenn Kasten <gkasten@google.com> | 2014-01-13 10:37:17 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2014-01-14 14:20:18 -0800 |
commit | 23a7545c4de71e989c2d8ebf1d5b9dcf463c36a9 (patch) | |
tree | 13f9b25c2dcc70506e3c743c817fce0998021be9 /media/libmedia | |
parent | 84fba38b60c2ddb02b9a787f56be88fc084b4a16 (diff) | |
download | frameworks_av-23a7545c4de71e989c2d8ebf1d5b9dcf463c36a9.zip frameworks_av-23a7545c4de71e989c2d8ebf1d5b9dcf463c36a9.tar.gz frameworks_av-23a7545c4de71e989c2d8ebf1d5b9dcf463c36a9.tar.bz2 |
Document locking rules for mFlags, and fix discrepancies
Change-Id: Id45ba544cc84133ed5e578fb4fd8a11b62211dc1
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 50e394b..8954d9f 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -457,7 +457,7 @@ void AudioTrack::stop() return; } - if (isOffloaded()) { + if (isOffloaded_l()) { mState = STATE_STOPPING; } else { mState = STATE_STOPPED; @@ -479,7 +479,7 @@ void AudioTrack::stop() sp<AudioTrackThread> t = mAudioTrackThread; if (t != 0) { - if (!isOffloaded()) { + if (!isOffloaded_l()) { t->pause(); } } else { @@ -517,7 +517,7 @@ void AudioTrack::flush_l() mRefreshRemaining = true; mState = STATE_FLUSHED; - if (isOffloaded()) { + if (isOffloaded_l()) { mProxy->interrupt(); } mProxy->flush(); @@ -550,7 +550,7 @@ status_t AudioTrack::setVolume(float left, float right) mProxy->setVolumeLR((uint32_t(uint16_t(right * 0x1000)) << 16) | uint16_t(left * 0x1000)); - if (isOffloaded()) { + if (isOffloaded_l()) { mAudioTrack->signal(); } return NO_ERROR; @@ -614,7 +614,7 @@ uint32_t AudioTrack::getSampleRate() const // 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 (isOffloaded_l()) { if (mOutput != 0) { uint32_t sampleRate = 0; status_t status = AudioSystem::getSamplingRate(mOutput, mStreamType, &sampleRate); @@ -751,7 +751,7 @@ status_t AudioTrack::getPosition(uint32_t *position) const } AutoMutex lock(mLock); - if (isOffloaded()) { + if (isOffloaded_l()) { uint32_t dspFrames = 0; if (mOutput != 0) { @@ -1389,7 +1389,7 @@ nsecs_t AudioTrack::processAudioBuffer() // for offloaded tracks restoreTrack_l() will just update the sequence and clear // AudioSystem cache. We should not exit here but after calling the callback so // that the upper layers can recreate the track - if (!isOffloaded() || (mSequence == mObservedSequence)) { + if (!isOffloaded_l() || (mSequence == mObservedSequence)) { status_t status = restoreTrack_l("processAudioBuffer"); mLock.unlock(); // Run again immediately, but with a new IAudioTrack @@ -1676,7 +1676,7 @@ nsecs_t AudioTrack::processAudioBuffer() status_t AudioTrack::restoreTrack_l(const char *from) { ALOGW("dead IAudioTrack, %s, creating a new one from %s()", - isOffloaded() ? "Offloaded" : "PCM", from); + isOffloaded_l() ? "Offloaded" : "PCM", from); ++mSequence; status_t result; @@ -1684,7 +1684,8 @@ status_t AudioTrack::restoreTrack_l(const char *from) // output parameters in getOutput_l() and createTrack_l() AudioSystem::clearAudioConfigCache(); - if (isOffloaded()) { + if (isOffloaded_l()) { + // FIXME re-creation of offloaded tracks is not yet implemented return DEAD_OBJECT; } @@ -1778,6 +1779,12 @@ String8 AudioTrack::getParameters(const String8& keys) } } +bool AudioTrack::isOffloaded() const +{ + AutoMutex lock(mLock); + return isOffloaded_l(); +} + status_t AudioTrack::dump(int fd, const Vector<String16>& args __unused) const { |