A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Haivision/srt/commit/5773901bf2db9f05f2ecb4aa3557caa4558e25d8 below:

[core] Use SND buffer delay for TL Packet Drop · Haivision/srt@5773901 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+22

-19

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+22

-19

lines changed Original file line number Diff line number Diff line change

@@ -675,10 +675,14 @@ int CSndBuffer::getCurrBufSize(int& w_bytes, int& w_timespan)

675 675

return m_iCount;

676 676

}

677 677 678 -

CSndBuffer::time_point CSndBuffer::getOldestTime() const

678 +

CSndBuffer::duration CSndBuffer::getBufferingDelay(const time_point& tnow) const

679 679

{

680 +

ScopedLock lck(m_BufLock);

680 681

SRT_ASSERT(m_pFirstBlock);

681 -

return m_pFirstBlock->m_tsOriginTime;

682 +

if (m_iCount == 0)

683 +

return duration(0);

684 + 685 +

return tnow - m_pFirstBlock->m_tsOriginTime;

682 686

}

683 687 684 688

int CSndBuffer::dropLateData(int& w_bytes, int32_t& w_first_msgno, const steady_clock::time_point& too_late_time)

Original file line number Diff line number Diff line change

@@ -179,7 +179,9 @@ class CSndBuffer

179 179

int getAvgBufSize(int& bytes, int& timespan);

180 180

int getCurrBufSize(int& bytes, int& timespan);

181 181 182 -

time_point getOldestTime() const;

182 +

/// @brief Get the buffering delay of the oldest message in the buffer.

183 +

/// @return the delay value.

184 +

duration getBufferingDelay(const time_point& tnow) const;

183 185 184 186

uint64_t getInRatePeriod() const { return m_InRatePeriod; }

185 187

@@ -207,7 +209,7 @@ class CSndBuffer

207 209

static const int INPUTRATE_INITIAL_BYTESPS = BW_INFINITE;

208 210 209 211

private:

210 -

sync::Mutex m_BufLock; // used to synchronize buffer operation

212 +

mutable sync::Mutex m_BufLock; // used to synchronize buffer operation

211 213 212 214

struct Block

213 215

{

@@ -216,7 +218,7 @@ class CSndBuffer

216 218 217 219

int32_t m_iMsgNoBitset; // message number

218 220

int32_t m_iSeqNo; // sequence number for scheduling

219 -

time_point m_tsOriginTime; // block origin time (either provided from above or equials the time a message was submitted for sending.

221 +

time_point m_tsOriginTime; // block origin time (either provided from above or equals the time a message was submitted for sending.

220 222

time_point m_tsRexmitTime; // packet retransmission time

221 223

int m_iTTL; // time to live (milliseconds)

222 224 Original file line number Diff line number Diff line change

@@ -6338,31 +6338,28 @@ bool srt::CUDT::checkNeedDrop()

6338 6338

throw CUDTException(MJ_NOTSUP, MN_INVALBUFFERAPI, 0);

6339 6339

}

6340 6340 6341 -

int bytes, timespan_ms;

6342 -

// (returns buffer size in buffer units, ignored)

6343 -

m_pSndBuffer->getCurrBufSize((bytes), (timespan_ms));

6341 +

const time_point tnow = steady_clock::now();

6342 +

const int buffdelay_ms = count_milliseconds(m_pSndBuffer->getBufferingDelay(tnow));

6344 6343 6345 6344

// high threshold (msec) at tsbpd_delay plus sender/receiver reaction time (2 * 10ms)

6346 6345

// Minimum value must accomodate an I-Frame (~8 x average frame size)

6347 6346

// >>need picture rate or app to set min treshold

6348 6347

// >>using 1 sec for worse case 1 frame using all bit budget.

6349 6348

// picture rate would be useful in auto SRT setting for min latency

6350 6349

// XXX Make SRT_TLPKTDROP_MINTHRESHOLD_MS option-configurable

6351 -

int threshold_ms = 0;

6352 -

if (m_config.iSndDropDelay >= 0)

6353 -

{

6354 -

threshold_ms = std::max(m_iPeerTsbPdDelay_ms + m_config.iSndDropDelay, +SRT_TLPKTDROP_MINTHRESHOLD_MS) +

6355 -

(2 * COMM_SYN_INTERVAL_US / 1000);

6356 -

}

6350 +

const int threshold_ms = (m_config.iSndDropDelay >= 0)

6351 +

? std::max(m_iPeerTsbPdDelay_ms + m_config.iSndDropDelay, +SRT_TLPKTDROP_MINTHRESHOLD_MS)

6352 +

+ (2 * COMM_SYN_INTERVAL_US / 1000)

6353 +

: 0;

6357 6354 6358 6355

bool bCongestion = false;

6359 -

if (threshold_ms && timespan_ms > threshold_ms)

6356 +

if (threshold_ms && buffdelay_ms > threshold_ms)

6360 6357

{

6361 6358

// protect packet retransmission

6362 6359

enterCS(m_RecvAckLock);

6363 6360

int dbytes;

6364 6361

int32_t first_msgno;

6365 -

int dpkts = m_pSndBuffer->dropLateData((dbytes), (first_msgno), steady_clock::now() - milliseconds_from(threshold_ms));

6362 +

int dpkts = m_pSndBuffer->dropLateData((dbytes), (first_msgno), tnow - milliseconds_from(threshold_ms));

6366 6363

if (dpkts > 0)

6367 6364

{

6368 6365

enterCS(m_StatsLock);

@@ -6385,7 +6382,7 @@ bool srt::CUDT::checkNeedDrop()

6385 6382

}

6386 6383 6387 6384

HLOGC(aslog.Debug, log << "SND-DROP: %(" << realack << "-" << m_iSndCurrSeqNo << ") n="

6388 -

<< dpkts << "pkt " << dbytes << "B, span=" << timespan_ms << " ms, FIRST #" << first_msgno);

6385 +

<< dpkts << "pkt " << dbytes << "B, span=" << buffdelay_ms << " ms, FIRST #" << first_msgno);

6389 6386 6390 6387

#if ENABLE_EXPERIMENTAL_BONDING

6391 6388

// This is done with a presumption that the group

@@ -6413,10 +6410,10 @@ bool srt::CUDT::checkNeedDrop()

6413 6410

bCongestion = true;

6414 6411

leaveCS(m_RecvAckLock);

6415 6412

}

6416 -

else if (timespan_ms > (m_iPeerTsbPdDelay_ms / 2))

6413 +

else if (buffdelay_ms > (m_iPeerTsbPdDelay_ms / 2))

6417 6414

{

6418 6415

HLOGC(aslog.Debug,

6419 -

log << "cong, BYTES " << bytes << ", TMSPAN " << timespan_ms << "ms");

6416 +

log << "cong TIMESPAN " << buffdelay_ms << "ms");

6420 6417 6421 6418

bCongestion = true;

6422 6419

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4