Dropped packets every 70 minutes

davidv
Posts: 2
Joined: Fri Apr 19, 2024 9:10 am

Dropped packets every 70 minutes

Postby davidv » Fri Apr 19, 2024 9:38 am

Hi
I'm building a client to stream the snapcast protocol on the ESP32, this is a TCP-based flow, which delivers a packet every ~33ms (PCM samples). The PCM samples are queued and played over I2S. These samples have a specific timestamp in which they must be played.

I'm having an issue where, every 70 minutes, the samples arrive to the ESP32 too late (the timestamp is in the past).
By doing a network capture, I saw that during these events, the ESP32 is *not* sending an ACK to the packet.
As there's no ACK, my server will retransmit after ~200ms (minimum RTO on Linux), then the ESP32 will send an ack *350ms after* the retransmission, totalling ~550ms to ACK the original packet. As my buffer is 500ms, this creates a gap where no samples are played.

My project is built in Rust, using the 'cargo-first' approach, and it uses the standard library (so, not no-std).

What could be the issue?? I've tried with two different boards, and both exhibit the same issue. I do not *think* it's related to DHCP leases, but am currently capturing data again to verify.


Maybe there's some kind of GC/cleanup tasks running on the ESP32 every 70 minutes, which takes priority over sending ACKs?

My project is here; I've blindly tried to increase RX buffers, MBOX sizes and moved some of the WIFI/IP/TCP code to IRAM, but there's been no change (other than higher memory usage).
Last edited by davidv on Sat Apr 20, 2024 10:12 am, edited 1 time in total.

greycon
Posts: 22
Joined: Fri Nov 03, 2023 9:59 pm

Re: Dropped packets every 70 minutes

Postby greycon » Fri Apr 19, 2024 4:28 pm

Hi, was going to take a look, but your link to the code is giving a 404?

davidv
Posts: 2
Joined: Fri Apr 19, 2024 9:10 am

Re: Dropped packets every 70 minutes

Postby davidv » Sat Apr 20, 2024 10:14 am

Had left a [ in the URL; the correct URL is https://github.com/DavidVentura/esp-snapcast

Who is online

Users browsing this forum: Bing [Bot] and 170 guests