Feburary 2, 2024
Christmas 2023 was good to me and brought a Denon DRA-900H stereo receiver to replace a 25-year-old Onkyo that worked, technically. The Denon brings with it several cool features, including six HDMI inputs including ARC, Bluetooth, TOSLINK input for the CD player, a remote control that actually functions, and the star of today's show: AirPlay.
To play audio wirelessly to the Onkyo from another device, it was connected to a Pi 3 running LibreELEC and configured to also act as a Bluetooth sound receiver. This worked perfectly from my phone, but my computer was unable to play more than about 5 seconds of audio over Bluetooth without stuttering and popping, and eventually I gave up trying to find the cause. (I still theorize it might be something to do with my Intel Wireless 7265 card's integrated Bluetooth, which also has issues in LE mode that other cards don't exhibit, but I don't have any real evidence to support this. I also seem to recall the problem happening on the Qualcomm QCA6174 that my computer came with.)
When I realized that the Denon supported AirPlay, I immediately
tried to use it from my computer. With PipeWire, setting up
AirPlay is as simple as configuring Avahi (and/or firewall
configuration as needed), then running pactl load-module
module-raop-discover
. PipeWire will discover the AirPlay
sink advertised by the Denon and it will appear as a global
audio sink. I use Plasma, so I open the Plasma audio popup and
set the audio output to the Denon.
When I first got the Denon, I tried to play to it via AirPlay but no sound came out. With a lot of digging, I found this PipeWire bug report which links to some code changes that add latency values if an AirPlay sink doesn't report latency on its own. This change hadn't been merged into a PipeWire release, so I tested the main branch on my Quartz64...and it worked! Audio came through loud and clear.
With the fix in sight, I waited for the next PipeWire release, which turned out to be version 1.0. Unfortunately, it still didn't work on my main laptop, so I put the problem aside for a bit, until the most recent release (1.0.2-1 in the Arch repos). PipeWire could discover the Denon, it would appear as a sink, but once again, no audio would play.
After some more sleuthing, I found that the Denon was trying to send some kind of data back to the computer over UDP port 6002. I keep ufw running with all incoming connections denied except for specific rules, and after adding an ALLOW IN rule for UDP 6002, the Denon made sound!
The only issue left is that playing audio via VLC sounds terrible. It stutters, it cuts out, and it sounds kind of like it's being resampled very poorly. I don't know why this happens, but Firefox and mpg123, so that's enough for me.