From 6b720a9ea43be61e210f645615392a388a0dfdd0 Mon Sep 17 00:00:00 2001
From: Martin Braun <martin.braun@ettus.com>
Date: Mon, 21 Aug 2017 18:18:17 -0700
Subject: uhd: Parametrize recv timeout and single-packet option

usrp_source currently hard-codes timeout values. For high-performance
applications, it might be desirable to control the details of the call
to uhd::rx_streamer::recv(), which is now enabled.

Defaults are unchanged.
---
 gr-uhd/lib/usrp_source_impl.cc | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

(limited to 'gr-uhd/lib/usrp_source_impl.cc')

diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc
index 23b94c684f..e1fe14c5c5 100644
--- a/gr-uhd/lib/usrp_source_impl.cc
+++ b/gr-uhd/lib/usrp_source_impl.cc
@@ -71,6 +71,7 @@ namespace gr {
                     args_to_io_sig(stream_args)),
       usrp_block_impl(device_addr, stream_args, ""),
       _recv_timeout(0.1), // seconds
+      _recv_one_packet(true),
       _tag_now(false),
       _issue_stream_cmd_on_start(issue_stream_cmd_on_start)
     {
@@ -489,6 +490,15 @@ namespace gr {
         _tag_now = true;
     }
 
+    void
+    usrp_source_impl::set_recv_timeout(
+            const double timeout,
+            const bool one_packet
+    ) {
+        _recv_timeout = timeout;
+        _recv_one_packet = one_packet;
+    }
+
     bool
     usrp_source_impl::start(void)
     {
@@ -625,7 +635,7 @@ namespace gr {
           noutput_items,
           _metadata,
           _recv_timeout,
-          true /* one packet -> minimize latency */
+          _recv_one_packet
       );
 #else
       size_t num_samps = _dev->get_device()->recv
-- 
cgit v1.2.3