dheijl/swyh-rs

very high latency streaming to WiiM

shuffle2 opened this issue · 5 comments

I'm on Windows, streaming to "WiiM Amp" device.
The delay between audio on speakers connected to the windows computer and speakers on WiiM is 4-6 seconds, which seems extreme.

Do you happen to know if this is a known issue with WiiM Amp? or is something else going on?

I've tried pretty much all combination of settings available from swyh-rs

These are the things that affect latency:

  • the minimum latency under optimal conditions seems to be around 250 msecs
  • a good ethernet connection will normally have lower latency than wifi
  • the buffer size in the receiver determines the minimum latency. The bigger the buffer, the larger the latency, but also the smaller the chance that you'll suffer from stutter or drop-outs in the audio.
  • the streaming protocol also is responsible for some latency. From best to worst:
    • lpcm
    • wav/rf64
    • flac
  • finally a higher bit depth (24 bit vs 16) and a higher sampling rate (176/192 khz vs 44/48 khz) will fill the buffer of the receiver much faster resulting in a lower latency.

I did not find any reference to a configurable buffer size for your WiiM Amp in the documentation, so there is probably not much you can do.

fwiw, I did try with some foobar2k plugins and the latency went down to 2-3 seconds with https://www.foobar2000.org/components/view/foo_out_upnp , however it was still 4-6 seconds with https://www.foobar2000.org/components/view/foo_upnp
But yea, seems some delay is still imposed by the renderer.

Can you point me to the source code of foo_out_upnp? Perhaps it would show me where I can shave off some time.
As an alternative a Wireshark sniffer trace of a foo_out_upnp session with the 2-3 seconds delay could be helpful.

I doubt the source is available. That plugin appears to set the dlna renderer as the only output of foobar2k, as opposed to operating on the output of foobar2k, so my guess is the overhead that's getting removed is somewhere in the windows audio stack, but i haven't really looked into it.
I can sniff the traffic

I can sniff the traffic

That would be great!