diff --git a/src/WBStreamTx.cpp b/src/WBStreamTx.cpp index 7eb6695a..2970491c 100644 --- a/src/WBStreamTx.cpp +++ b/src/WBStreamTx.cpp @@ -122,7 +122,7 @@ void WBStreamTx::loop_process_data() { if(options.dequeue_thread_max_realtime){ SchedulingHelper::setThreadParamsMaxRealtime(); } - const std::int64_t timeout_usecs=std::chrono::duration_cast(options.dequeue_timeout).count(); + static constexpr std::int64_t timeout_usecs=100*1000; if(options.enable_fec){ std::shared_ptr frame= nullptr; while (m_process_data_thread_run){ @@ -159,10 +159,6 @@ void WBStreamTx::loop_process_data() { m_queue_time_calculator.reset(); } process_enqueued_packet(*packet); - }else{ - if(options.dequeue_timeout_cb){ - options.dequeue_timeout_cb(*this); - } } } } diff --git a/src/WBStreamTx.h b/src/WBStreamTx.h index 879a071c..c70f9996 100644 --- a/src/WBStreamTx.h +++ b/src/WBStreamTx.h @@ -23,7 +23,6 @@ */ class WBStreamTx { public: - typedef std::function DEQUEUE_TIMEOUT_CB; struct Options { // needs to match the radio port of the corresponding rx uint8_t radio_port = 0; @@ -46,10 +45,6 @@ class WBStreamTx { std::shared_ptr opt_console=nullptr; // set sched_param = max realtime on the thread that dequeues and injects the packets bool dequeue_thread_max_realtime= true; - // Dirty, for openhd - function that is called from the dequeue thread every time the - // de-queueing of a packet timed out (no packet was fed for timeout ms) - std::chrono::microseconds dequeue_timeout=std::chrono::milliseconds(100); - DEQUEUE_TIMEOUT_CB dequeue_timeout_cb= nullptr; }; WBStreamTx(std::shared_ptr txrx,Options options,std::shared_ptr radiotap_header_holder); WBStreamTx(const WBStreamTx&) = delete; diff --git a/src/WBTxRx.cpp b/src/WBTxRx.cpp index 061ac4d3..1ddb23ec 100644 --- a/src/WBTxRx.cpp +++ b/src/WBTxRx.cpp @@ -767,8 +767,10 @@ void WBTxRx::recalculate_pollution_perc() { double perc_non_openhd_packets=(double)non_openhd_packets/(double)m_pollution_total_rx_packets*100.0; //m_console->debug("Link pollution: {}% [{}:{}]",perc_non_openhd_packets,non_openhd_packets,m_pollution_total_rx_packets); m_rx_stats.curr_link_pollution_perc=std::ceil(perc_non_openhd_packets); - //curr_link_pollution_perc=std::ceil() + //curr_link_pollution_perc=std::ceil(); } + const int elapsed_ms=static_cast(std::chrono::duration_cast(elapsed).count()); + m_rx_stats.curr_n_foreign_packets_pps=(int)non_openhd_packets * 1000 / elapsed_ms; m_pollution_total_rx_packets=0; m_pollution_openhd_rx_packets=0; } diff --git a/src/WBTxRx.h b/src/WBTxRx.h index 818eee3f..1aef01ed 100644 --- a/src/WBTxRx.h +++ b/src/WBTxRx.h @@ -192,6 +192,8 @@ class WBTxRx { int16_t curr_big_gaps_counter=-1; // Percentage of non openhd packets over total n of packets int curr_link_pollution_perc=0; + // N of non openhd packets in the last second + int curr_n_foreign_packets_pps=0; // Usefully for channel scan - n packets that are quite likely coming from an openhd air / ground unit (respective depending on if air/gnd mode) // But not validated - e.g. on a channel scan, session key packet(s) have not been received yet int curr_n_likely_openhd_packets=0;