From 738cbcf78907381bf061ebf5f9802e15b5517cf4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 16 Dec 2021 11:02:39 +0100 Subject: [PATCH] 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 --- spa/plugins/alsa/alsa-pcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 1dfac8189..8c3476990 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -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: