Data buffering of rtl_tcp programm

Main forum to discuss RTL-SDR related topics.
Post Reply
Posts: 1
Joined: Sat Aug 24, 2019 5:23 pm

Data buffering of rtl_tcp programm

Post by bradleyrose » Sat Aug 24, 2019 5:24 pm


I'm using a RTL-SDR with a Rafael Micro R820T Tuner over a Raspberry Pi. For receiving the samples I'm using GNU Radio and a little Python script to calculate the spectrum and to show it in a QT-GUI.

Now the problem I have is that the Raspberry Pi is buffering the data and the PC which receives the samples is quite slow. When I plug out the RTL-SDR I can see the spectrum for at least 5 more seconds before a socket error occurs and the spectrum is not calculated anymore.

I already tried to start the rtl_tcp programm on the Rasberry with the option "-b 0" to deactivate the buffer but it didn't worked. If somebody has got an idea how to solve this problem i would be very happy!

Thank You!

Posts: 127
Joined: Sat Jan 14, 2017 11:07 pm

Re: Data buffering of rtl_tcp programm

Post by hotpaw2 » Sat Aug 24, 2019 5:56 pm

There are multiple buffers involved. All of them add latency.

The RTL chip will buffer IQ samples (sometimes close to 1 seconds worth) before sending them over USB to the Raspberry Pi server. On the Pi, the USB driver and rtl_tcp buffer what they receive over USB before sending the data over the network via TCP. Your PC OS will buffer incoming network packets before handing them to the SDR app. Then the SDR app usually buffers samples before displaying them.

The longest buffers might be inside the PC SDR app, for handing network latency jitter/delays/variations. Try unplugging the network cable to your PC (or disable networking on the PC), and see how long it takes the PC OS and PC SDR app buffers to drain. I do not know if the RTL chip can be told to buffer less data before sending it over USB.

Over WiFi, it gets even worse, as a WiFi access point and any other routers will also buffer data.

Post Reply