I am using alsa-lib/alsa-utils/alsa-plugins 1.1.0 and ffmpeg 2.8.4 and in Arch Linux.
So I ran `speaker-test -D wav -c 6 -l 1` with the following .asoundrc:
pcm.file { type file file st.ac3 }
pcm.a52 { type plug slave { pcm { type a52 slavepcm file } } }
pcm.wav { type file slave { pcm a52 } file st.wav format wav }
[tom@localhost ~]$ speaker-test -D wav -c 6 -l 1
speaker-test 1.1.0
Playback device is wav Stream parameters are 48000Hz, S16_LE, 6 channels Using 16 octaves of pink noise Rate set to 48000Hz (requested 48000Hz) Buffer size range from 3072 to 206157312 Period size range from 1536 to 1536 Using max buffer size 206157312 Periods = 4 was set period_size = 1536 was set buffer_size = 206157312 0 - Front Left 2 - Front Center 1 - Front Right 5 - Rear Right 4 - Rear Left 3 - LFE Time per period = 0.203625
Then, I encode "st.wav" manually with `ffmpeg -i st.wav ff.ac3`.
This shows a comparison between the wav file written directly from the speaker-test directly (st.wav) and the ac3 file I encode with a manual ffmpeg command (ff.ac3): https://ptpb.pw/5XJR.png As you can see, everything is preserved but the LFE is made LFE.
And this shows a comparision between the the ac3 file from ffmpeg and the one written from the output of a52 plugin: https://ptpb.pw/YaKg.png If you compare carefully, you can see that Front Center and Rear Left is swapped, LFE and Rear Right is also swapped.
Here is a pair of ac3 samples that shows the problem clearly (a lady will be telling the channels one by one): Original: https://ptpb.pw/9XdC.ac3 ALSA a52 plugin re-encoded from mpv output: https://ptpb.pw/SQ_7.ac3