diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-09 12:49:43 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-07-09 12:49:43 -0700 |
commit | 2b479be5db339f4024242a0e1d2d901e70d833ee (patch) | |
tree | 200e41bf9fa56eb35c007124160f209284976758 /libs | |
parent | cfe2c402d92385dca8204998d402f80cf97e6250 (diff) | |
parent | 3893da46f0a97d59a7687ae2bd71ba855eb5ffe3 (diff) | |
download | frameworks_base-2b479be5db339f4024242a0e1d2d901e70d833ee.zip frameworks_base-2b479be5db339f4024242a0e1d2d901e70d833ee.tar.gz frameworks_base-2b479be5db339f4024242a0e1d2d901e70d833ee.tar.bz2 |
am 3893da46: Merge change 6614 into donut
Merge commit '3893da46f0a97d59a7687ae2bd71ba855eb5ffe3'
* commit '3893da46f0a97d59a7687ae2bd71ba855eb5ffe3':
Fix issue 1970108: crash in AudioFlinger::isMusicActive()
Diffstat (limited to 'libs')
-rw-r--r-- | libs/audioflinger/AudioFlinger.cpp | 13 | ||||
-rw-r--r-- | libs/audioflinger/AudioFlinger.h | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index 82289dd..598a356 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -745,12 +745,13 @@ bool AudioFlinger::streamMute(int stream) const bool AudioFlinger::isMusicActive() const { + Mutex::Autolock _l(mLock); #ifdef WITH_A2DP if (isA2dpEnabled()) { - return mA2dpMixerThread->isMusicActive(); + return mA2dpMixerThread->isMusicActive_l(); } #endif - return mHardwareMixerThread->isMusicActive(); + return mHardwareMixerThread->isMusicActive_l(); } status_t AudioFlinger::setParameter(const char* key, const char* value) @@ -1451,7 +1452,8 @@ bool AudioFlinger::MixerThread::streamMute(int stream) const return mStreamTypes[stream].mute; } -bool AudioFlinger::MixerThread::isMusicActive() const +// isMusicActive_l() must be called with AudioFlinger::mLock held +bool AudioFlinger::MixerThread::isMusicActive_l() const { size_t count = mActiveTracks.size(); for (size_t i = 0 ; i < count ; ++i) { @@ -2037,7 +2039,10 @@ void AudioFlinger::MixerThread::OutputTrack::write(int16_t* data, uint32_t frame inBuffer.i16 = data; if (mCblk->user == 0) { - if (mOutputMixerThread->isMusicActive()) { + mOutputMixerThread->mAudioFlinger->mLock.lock(); + bool isMusicActive = mOutputMixerThread->isMusicActive_l(); + mOutputMixerThread->mAudioFlinger->mLock.unlock(); + if (isMusicActive) { mCblk->forceReady = 1; LOGV("OutputTrack::start() force ready"); } else if (mCblk->frameCount > frames){ diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h index cc3d6c2..3531a58 100644 --- a/libs/audioflinger/AudioFlinger.h +++ b/libs/audioflinger/AudioFlinger.h @@ -463,7 +463,7 @@ private: virtual float streamVolume(int stream) const; virtual bool streamMute(int stream) const; - bool isMusicActive() const; + bool isMusicActive_l() const; sp<Track> createTrack_l( |