Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b479be5 authored by Android (Google) Code Review's avatar Android (Google) Code Review Committed by The Android Open Source Project
Browse files

am 3893da46: Merge change 6614 into donut

Merge commit '3893da46'

* commit '3893da46':
  Fix issue 1970108: crash in AudioFlinger::isMusicActive()
parents cfe2c402 3893da46
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -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){
+1 −1
Original line number Diff line number Diff line
@@ -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(