Skip to content

Commit

Permalink
Reverted some testing changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Apr 17, 2023
1 parent 0c88569 commit b2e20b7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
19 changes: 7 additions & 12 deletions srtcore/buffer_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions srtcore/buffer_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b2e20b7

Please sign in to comment.