duncanthrax/scream

debugging jitter/choppiness?

leifwalsh opened this issue · 6 comments

I got this set up pretty easily (thank you! it's wonderful) and it mostly works great, except that once in a while, with no apparent external stimulus, the sound will go jittery/choppy for a single digit number of seconds before it recovers. The sound will cut out for fractions of a second, rapidly, and after a few seconds it usually recovers into a smooth stream, as if for a bit frames are getting dropped.

My setup is:

  • Windows 11 laptop connected over WiFi to a nearby home consumer router
  • Linux receiver connected to the router over Ethernet, I think outputting over alsa

I'm curious what you'd recommend I do to try to find the source of that jitter. It doesn't correspond to anything like high load (cpu, network, or otherwise) on either side, as far as I can tell. I can try to set up an Ethernet connection from the Windows laptop to the router, but I'd have to buy an adapter so I'd like to try to diagnose first before blindly replacing that.

I can run wireshark or tcpdump but I'm not really sure what I should be looking for.

Using netstat -i --udp -c I can see what I think is dropped packets (RX-DRP), and it doesn't increase significantly when this jitter occurs. I'm not sure if that is the right thing to measure, but if that means it's not dropped packets, then I wonder what to look for next?

Oh, and I'm using 5.1 channel output, with 16 bit 48kHz samples. Switching to 44.1kHz doesn't appear to help.

Using the 2.4 GHz router connection (802.11n) and the 5 GHz connection (802.11ac) both exhibit the same choppiness, but the 5 GHz one seems to have more lag.

Ok, I actually think I see the problem in the Windows Task Manager's WiFi Performance tab. During smooth operation, the send throughput hovers around 4.5Mbps steadily. The jitteriness corresponds to reduced send throughput, after which the send throughput goes up above that average for a bit, and it sounds like the audio is speeding up to catch up with the stream:

image

Disabling Packet Coalescing seems to have helped, there's still a bit of jitter but a lot less than before. Hopefully this helps someone.

I got an Ethernet adapter and everything's great now.