From 04cb61bfde40179dfc1a7553cd053d4cdc962c62 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Fri, 3 Dec 2021 06:29:56 -0700 Subject: [PATCH] moved tc stats to CCodecStream --- reflector/CodecStream.cpp | 29 ++++++++++++++++------------- reflector/CodecStream.h | 6 ------ 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/reflector/CodecStream.cpp b/reflector/CodecStream.cpp index a45a391..439321d 100644 --- a/reflector/CodecStream.cpp +++ b/reflector/CodecStream.cpp @@ -69,19 +69,6 @@ bool CCodecStream::Init() return true; } -void CCodecStream::Close(void) -{ - // close socket - keep_running = false; - m_TCReader->Close(); - - // kill threads - if ( m_Future.valid() ) - { - m_Future.get(); - } -} - //////////////////////////////////////////////////////////////////////////////////////// // get @@ -99,6 +86,22 @@ void CCodecStream::Thread() { Task(); } + // display stats + if (m_fPingMin >= 0.0) + { + char sz[64]; + double min = m_fPingMin * 1000.0; + double max = m_fPingMax * 1000.0; + double ave = (m_fPingCount > 0) ? m_fPingSum / m_fPingCount * 1000.0 : 0.0; + sprintf(sz, "ambed stats (ms) : %.1f/%.1f/%.1f", min, ave, max); + std::cout << sz << std::endl; + } + if (m_uiTimeoutPackets) + { + char sz[64]; + sprintf(sz, "ambed %d of %d packets timed out", m_uiTimeoutPackets, m_uiTotalPackets); + std::cout << sz << std::endl; + } } void CCodecStream::Task(void) diff --git a/reflector/CodecStream.h b/reflector/CodecStream.h index 19995d2..700be86 100644 --- a/reflector/CodecStream.h +++ b/reflector/CodecStream.h @@ -37,15 +37,9 @@ public: // initialization bool Init(); - void Close(void); // get uint16_t GetStreamId(void) const { return m_uiStreamId; } - double GetPingMin(void) const { return m_fPingMin; } - double GetPingMax(void) const { return m_fPingMax; } - double GetPingAve(void) const { return (m_fPingCount != 0) ? m_fPingSum/m_fPingCount : 0; } - uint32_t GetTotalPackets(void) const { return m_uiTotalPackets; } - uint32_t GetTimeoutPackets(void) const { return m_uiTimeoutPackets; } bool IsEmpty(void) const; // task