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".

BUG=930876
TEST=https://jsfiddle.net/2xng9bjr/1/ and new unittests.
R=chcunningham

Change-Id: I6db477660a0b936dda3a60e916ea7778bd7e7397
Reviewed-on: https://chromium-review.googlesource.com/c/1467911
Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631524}
3 files changed