Skip to content

Commit

Permalink
[core] Minor edits to the CRcvBuffer::getTimespan_ms().
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Oct 7, 2022
1 parent 9ed7392 commit c416971
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions srtcore/buffer_rcv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ int CRcvBuffer::getTimespan_ms() const
return 0;

const int lastpos = incPos(m_iStartPos, m_iMaxPosInc - 1);
// Should not happen if TSBPD is enabled (reading out of order is not allowed).
SRT_ASSERT(m_entries[lastpos].pUnit != NULL);
if (m_entries[lastpos].pUnit == NULL)
return 0;

int startpos = m_iStartPos;

while (m_entries[startpos].pUnit == NULL)
Expand All @@ -560,11 +565,6 @@ int CRcvBuffer::getTimespan_ms() const
if (m_entries[startpos].pUnit == NULL)
return 0;

// Should not happen
SRT_ASSERT(m_entries[lastpos].pUnit != NULL);
if (m_entries[lastpos].pUnit == NULL)
return 0;

const steady_clock::time_point startstamp =
getPktTsbPdTime(m_entries[startpos].pUnit->m_Packet.getMsgTimeStamp());
const steady_clock::time_point endstamp = getPktTsbPdTime(m_entries[lastpos].pUnit->m_Packet.getMsgTimeStamp());
Expand Down

0 comments on commit c416971

Please sign in to comment.