diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2016-09-24 10:32:46 -0700 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2016-09-24 10:32:46 -0700 |
commit | 7217c6cc3d4dc81eaadde288826825a275c951ec (patch) | |
tree | cd387f17f0cb625ec5cf6fcced696a5392b5b7ea | |
parent | 7e9137de246362608b695acadf8251a69f67fde0 (diff) | |
parent | a7d2479de44f06610e91ff74405f0919133d8d4a (diff) |
Merge remote-tracking branch 'mbr0wn/uhd/recv'
-rw-r--r-- | gr-uhd/lib/usrp_source_impl.cc | 19 | ||||
-rw-r--r-- | gr-uhd/lib/usrp_source_impl.h | 3 |
2 files changed, 11 insertions, 11 deletions
diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc index ebfdf4abb2..b48b15165d 100644 --- a/gr-uhd/lib/usrp_source_impl.cc +++ b/gr-uhd/lib/usrp_source_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010-2015 Free Software Foundation, Inc. + * Copyright 2010-2016 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -70,6 +70,7 @@ namespace gr { io_signature::make(0, 0, 0), args_to_io_sig(stream_args)), usrp_block_impl(device_addr, stream_args, ""), + _recv_timeout(0.1), // seconds _tag_now(false), _issue_stream_cmd_on_start(issue_stream_cmd_on_start) { @@ -613,15 +614,13 @@ namespace gr { //In order to allow for low-latency: //We receive all available packets without timeout. //This call can timeout under regular operation... - size_t num_samps = _rx_stream->recv - (output_items, noutput_items, _metadata, 0.0); - - //If receive resulted in a timeout condition: - //We now receive a single packet with a large timeout. - if(_metadata.error_code == ::uhd::rx_metadata_t::ERROR_CODE_TIMEOUT) { - num_samps = _rx_stream->recv - (output_items, noutput_items, _metadata, 0.1, true/*one pkt*/); - } + size_t num_samps = _rx_stream->recv( + output_items, + noutput_items, + _metadata, + _recv_timeout, + true /* one packet -> minimize latency */ + ); #else size_t num_samps = _dev->get_device()->recv (output_items, noutput_items, _metadata, diff --git a/gr-uhd/lib/usrp_source_impl.h b/gr-uhd/lib/usrp_source_impl.h index f6225a7e35..ab0f5c62c4 100644 --- a/gr-uhd/lib/usrp_source_impl.h +++ b/gr-uhd/lib/usrp_source_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010-2013 Free Software Foundation, Inc. + * Copyright 2010-2016 Software Foundation, Inc. * * This file is part of GNU Radio * @@ -126,6 +126,7 @@ namespace gr { #ifdef GR_UHD_USE_STREAM_API ::uhd::rx_streamer::sptr _rx_stream; size_t _samps_per_packet; + double _recv_timeout; #endif bool _tag_now; ::uhd::rx_metadata_t _metadata; |