Significantly Improving RTL_TCP’s Performance with Ring Buffers

Thank you to an anonymous contributor for bringing to attention a two part blog post by Stephen Blinick. Stephen's post details how the performance of rtl_tcp can be significantly improved by modifying to code to use a ring buffer instead of using semaphore based locking. If you weren't aware, rtl_tcp is a program that allows you to run your RTL-SDR remotely, and connect to it over a network connection.

The result is a tremendous performance improvement in rtl_tcp according to Stephen. Before the changes he noted that his Raspberry Pi 3B+ could only support a sample rate of 1.92 MSPS over WiFi, and even that had 1-2 seconds of lag. After the ring buffer changes his Pi 3B+ can handle the maximum sample rate of 3.2 MSPS with zero lag. On his Pi Zero W he can achieve a sample rate of 1.92 MSPS over WiFi with minimal lag, whereas before he could only achieve 0.92 MSPS with huge 5-10 second of lag.

The patch is available as a pull request over on the Osmocom GitHub.

Unfortunately this patch might not be included in the official upstreamed Osmocom drivers because Stephen submitted the patch as a pull request to the GitHub, and Osmocom only accept patches via their mailing list. If anyone reading this is familiar with the Osmocom patch submission requirements, we'd like to encourage you to help submit this patch for consideration.

Ring Buffer Patch for rtl_tcp
Ring Buffer Patch for rtl_tcp
Notify of

Inline Feedbacks
View all comments

Nice work. Ok I downloaded the binaries from your github branch and compiled them on RPi 3 B+. The voice quality has been improved even on a 4G Internet connection through my VPN. RTL_TCP works fine but at 1M Sampling Rate. However, I noticed on thing when I use community plugins like tet-ra to demodulate the received signal on my computer from RPi3 through this rtl_tcp connection the VFO locked frequency starts shifting left and right and then comes to center again shifts and it keeps on drifting and repositioning itself. Any comment on it please?

Tibi, HA4TI

I’ve just installed this branch and the performance improvement is indeed spectacular! When I transmit with my handheld radio, I can hear myself after 2 seconds, instead of 10! Woo-hoo! Kudos to Stephen!


Sounds nice. Is this patch suitable to direct sampling mod for HF?