diff options
| author | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-29 09:42:26 -0700 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-05-29 09:42:26 -0700 |
| commit | 16641bcdae453815fcb54c022bc1734618ddc3f1 (patch) | |
| tree | 5c4160c5c79c308be8aeee6041370a89f210ab65 /libs/audioflinger | |
| parent | 0ad6dc0ebc5c6c92b4f1e9eed427efce7b46de09 (diff) | |
| parent | d9cc7659fa9b8544e2a3ca7b7040fbd79afdf7ea (diff) | |
| download | frameworks_base-16641bcdae453815fcb54c022bc1734618ddc3f1.zip frameworks_base-16641bcdae453815fcb54c022bc1734618ddc3f1.tar.gz frameworks_base-16641bcdae453815fcb54c022bc1734618ddc3f1.tar.bz2 | |
am d9cc7659: Merge change 2706 into donut
Merge commit 'd9cc7659fa9b8544e2a3ca7b7040fbd79afdf7ea'
* commit 'd9cc7659fa9b8544e2a3ca7b7040fbd79afdf7ea':
Fix issue 1883666: Audio coming from the music player stopped suddenly
Diffstat (limited to 'libs/audioflinger')
| -rw-r--r-- | libs/audioflinger/AudioFlinger.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp index 49b0129..9783e54 100644 --- a/libs/audioflinger/AudioFlinger.cpp +++ b/libs/audioflinger/AudioFlinger.cpp @@ -824,19 +824,22 @@ void AudioFlinger::handleForcedSpeakerRoute(int command) { AutoMutex lock(mHardwareLock); if (mForcedSpeakerCount++ == 0) { - mRouteRestoreTime = 0; - mMusicMuteSaved = mHardwareMixerThread->streamMute(AudioSystem::MUSIC); - if (mForcedRoute == 0 && !(mSavedRoute & AudioSystem::ROUTE_SPEAKER)) { - LOGV("Route forced to Speaker ON %08x", mSavedRoute | AudioSystem::ROUTE_SPEAKER); - mHardwareMixerThread->setStreamMute(AudioSystem::MUSIC, true); - usleep(mHardwareMixerThread->latency()*1000); - mHardwareStatus = AUDIO_HW_SET_ROUTING; - mAudioHardware->setRouting(AudioSystem::MODE_NORMAL, mSavedRoute | AudioSystem::ROUTE_SPEAKER); - mHardwareStatus = AUDIO_HW_IDLE; - // delay track start so that audio hardware has time to siwtch routes - usleep(kStartSleepTime); + if (mForcedRoute == 0) { + mMusicMuteSaved = mHardwareMixerThread->streamMute(AudioSystem::MUSIC); + LOGV("++mForcedSpeakerCount == 0, mMusicMuteSaved = %d, mRouteRestoreTime = %d", mMusicMuteSaved, mRouteRestoreTime); + if (!(mSavedRoute & AudioSystem::ROUTE_SPEAKER)) { + LOGV("Route forced to Speaker ON %08x", mSavedRoute | AudioSystem::ROUTE_SPEAKER); + mHardwareMixerThread->setStreamMute(AudioSystem::MUSIC, true); + usleep(mHardwareMixerThread->latency()*1000); + mHardwareStatus = AUDIO_HW_SET_ROUTING; + mAudioHardware->setRouting(AudioSystem::MODE_NORMAL, mSavedRoute | AudioSystem::ROUTE_SPEAKER); + mHardwareStatus = AUDIO_HW_IDLE; + // delay track start so that audio hardware has time to siwtch routes + usleep(kStartSleepTime); + } } mForcedRoute = AudioSystem::ROUTE_SPEAKER; + mRouteRestoreTime = 0; } LOGV("mForcedSpeakerCount incremented to %d", mForcedSpeakerCount); } |
