diff options
| -rw-r--r-- | host/examples/rx_timed_samples.cpp | 4 | ||||
| -rw-r--r-- | host/lib/transport/vrt_packet_handler.hpp | 11 | 
2 files changed, 12 insertions, 3 deletions
| diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp index d2306c7c4..64da260d5 100644 --- a/host/examples/rx_timed_samples.cpp +++ b/host/examples/rx_timed_samples.cpp @@ -86,6 +86,10 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){              md, uhd::io_type_t::COMPLEX_FLOAT32,              uhd::device::RECV_MODE_ONE_PACKET          ); +        if (num_rx_samps == 0 and num_acc_samps > 0){ +            std::cout << "Got timeout before all samples received, possible packet loss, exiting loop..." << std::endl; +            break; +        }          if (num_rx_samps == 0) continue; //wait for packets with contents          std::cout << boost::format("Got packet: %u samples, %u secs, %u nsecs") diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp index 2a7f995a1..81420b39e 100644 --- a/host/lib/transport/vrt_packet_handler.hpp +++ b/host/lib/transport/vrt_packet_handler.hpp @@ -122,9 +122,14 @@ namespace vrt_packet_handler{              state.fragment_offset_in_samps = 0;              state.managed_buff = zc_iface->get_recv_buff();              recv_cb(state.managed_buff); //callback before vrt unpack -            _recv1_helper( -                state, metadata, tick_rate, vrt_header_offset_words32 -            ); +            try{ +                _recv1_helper( +                    state, metadata, tick_rate, vrt_header_offset_words32 +                ); +            }catch(const std::exception &e){ +                std::cerr << "Error (recv): " << e.what() << std::endl; +                return 0; +            }          }          //extract the number of samples available to copy | 
