A RetroSearch Logo

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

Search Query:

Showing content from https://github.com/Haivision/srt/commit/167b8e5031ee4e0aed9a49365a7f458e53c1f68b below:

[core] Fixed group drift synchronization (#2139) · Haivision/srt@167b8e5 · GitHub

File tree Expand file treeCollapse file tree 7 files changed

+29

-68

lines changed

Filter options

Expand file treeCollapse file tree 7 files changed

+29

-68

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

@@ -1549,8 +1549,8 @@ CPacket* CRcvBuffer::getRcvReadyPacket(int32_t seqdistance)

1549 1549

HLOGC(brlog.Debug, log << "getRcvReadyPacket: Sequence offset=" << seqdistance << " IS NOT RECEIVED.");

1550 1550

return 0;

1551 1551

}

1552 -

IF_HEAVY_LOGGING(int nskipped = 0);

1553 1552 1553 +

IF_HEAVY_LOGGING(int nskipped = 0);

1554 1554

for (int i = m_iStartPos, n = m_iLastAckPos; i != n; i = shiftFwd(i))

1555 1555

{

1556 1556

/*

@@ -1559,8 +1559,8 @@ CPacket* CRcvBuffer::getRcvReadyPacket(int32_t seqdistance)

1559 1559

if (m_pUnit[i] && m_pUnit[i]->m_iFlag == CUnit::GOOD)

1560 1560

{

1561 1561

HLOGC(brlog.Debug,

1562 -

log << "getRcvReadyPacket: Found next packet seq=%" << m_pUnit[i]->m_Packet.getSeqNo() << " ("

1563 -

<< nskipped << " empty cells skipped)");

1562 +

log << "getRcvReadyPacket: Found next packet seq=%" << m_pUnit[i]->m_Packet.getSeqNo() << " ("

1563 +

<< nskipped << " empty cells skipped)");

1564 1564

return &m_pUnit[i]->m_Packet;

1565 1565

}

1566 1566

IF_HEAVY_LOGGING(++nskipped);

@@ -1881,12 +1881,9 @@ void CRcvBuffer::setRcvTsbPdMode(const steady_clock::time_point& timebase, const

1881 1881

m_tsbpd.setTsbPdMode(timebase, no_wrap_check, delay);

1882 1882

}

1883 1883 1884 -

bool CRcvBuffer::addRcvTsbPdDriftSample(uint32_t timestamp_us,

1885 -

int rtt,

1886 -

steady_clock::duration& w_udrift,

1887 -

steady_clock::time_point& w_newtimebase)

1884 +

bool CRcvBuffer::addRcvTsbPdDriftSample(uint32_t timestamp_us, int rtt)

1888 1885

{

1889 -

return m_tsbpd.addDriftSample(timestamp_us, rtt, w_udrift, w_newtimebase);

1886 +

return m_tsbpd.addDriftSample(timestamp_us, rtt);

1890 1887

}

1891 1888 1892 1889

int CRcvBuffer::readMsg(char* data, int len)

Original file line number Diff line number Diff line change

@@ -411,12 +411,8 @@ class CRcvBuffer

411 411 412 412

/// Add packet timestamp for drift caclculation and compensation

413 413

/// @param [in] timestamp packet time stamp

414 -

/// @param [out] w_udrift current drift value

415 -

/// @param [out] w_newtimebase current TSBPD base time

416 -

bool addRcvTsbPdDriftSample(uint32_t timestamp,

417 -

int rtt,

418 -

duration& w_udrift,

419 -

time_point& w_newtimebase);

414 +

/// @param [in] rtt RTT sample

415 +

bool addRcvTsbPdDriftSample(uint32_t timestamp, int rtt);

420 416 421 417

#ifdef SRT_DEBUG_TSBPD_DRIFT

422 418

void printDriftHistogram(int64_t iDrift);

Original file line number Diff line number Diff line change

@@ -8324,17 +8324,14 @@ void srt::CUDT::processCtrlAckAck(const CPacket& ctrlpkt, const time_point& tsAr

8324 8324

// srt_recvfile (which doesn't make any sense), you'll have a deadlock.

8325 8325

if (m_config.bDriftTracer)

8326 8326

{

8327 -

steady_clock::duration udrift(0);

8328 -

steady_clock::time_point newtimebase;

8329 -

const bool drift_updated SRT_ATR_UNUSED = m_pRcvBuffer->addRcvTsbPdDriftSample(ctrlpkt.getMsgTimeStamp(),

8330 -

rtt, (udrift), (newtimebase));

8327 +

const bool drift_updated SRT_ATR_UNUSED = m_pRcvBuffer->addRcvTsbPdDriftSample(ctrlpkt.getMsgTimeStamp(), rtt);

8331 8328

#if ENABLE_EXPERIMENTAL_BONDING

8332 8329

if (drift_updated && m_parent->m_GroupOf)

8333 8330

{

8334 8331

ScopedLock glock(s_UDTUnited.m_GlobControlLock);

8335 8332

if (m_parent->m_GroupOf)

8336 8333

{

8337 -

m_parent->m_GroupOf->synchronizeDrift(this, udrift, newtimebase);

8334 +

m_parent->m_GroupOf->synchronizeDrift(this);

8338 8335

}

8339 8336

}

8340 8337

#endif

Original file line number Diff line number Diff line change

@@ -2725,48 +2725,24 @@ const char* CUDTGroup::StateStr(CUDTGroup::GroupState st)

2725 2725

return unknown;

2726 2726

}

2727 2727 2728 -

void CUDTGroup::synchronizeDrift(CUDT* cu, steady_clock::duration udrift, steady_clock::time_point newtimebase)

2728 +

void CUDTGroup::synchronizeDrift(const srt::CUDT* srcMember)

2729 2729

{

2730 +

SRT_ASSERT(srcMember != NULL);

2730 2731

ScopedLock glock(m_GroupLock);

2731 - 2732 -

bool wrap_period = false;

2733 - 2734 -

bool anycheck = false;

2735 - 2736 -

for (gli_t gi = m_Group.begin(); gi != m_Group.end(); ++gi)

2737 -

{

2738 -

// Skip non-connected; these will be synchronized when ready

2739 -

if (gi->laststatus != SRTS_CONNECTED)

2740 -

continue;

2741 - 2742 -

// Skip the entity that has reported this

2743 -

if (cu == &gi->ps->core())

2744 -

continue;

2745 - 2746 -

steady_clock::time_point this_timebase;

2747 -

steady_clock::duration this_udrift(0);

2748 -

bool wrp = false;

2749 -

gi->ps->core().m_pRcvBuffer->getInternalTimeBase((this_timebase), (wrp), (this_udrift));

2750 - 2751 -

udrift = std::min(udrift, this_udrift);

2752 -

steady_clock::time_point new_newtimebase = std::min(newtimebase, this_timebase);

2753 -

if (new_newtimebase != newtimebase)

2754 -

{

2755 -

wrap_period = wrp;

2756 -

}

2757 -

newtimebase = new_newtimebase;

2758 -

anycheck = true;

2759 -

}

2760 - 2761 -

if (!anycheck)

2732 +

if (m_Group.size() <= 1)

2762 2733

{

2763 2734

HLOGC(grlog.Debug, log << "GROUP: synch uDRIFT NOT DONE, no other links");

2764 2735

return;

2765 2736

}

2766 2737 2738 +

steady_clock::time_point timebase;

2739 +

steady_clock::duration udrift(0);

2740 +

bool wrap_period = false;

2741 +

srcMember->m_pRcvBuffer->getInternalTimeBase((timebase), (wrap_period), (udrift));

2742 + 2767 2743

HLOGC(grlog.Debug,

2768 -

log << "GROUP: synch uDRIFT=" << FormatDuration(udrift) << " TB=" << FormatTime(newtimebase) << "("

2769 -

<< (wrap_period ? "" : "NO ") << "wrap period)");

2744 +

log << "GROUP: synch uDRIFT=" << FormatDuration(udrift) << " TB=" << FormatTime(timebase) << "("

2745 +

<< (wrap_period ? "" : "NO ") << "wrap period)");

2770 2746 2771 2747

// Now that we have the minimum timebase and drift calculated, apply this to every link,

2772 2748

// INCLUDING THE REPORTER.

@@ -2776,8 +2752,11 @@ void CUDTGroup::synchronizeDrift(CUDT* cu, steady_clock::duration udrift, steady

2776 2752

// Skip non-connected; these will be synchronized when ready

2777 2753

if (gi->laststatus != SRTS_CONNECTED)

2778 2754

continue;

2755 +

CUDT& member = gi->ps->core();

2756 +

if (srcMember == &member)

2757 +

continue;

2779 2758 2780 -

gi->ps->core().m_pRcvBuffer->applyGroupDrift(newtimebase, wrap_period, udrift);

2759 +

member.m_pRcvBuffer->applyGroupDrift(timebase, wrap_period, udrift);

2781 2760

}

2782 2761

}

2783 2762 Original file line number Diff line number Diff line change

@@ -798,7 +798,10 @@ class CUDTGroup

798 798

// Live state synchronization

799 799

bool getBufferTimeBase(srt::CUDT* forthesakeof, time_point& w_tb, bool& w_wp, duration& w_dr);

800 800

bool applyGroupSequences(SRTSOCKET, int32_t& w_snd_isn, int32_t& w_rcv_isn);

801 -

void synchronizeDrift(srt::CUDT* cu, duration udrift, time_point newtimebase);

801 + 802 +

/// @brief Synchronize TSBPD base time and clock drift among members using the @a srcMember as a reference.

803 +

/// @param srcMember a reference for synchronization.

804 +

void synchronizeDrift(const srt::CUDT* srcMember);

802 805 803 806

void updateLatestRcv(srt::CUDTSocket*);

804 807 Original file line number Diff line number Diff line change

@@ -103,10 +103,7 @@ drift_logger g_drift_logger;

103 103 104 104

#endif // SRT_DEBUG_TRACE_DRIFT

105 105 106 -

bool CTsbpdTime::addDriftSample(uint32_t usPktTimestamp,

107 -

int usRTTSample,

108 -

steady_clock::duration& w_udrift,

109 -

steady_clock::time_point& w_newtimebase)

106 +

bool CTsbpdTime::addDriftSample(uint32_t usPktTimestamp, int usRTTSample)

110 107

{

111 108

if (!m_bTsbPdMode)

112 109

return false;

@@ -149,9 +146,6 @@ bool CTsbpdTime::addDriftSample(uint32_t usPktTimestamp,

149 146

log << "DRIFT=" << FormatDuration(tdDrift) << " TB REMAINS: " << FormatTime(m_tsTsbPdTimeBase));

150 147

}

151 148 152 -

w_udrift = tdDrift;

153 -

w_newtimebase = m_tsTsbPdTimeBase;

154 - 155 149

#if SRT_DEBUG_TRACE_DRIFT

156 150

g_drift_logger.trace(usPktTimestamp,

157 151

usRTTSample,

Original file line number Diff line number Diff line change

@@ -67,14 +67,9 @@ class CTsbpdTime

67 67

///

68 68

/// @param [in] pktTimestamp Timestamp of the arrived ACKACK packet.

69 69

/// @param [in] usRTTSample RTT sample from an ACK-ACKACK pair.

70 -

/// @param [out] w_udrift Current clock drift value.

71 -

/// @param [out] w_newtimebase Current TSBPD base time.

72 70

///

73 71

/// @return true if TSBPD base time has changed, false otherwise.

74 -

bool addDriftSample(uint32_t pktTimestamp,

75 -

int usRTTSample,

76 -

steady_clock::duration& w_udrift,

77 -

steady_clock::time_point& w_newtimebase);

72 +

bool addDriftSample(uint32_t pktTimestamp, int usRTTSample);

78 73 79 74

/// @brief Handle timestamp of data packet when 32-bit integer carryover is about to happen.

80 75

/// When packet timestamp approaches CPacket::MAX_TIMESTAMP, the TSBPD base time should be

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