diff options
| author | Eric Laurent <elaurent@google.com> | 2015-08-18 21:45:18 +0000 | 
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-18 21:45:18 +0000 | 
| commit | 6b52d191f96c611b768318eec74d25908da76d03 (patch) | |
| tree | 988dd6b443bf363307033e527734dbebf994d342 /services | |
| parent | 5d7a381b9c86ff4f00a95063d57ad0a80467799c (diff) | |
| parent | 916a9684295fb578f4b3c6c16b621ef201a49964 (diff) | |
| download | frameworks_av-6b52d191f96c611b768318eec74d25908da76d03.zip frameworks_av-6b52d191f96c611b768318eec74d25908da76d03.tar.gz frameworks_av-6b52d191f96c611b768318eec74d25908da76d03.tar.bz2  | |
am 916a9684: Merge "DO NOT MERGE - audio flinger: fix fuzz test crash" into klp-dev
* commit '916a9684295fb578f4b3c6c16b621ef201a49964':
  DO NOT MERGE - audio flinger: fix fuzz test crash
Diffstat (limited to 'services')
| -rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 20 | ||||
| -rw-r--r-- | services/audioflinger/Threads.cpp | 5 | ||||
| -rw-r--r-- | services/audioflinger/Threads.h | 2 | 
3 files changed, 21 insertions, 6 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index acbd19a..0aef53f 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -646,8 +646,12 @@ status_t AudioFlinger::setMasterVolume(float value)      // assigned to HALs which do not have master volume support will apply      // master volume during the mix operation.  Threads with HALs which do      // support master volume will simply ignore the setting. -    for (size_t i = 0; i < mPlaybackThreads.size(); i++) +    for (size_t i = 0; i < mPlaybackThreads.size(); i++) { +        if (mPlaybackThreads.valueAt(i)->isDuplicating()) { +            continue; +        }          mPlaybackThreads.valueAt(i)->setMasterVolume(value); +    }      return NO_ERROR;  } @@ -753,8 +757,12 @@ status_t AudioFlinger::setMasterMute(bool muted)      // assigned to HALs which do not have master mute support will apply master      // mute during the mix operation.  Threads with HALs which do support master      // mute will simply ignore the setting. -    for (size_t i = 0; i < mPlaybackThreads.size(); i++) +    for (size_t i = 0; i < mPlaybackThreads.size(); i++) { +        if (mPlaybackThreads.valueAt(i)->isDuplicating()) { +            continue; +        }          mPlaybackThreads.valueAt(i)->setMasterMute(muted); +    }      return NO_ERROR;  } @@ -1596,11 +1604,10 @@ status_t AudioFlinger::closeOutput_nonvirtual(audio_io_handle_t output)          if (thread->type() == ThreadBase::MIXER) {              for (size_t i = 0; i < mPlaybackThreads.size(); i++) { -                if (mPlaybackThreads.valueAt(i)->type() == ThreadBase::DUPLICATING) { +                if (mPlaybackThreads.valueAt(i)->isDuplicating()) {                      DuplicatingThread *dupThread =                              (DuplicatingThread *)mPlaybackThreads.valueAt(i).get();                      dupThread->removeOutputTrack((MixerThread *)thread.get()); -                  }              }          } @@ -1627,7 +1634,7 @@ status_t AudioFlinger::closeOutput_nonvirtual(audio_io_handle_t output)      // The thread entity (active unit of execution) is no longer running here,      // but the ThreadBase container still exists. -    if (thread->type() != ThreadBase::DUPLICATING) { +    if (!thread->isDuplicating()) {          AudioStreamOut *out = thread->clearOutput();          ALOG_ASSERT(out != NULL, "out shouldn't be NULL");          // from now on thread->mOutput is NULL @@ -2000,6 +2007,9 @@ AudioFlinger::PlaybackThread *AudioFlinger::primaryPlaybackThread_l() const  {      for (size_t i = 0; i < mPlaybackThreads.size(); i++) {          PlaybackThread *thread = mPlaybackThreads.valueAt(i).get(); +        if(thread->isDuplicating()) { +            continue; +        }          AudioStreamOut *output = thread->getOutput();          if (output != NULL && output->audioHwDev == mPrimaryHardwareDev) {              return thread; diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 3d657b3..a9eaa8a 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -4306,10 +4306,13 @@ void AudioFlinger::DuplicatingThread::removeOutputTrack(MixerThread *thread)              mOutputTracks[i]->destroy();              mOutputTracks.removeAt(i);              updateWaitTime_l(); +            if (thread->getOutput() == mOutput) { +                mOutput = NULL; +            }              return;          }      } -    ALOGV("removeOutputTrack(): unkonwn thread: %p", thread); +    ALOGV("removeOutputTrack(): unknown thread: %p", thread);  }  // caller must hold mLock diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h index 207f1eb..bb92df1 100644 --- a/services/audioflinger/Threads.h +++ b/services/audioflinger/Threads.h @@ -118,6 +118,8 @@ public:                  // static externally-visible                  type_t      type() const { return mType; } +                bool isDuplicating() const { return (mType == DUPLICATING); } +                  audio_io_handle_t id() const { return mId;}                  // dynamic externally-visible  | 
