Project

General

Profile

Bug #3589

Zerocopy Buffers Unusable Outside Callback Without memcpy()

Added by xloem about 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
09/25/2018
Due date:
% Done:

0%


Description

1. In May 2018, rtl-sdr was improved to work directly with DMA sample buffers http://git.osmocom.org/rtl-sdr/commit/?id=a854ae8b48d42e8dad514c75d3a4c6cfb62707da
There is now no need for a memcpy() call if all processing is done in the callback function.

2. Unfortunately, major uses of librtlsdr process the data in another thread rather than the callback function. This is how gr-osmosdr and soapyrtl function.

3. Additionally, tracking buffer backlog requires returning from the callback rapidly, so that buffers can be counted as they are received. This is how gr-osmosdr behaves, outputting 'O' when processing is too slow: http://git.osmocom.org/gr-osmosdr/tree/lib/rtl/rtl_source_c.cc#n307
This lets the user of a high-level library know when latency is corrupting their stream, and currently requires the use of an extra memcpy() call.

4. These high-level libraries could take advantage of the DMA buffer improvement if there were a way to get buffers to stay alive after return from the callback.

After managing to listen to some concerns on the chat, I've posted an updated patch to the mailing list for this: http://lists.osmocom.org/pipermail/osmocom-sdr/2018-September/001830.html

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)