Hi,
Users of RPi's hdmi:vc4-hdmi report random channel swapping after an xrun. Tested (among other clients) on speaker-test, details https://forums.raspberrypi.com/viewtopic.php?p=2187582#p2187540
Experienced RPi developer has diagnosed the driver - HDMI device and DMA are correctly reset at xrun recovery (i.e. snd_pcm_stop(XRUN) in the driver -> snd_pcm_prepare in the client).
Therefore an option is that alsa supplies misaligned 8ch samples after the xrun recovery.
Users checked the older HDMI driver bcm2835_audio (bcm2835-pcm.c) which accepts standard S16/24_LE formats and does not require the iec958 plugin and xruns did not cause any channel swaps.
Hence aiming at the iec958 plugin. It seems to keep state (e.g. iec->counter) which perhaps may not be reset at snd_pcm_prepare.
Thanks a lot,
Pavel.