ao_wasapi_utils: be slightly more clever when converting channel map

This commit is contained in:
wm4 2017-07-07 17:41:44 +02:00
parent 951c1a4907
commit 4e11549593
1 changed files with 5 additions and 0 deletions

View File

@ -153,7 +153,12 @@ static void set_waveformat(WAVEFORMATEXTENSIBLE *wformat,
static void set_waveformat_with_ao(WAVEFORMATEXTENSIBLE *wformat, struct ao *ao)
{
struct mp_chmap channels = ao->channels;
if (mp_chmap_is_unknown(&channels))
mp_chmap_from_channels(&channels, channels.num);
mp_chmap_reorder_to_waveext(&channels);
if (!mp_chmap_is_valid(&channels))
mp_chmap_from_channels(&channels, 2);
// First find a format that is actually representable.
// (Notably excludes AF_FORMAT_DOUBLE.)