diff options
| author | Eric Laurent <elaurent@google.com> | 2009-12-07 10:53:10 -0800 |
|---|---|---|
| committer | Eric Laurent <elaurent@google.com> | 2009-12-07 12:30:22 -0800 |
| commit | 0a08029fc9a370c6ef2a2a6fd1d800d9159b61f8 (patch) | |
| tree | 09a95de3a82940953eaa587768422d5be2b0cebb /libs/audioflinger/AudioFlinger.cpp | |
| parent | 6d42d80653f2c41f3e72a878a1d9a6f9693b89f7 (diff) | |
| download | frameworks_base-0a08029fc9a370c6ef2a2a6fd1d800d9159b61f8.zip frameworks_base-0a08029fc9a370c6ef2a2a6fd1d800d9159b61f8.tar.gz frameworks_base-0a08029fc9a370c6ef2a2a6fd1d800d9159b61f8.tar.bz2 | |
Fix issue 2306779: Runtime restart - Init failed at android.media.ToneGenerator.
The ToneGenerator failed to initialize because no more tracks were available in AudioFlinger mixer.
All tracks were used because the duplicating output was failing to free the tracks on audio hardware output mixer when exiting due to a misplaced test on output activity: output tracks where only freed if the duplicating output was active when exiting.
The fix consists in freeing the output tracks when the duplicating thread is destroyed without condition.
Diffstat (limited to 'libs/audioflinger/AudioFlinger.cpp')
| -rw-r--r-- | libs/audioflinger/AudioFlinger.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index f3f6e4f..2024cc0 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -1111,7 +1111,6 @@ void AudioFlinger::PlaybackThread::destroyTrack_l(const sp<Track>& track) { track->mState = TrackBase::TERMINATED; if (mActiveTracks.indexOf(track) < 0) { - LOGV("remove track (%d) and delete from mixer", track->name()); mTracks.remove(track); deleteTrackName_l(track->name()); } @@ -1511,6 +1510,7 @@ int AudioFlinger::MixerThread::getTrackName_l() // deleteTrackName_l() must be called with ThreadBase::mLock held void AudioFlinger::MixerThread::deleteTrackName_l(int name) { + LOGV("remove track (%d) and delete from mixer", name); mAudioMixer->deleteTrackName(name); } @@ -1922,6 +1922,9 @@ AudioFlinger::DuplicatingThread::DuplicatingThread(const sp<AudioFlinger>& audio AudioFlinger::DuplicatingThread::~DuplicatingThread() { + for (size_t i = 0; i < mOutputTracks.size(); i++) { + mOutputTracks[i]->destroy(); + } mOutputTracks.clear(); } @@ -2044,17 +2047,6 @@ bool AudioFlinger::DuplicatingThread::threadLoop() outputTracks.clear(); } - { // scope for the mLock - - Mutex::Autolock _l(mLock); - if (!mStandby) { - LOGV("DuplicatingThread() exiting out of standby"); - for (size_t i = 0; i < mOutputTracks.size(); i++) { - mOutputTracks[i]->destroy(); - } - } - } - return false; } |
