OSDN Git Service

Fix music heard in speaker before notifications.
authorEric Laurent <elaurent@google.com>
Thu, 20 Oct 2011 16:17:04 +0000 (09:17 -0700)
committerEric Laurent <elaurent@google.com>
Thu, 20 Oct 2011 16:17:04 +0000 (09:17 -0700)
Increase the delay after muting music when switching audio path
to both speaker and headset for notifications and ringtones.
This is required to avoid a residual of music to be output to speaker
now that the max latency has been increased in low power playback mode.

This is a temporary workaround that will be removed when low power mode
is controlled policy manager.

Change-Id: If08e7f46e499be362badb2a24a79d1723ebfc00a

audio/AudioPolicyManagerBase.cpp

index 191ba9d..e299db8 100644 (file)
@@ -1803,7 +1803,9 @@ void AudioPolicyManagerBase::setOutputDevice(audio_io_handle_t output, uint32_t
     if (output == mHardwareOutput && AudioSystem::popCount(device) == 2) {
         setStrategyMute(STRATEGY_MEDIA, true, output);
         // wait for the PCM output buffers to empty before proceeding with the rest of the command
-        usleep(outputDesc->mLatency*2*1000);
+        // FIXME: increased delay due to larger buffers used for low power audio mode.
+        // remove when low power audio is controlled by policy manager.
+        usleep(outputDesc->mLatency*8*1000);
     }
 
     // do the routing