From b2e20b7c3102878cfeb49f768025df2b19f08ccf Mon Sep 17 00:00:00 2001 From: Maxim Sharabayko Date: Mon, 17 Apr 2023 17:40:50 +0200 Subject: [PATCH] Reverted some testing changes. --- srtcore/buffer_tools.cpp | 19 +++++++------------ srtcore/buffer_tools.h | 8 ++++---- srtcore/core.cpp | 4 ---- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/srtcore/buffer_tools.cpp b/srtcore/buffer_tools.cpp index c113436fa2..cb75c8e476 100644 --- a/srtcore/buffer_tools.cpp +++ b/srtcore/buffer_tools.cpp @@ -138,21 +138,16 @@ void CRateEstimator::updateInputRate(const time_point& time, int pkts, int bytes const bool early_update = (m_InRatePeriod < INPUTRATE_RUNNING_US) && (m_iInRatePktsCount > INPUTRATE_MAX_PACKETS); const uint64_t period_us = count_microseconds(time - m_tsInRateStartTime); - if (!early_update && period_us < m_InRatePeriod) + if (!early_update && period_us <= m_InRatePeriod) return; + // Required Byte/sec rate (payload + headers) m_iInRateBytesCount += (m_iInRatePktsCount * CPacket::SRT_DATA_HDR_SIZE); - const int iNewRate = (int)(((int64_t)m_iInRateBytesCount * 1000000) / period_us); - - if (iNewRate > m_iInRateBps || m_InRatePeriod == INPUTRATE_FAST_START_US) - m_iInRateBps = iNewRate; - else - m_iInRateBps = avg_iir<16>(m_iInRateBps, iNewRate); - - LOGC(bslog.Note, - log << "updateInputRate: sample:" << (iNewRate * 8) / 1000 - << " kbps, new rate=" << (m_iInRateBps * 8) / 1000 << "kbps"); - m_iInRatePktsCount = 0; + m_iInRateBps = (int)(((int64_t)m_iInRateBytesCount * 1000000) / period_us); + HLOGC(bslog.Debug, + log << "updateInputRate: pkts:" << m_iInRateBytesCount << " bytes:" << m_iInRatePktsCount + << " rate=" << (m_iInRateBps * 8) / 1000 << "kbps interval=" << period_us); + m_iInRatePktsCount = 0; m_iInRateBytesCount = 0; m_tsInRateStartTime = time; diff --git a/srtcore/buffer_tools.h b/srtcore/buffer_tools.h index 0f47beda48..40dc0178fa 100644 --- a/srtcore/buffer_tools.h +++ b/srtcore/buffer_tools.h @@ -113,10 +113,10 @@ class CRateEstimator void resetInputRateSmpPeriod(bool disable = false) { setInputRateSmpPeriod(disable ? 0 : INPUTRATE_FAST_START_US); } -private: // Constants - static const uint64_t INPUTRATE_FAST_START_US = 500000; // 500 ms - static const uint64_t INPUTRATE_RUNNING_US = 100000; // 100 ms - static const int64_t INPUTRATE_MAX_PACKETS = 2000; // ~ 21 Mbps of 1316 bytes payload +private: // Constants + static const uint64_t INPUTRATE_FAST_START_US = 500000; // 500 ms + static const uint64_t INPUTRATE_RUNNING_US = 1000000; // 1000 ms + static const int64_t INPUTRATE_MAX_PACKETS = 2000; // ~ 21 Mbps of 1316 bytes payload static const int INPUTRATE_INITIAL_BYTESPS = BW_INFINITE; private: diff --git a/srtcore/core.cpp b/srtcore/core.cpp index 6a5109c015..27eca397c3 100644 --- a/srtcore/core.cpp +++ b/srtcore/core.cpp @@ -5583,10 +5583,6 @@ bool srt::CUDT::prepareConnectionObjects(const CHandShake &hs, HandshakeSide hsd if (eout) *eout = CUDTException(MJ_SYSTEMRES, MN_MEMORY, 0); m_RejectReason = SRT_REJ_RESOURCE; - if (eout) - { - *eout = CUDTException(MJ_SYSTEMRES, MN_MEMORY, 0); - } return false; }