Fix race with SwitchOutputDevice() and GetOutputDeviceInfoAsync().

AudioRendererMixerInput wasn't expecting SwitchOutputDevice() to
occur before AudioRenderer initialization completes. When there's
a pending GODIA() call, a SOD() before that completes can kick us
onto the fake audio rendering path by aborting the GODIA() call.

The fix is to defer SOD() calls until we've completed GODIA() and
likewise defer GODIA() calls until we've completed SOD(). In the
event a SOD() call fails, the normal GODIA() process will kick
off using the old device_id.

I've also added some code to short circuit device changes when
switching to the "default" device, since internally we allow both
the empty string and the string "default".

TEST= and new unittests.

Change-Id: I6db477660a0b936dda3a60e916ea7778bd7e7397
Reviewed-by: Chrome Cunningham <>
Commit-Queue: Dale Curtis <>
Auto-Submit: Dale Curtis <>
Cr-Commit-Position: refs/heads/master@{#631524}
3 files changed