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

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

am d9cc7659: Merge change 2706 into donut

Merge commit 'd9cc7659fa9b8544e2a3ca7b7040fbd79afdf7ea'

* commit 'd9cc7659fa9b8544e2a3ca7b7040fbd79afdf7ea':
  Fix issue 1883666: Audio coming from the music player stopped suddenly
parents d87acc22 52192700
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -824,9 +824,10 @@ void AudioFlinger::handleForcedSpeakerRoute(int command)
        {
            AutoMutex lock(mHardwareLock);
            if (mForcedSpeakerCount++ == 0) {
                mRouteRestoreTime = 0;
                if (mForcedRoute == 0) {
                    mMusicMuteSaved = mHardwareMixerThread->streamMute(AudioSystem::MUSIC);
                if (mForcedRoute == 0 && !(mSavedRoute & AudioSystem::ROUTE_SPEAKER)) {
                    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);
@@ -836,7 +837,9 @@ void AudioFlinger::handleForcedSpeakerRoute(int command)
                        // 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);
        }