After a while (several days) running an application reading a continuous audio stream from the SPDIF input with pulseaudio, the audio stream get stuck (no more data available) and the only way to unblock it is to kill the app and reload the drivers as followed on raspbian OS:
sudo killall alsactl
systemctl --user stop pulseaudio.socket
systemctl --user stop pulseaudio.service
sudo modprobe -r snd_soc_rpi_wm8804_soundcard
sudo modprobe -r snd_soc_wm8804_i2c
sudo modprobe snd_soc_wm8804_i2c
sudo modprobe snd_soc_rpi_wm8804_soundcard
systemctl --user start pulseaudio.service
systemctl --user start pulseaudio.socket
I would like to detect when I should run this procedure (ie when there is an input stream detected on the hardware but no available stream on pulseaudio), but I do not know how to check at the driver / hardware level if the SPDIF input is seeing a signal.
Any help would be appreciated !