Skip to content

Commit

Permalink
[apps] Fixed stats clearing condition
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko authored and rndi committed Apr 1, 2019
1 parent 9b51ce1 commit 1e5fc1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions apps/transmitmedia.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -618,16 +617,14 @@ 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);
}
if (need_stats_report)
{
PrintSrtStats(m_sock, perf);
clear_stats = !transmit_total_stats;
}
}

Expand Down Expand Up @@ -670,16 +667,14 @@ 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);
}
if (need_stats_report)
{
PrintSrtStats(m_sock, perf);
clear_stats = !transmit_total_stats;
}
}

Expand Down
2 changes: 1 addition & 1 deletion srtcore/core.h
Expand Up @@ -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
Expand Down

0 comments on commit 1e5fc1e

Please sign in to comment.