So, after two days of running various radio stations on three of my players pretty continuously, I have these observations.
- The XRUN occurs most often on my player that is trying to get wifi from inside a leather and wood box on the other side of a brick wall from the access point.
- Often the XRUN is followed by a period of timeouts.
- XRUN occurs occasionally on all players on some stations (I've seen it on FluxFM 80s, Scala, ClassicFM, AncientFM, Dandelion Radio)
- Swapping to a shorter and more expensive Ethernet cable reduced the occurrence significantly.
- There have been some cases where all three players hit the issue on the same station at the same time.
So, I think in my house, the issue is often a result of problems with my own internal networking, but occasionally is because of some issue in the feed itself.
Since improving the wifi to my most compromised player would be difficult, I have developed a little script that detects and ties to recover from the situation:
Code:
#!/bin/bash
#This is XRUN_restart.sh which restarts mpd playback if the last line of the mpd log contains "xrun" or the second last line contains "Failed to decode".
LASTLOG=$( tail -n 1 /var/log/mpd/log )
STATUS=$(mpc status)
if [[ $STATUS = *"playing"* && $LASTLOG = *"xrun"* ]];
then
# echo "xrun matched"
mpc stop
mpc play
else
LASTLOG=$( tail -n 2 /var/log/mpd/log )
if [[ $STATUS != *"playing"* && $LASTLOG = *"Failed to decode"* ]];
then
# echo "timeout matched"
mpc play
fi
fi
I run this every second by using this:
Code:
#!/bin/bash
while sleep 1; do ./XRUN_restart.sh; done
Not the most elegant solution, but it works for me. I leave it here in case anyone else wants to have their radio automatically try to restart when it drops because of poor networks.