An un-related module-null-sink stutters when module-suspend-on-idle wakes up a hardware sink
I'm working on a piece of software that uses module-null-sink to make a networked device (an amateur radio transceiver) appear as a PulseAudio device. The app has the ability to resample to correct for clock drift between the radio and the PC, and the ability to get realtime priority. But I was still running into stutters that would happen unpredictably. Today I realized that they happen whenever I click play on a YouTube video on the same machine (with audio through my HDMI monitor).
Turns out the culprit is module-suspend-on-idle. When I hit play on YouTube, it wakes up my default (ALSA, snd-hda-intel) audio device, and for some reason this disturbs the timing on my module-null-sink. The client app playing from the null-sink's monitor sees 200-250ms of silence followed by a resumption of audio, and my app sending audio to the null sink sees its latency increase by the same amount (assuming its client-side buffer is big enough; if I leave it smaller, it drops packets from the radio).
I've confirmed that it's the resume from suspend that does it by unloading module-suspend-on-idle. I can start and stop playback on the ALSA device as much as I want with no effect on my null sink.
Expected behavior is that the null sink, being purely virtual, keeps soldiering on regardless of what the hardware is doing, as much as possible.