From 4e358a963604af8746a059d7388cb202be0f919d Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 3 Nov 2015 00:25:20 +0100 Subject: af_lavrresample: don't drop sl/sr channels for 7.1 on ALSA ao_alsa: attempt to fix 7.1 over HDMI The last 2 channels of 7.1 (RLC/RRC in ALSA) were exported as sdl/sdr instead of sl/sr (I don't even know why I chose sdl/sdr, but SL/SR and RLC/RRC are different in the ALSA API). libsw/avresample do not move the sl/sr channels to sdl/sdr when rematrixing, so silence was sent for 2 channels. If my selection of sdl/sdr is essentially API abuse, there's no reason why they should do this differently. The mess here is really that ALSa doesn't map the HDMI layouts cleanly. Most ALSA drivers export 7.1 in a way compatible to our expectations, but Intel HDA/HDMI does not: mpv/ffmpeg: fl-fr-fc-lfe-bl-br-sl-sr ALSA/generic: FL FR FC LFE RL RR SL SR [1] ALSA/HDMI: FL FR LFE FC RL RR RLC RRC [2] The HDMI layout is layout 0x13 (going by CEA-861-B). The comment in the kernel code has to be correct too. The early standard defines only 1 other layout, which replaces RLC/RRC with FRC/FLC - this probably corresponds to what we call "7.1(wide)". So it appears when ALSA requests RLC/RRC, we should feed it sl/sr. To make it more complicated, Kodi/xbmc apparently also have to deal with ALSA being special, but instead of sending sl/sr to RLC/RRC, they swap the last two pairs of the layout, and send sl/sr to RL/RR and bl/br to RLC/RRC. Or I might have misunderstood their code. I don't have a 7.1-capable A/V receiver, so I can't test this. For now, go with the simpler solution, and wait until someone tests it. If the speakers end up swapped, a completely different solution will be needed. [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/sound/core/pcm_lib.c?id=refs/tags/v4.3#n2434 [2] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/sound/pci/hda/patch_hdmi.c?id=refs/tags/v4.3#n307 --- audio/chmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'audio/chmap.c') diff --git a/audio/chmap.c b/audio/chmap.c index fb98be52df..8bd9b18d61 100644 --- a/audio/chmap.c +++ b/audio/chmap.c @@ -93,7 +93,7 @@ static const char *const std_layout_names[][2] = { {"7.1(alsa)", "fl-fr-bl-br-fc-lfe-sl-sr"}, // not in lavc {"7.1(wide)", "fl-fr-fc-lfe-bl-br-flc-frc"}, {"7.1(wide-side)", "fl-fr-fc-lfe-flc-frc-sl-sr"}, - {"7.1(rear)", "fl-fr-fc-lfe-bl-br-sdl-sdr"}, + {"7.1(rear)", "fl-fr-fc-lfe-bl-br-sdl-sdr"}, // not in lavc {"octagonal", "fl-fr-fc-bl-br-bc-sl-sr"}, {"downmix", "dl-dr"}, {"auto", ""}, // not in lavc -- cgit v1.2.3