alsa: fix rate for EAC3

EAC3 needs to be opened in 4x the rate of the EAC3 stream, which can be
32, 44.1 or 48 KHz. Some clients already multiply but others don't.
Check here what is the case and fix it up.

Fixes #1902
This commit is contained in:
Wim Taymans 2021-12-16 11:02:39 +01:00
parent 7b26384388
commit 738cbcf789

View file

@ -1162,7 +1162,11 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
case SPA_AUDIO_IEC958_CODEC_MPEG2_AAC:
break;
case SPA_AUDIO_IEC958_CODEC_EAC3:
rrate *= 4;
/* EAC3 has 3 rates, 32, 44.1 and 48KHz. We need to
* open the device in 4x that rate. Some clients
* already multiply (mpv,..) others don't (vlc). */
if (rrate <= 48000)
rrate *= 4;
break;
case SPA_AUDIO_IEC958_CODEC_TRUEHD:
case SPA_AUDIO_IEC958_CODEC_DTSHD: