Merge change 2706 into donut
* changes: Fix issue 1883666: Audio coming from the music player stopped suddenly
This commit is contained in:
@@ -817,9 +817,10 @@ void AudioFlinger::handleForcedSpeakerRoute(int command)
|
|||||||
{
|
{
|
||||||
AutoMutex lock(mHardwareLock);
|
AutoMutex lock(mHardwareLock);
|
||||||
if (mForcedSpeakerCount++ == 0) {
|
if (mForcedSpeakerCount++ == 0) {
|
||||||
mRouteRestoreTime = 0;
|
if (mForcedRoute == 0) {
|
||||||
mMusicMuteSaved = mHardwareMixerThread->streamMute(AudioSystem::MUSIC);
|
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);
|
LOGV("Route forced to Speaker ON %08x", mSavedRoute | AudioSystem::ROUTE_SPEAKER);
|
||||||
mHardwareMixerThread->setStreamMute(AudioSystem::MUSIC, true);
|
mHardwareMixerThread->setStreamMute(AudioSystem::MUSIC, true);
|
||||||
usleep(mHardwareMixerThread->latency()*1000);
|
usleep(mHardwareMixerThread->latency()*1000);
|
||||||
@@ -829,7 +830,9 @@ void AudioFlinger::handleForcedSpeakerRoute(int command)
|
|||||||
// delay track start so that audio hardware has time to siwtch routes
|
// delay track start so that audio hardware has time to siwtch routes
|
||||||
usleep(kStartSleepTime);
|
usleep(kStartSleepTime);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mForcedRoute = AudioSystem::ROUTE_SPEAKER;
|
mForcedRoute = AudioSystem::ROUTE_SPEAKER;
|
||||||
|
mRouteRestoreTime = 0;
|
||||||
}
|
}
|
||||||
LOGV("mForcedSpeakerCount incremented to %d", mForcedSpeakerCount);
|
LOGV("mForcedSpeakerCount incremented to %d", mForcedSpeakerCount);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user