From 1e5fc1e6797ec07b36a29fcdd15dff61d06393be Mon Sep 17 00:00:00 2001 From: Maxim Sharabayko Date: Mon, 4 Mar 2019 17:53:53 +0100 Subject: [PATCH] [apps] Fixed stats clearing condition --- apps/transmitmedia.cpp | 9 ++------- srtcore/core.h | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/apps/transmitmedia.cpp b/apps/transmitmedia.cpp index 356d84855..72b74d7d1 100644 --- a/apps/transmitmedia.cpp +++ b/apps/transmitmedia.cpp @@ -36,7 +36,6 @@ using namespace std; bool transmit_total_stats = false; -bool clear_stats = false; unsigned long transmit_bw_report = 0; unsigned long transmit_stats_report = 0; unsigned long transmit_chunk_size = SRT_LIVE_DEF_PLSIZE; @@ -618,8 +617,7 @@ bool SrtSource::Read(size_t chunk, bytevector& data) if (need_bw_report || need_stats_report) { CBytePerfMon perf; - srt_bstats(m_sock, &perf, clear_stats); - clear_stats = false; + srt_bstats(m_sock, &perf, need_stats_report && !transmit_total_stats); if (need_bw_report) { PrintSrtBandwidth(perf.mbpsBandwidth); @@ -627,7 +625,6 @@ bool SrtSource::Read(size_t chunk, bytevector& data) if (need_stats_report) { PrintSrtStats(m_sock, perf); - clear_stats = !transmit_total_stats; } } @@ -670,8 +667,7 @@ bool SrtTarget::Write(const bytevector& data) if (need_bw_report || need_stats_report) { CBytePerfMon perf; - srt_bstats(m_sock, &perf, clear_stats); - clear_stats = false; + srt_bstats(m_sock, &perf, need_stats_report && !transmit_total_stats); if (need_bw_report) { PrintSrtBandwidth(perf.mbpsBandwidth); @@ -679,7 +675,6 @@ bool SrtTarget::Write(const bytevector& data) if (need_stats_report) { PrintSrtStats(m_sock, perf); - clear_stats = !transmit_total_stats; } } diff --git a/srtcore/core.h b/srtcore/core.h index e31211674..8ad133570 100644 --- a/srtcore/core.h +++ b/srtcore/core.h @@ -732,7 +732,7 @@ class CUDT uint64_t m_ullRcvBytesDropTotal; int m_iRcvUndecryptTotal; uint64_t m_ullRcvBytesUndecryptTotal; - int64_t m_llSndDurationTotal; // total real time for sending + int64_t m_llSndDurationTotal; // total real time for sending uint64_t m_LastSampleTime; // last performance sample time int64_t m_llTraceSent; // number of packets sent in the last trace interval