• Dale Curtis's avatar
    Support audio channel count and sample rate changes on Windows. · 3d8fa26a
    Dale Curtis authored
    This fixes a TODO in AudioDeviceListenerWin on listening for
    property value changes... by listening for them in a completely
    different way.
    
    Unfortunately forcing mono audio for accessibility doesn't
    generate IMMNotificationClient events, so we need to instead
    use the IAudioSessionEvents interface, but that can only be
    hung off a fully initialized IAudioClient... which is only
    done during WASAPI audio output setup.
    
    So the original TODO is fixed by adding a 1-to-1 path for device
    changes (in addition to the 1-to-many path). We still need both
    paths since just switching your default device won't generate an
    IAudioSessionEvent notification, only an IMMNotificationClient
    event. Additionally fake and WaveOut based devices don't have a
    IAudioSessionEvents interface, so still need the old path.
    
    Misc other cleanups:
    - Expands the AudioDeviceListenerWin unit tests.
    - Fixes broken --force-wave-audio switch in AudioManagerWin.
    
    Fixed: 1020006
    TEST=property changes, mono audio changes, default changes work.
    
    Change-Id: I257219a32cbcb22c1590aa07f82c6e5d4c7948e4
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1917091
    Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
    Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
    Reviewed-by: default avatarThomas Guilbert <tguilbert@chromium.org>
    Reviewed-by: default avatarHenrik Andreasson <henrika@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#718342}
    3d8fa26a
BUILD.gn 12 KB