Skip to content
Browse files

audio: reset output device when disconnecting HDMI

When HDMI is disconnected, the audio HAL should stop writing to
the PCM driver to avoid a write error and a long timeout.
THe problem is that if no audio track is active, the policy manager
will send a 0 device upon HDMI disconnection which is normally ignored.

The fix consists in forcing the device to speaker when transitioning from
HDMI to 0 device.

Bug 7141149.

Change-Id: I3e5878a1d6ec0446f7044eff95e6641332c718bf
  • Loading branch information...
1 parent f859d3e commit 466e8a8fa8d4e6186b72c25cd0289356828177b3 Eric Laurent committed with Android (Google) Code Review Sep 26, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 alsa_sound/ALSAStreamOps.cpp
4 alsa_sound/ALSAStreamOps.cpp
@@ -206,6 +206,10 @@ status_t ALSAStreamOps::setParameters(const String8& keyValuePairs)
if (param.getInt(key, device) == NO_ERROR) {
// Ignore routing if device is 0.
ALOGD("setParameters(): keyRouting with device %d", device);
+ // reset to speaker when disconnecting HDMI to avoid timeout due to write errors
+ if ((device == 0) && (mDevices == AudioSystem::DEVICE_OUT_AUX_DIGITAL)) {
+ device = AudioSystem::DEVICE_OUT_SPEAKER;
+ }
mDevices = device;
if(device) {

0 comments on commit 466e8a8

Please sign in to comment.
Something went wrong with that request. Please try again.