mirror of https://github.com/mpv-player/mpv
wasapi: clamp number of output channels to 8
This is the most supported in standard layout, if we request more it tends to fallback to stereo instead. Also channels mask is 32-bit and it can get truncated.
This commit is contained in:
parent
0728e4778f
commit
4f0b654503
|
@ -143,7 +143,19 @@ static void set_waveformat(WAVEFORMATEXTENSIBLE *wformat,
|
|||
|
||||
wformat->SubFormat = *format_to_subtype(format->mp_format);
|
||||
wformat->Samples.wValidBitsPerSample = format->used_msb;
|
||||
wformat->dwChannelMask = mp_chmap_to_waveext(channels);
|
||||
|
||||
uint64_t chans = mp_chmap_to_waveext(channels);
|
||||
wformat->dwChannelMask = chans;
|
||||
|
||||
if (wformat->Format.nChannels > 8 || wformat->dwChannelMask != chans) {
|
||||
// IAudioClient::IsFormatSupported tend to fallback to stereo for closest
|
||||
// format match when there are more channels. Remix to standard layout.
|
||||
// Also if input channel mask has channels outside 32-bits override it
|
||||
// and hope for the best...
|
||||
wformat->dwChannelMask = KSAUDIO_SPEAKER_7POINT1_SURROUND;
|
||||
wformat->Format.nChannels = 8;
|
||||
}
|
||||
|
||||
update_waveformat_datarate(wformat);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue