Skip to content

Commit

Permalink
Merged changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikolaj Malecki committed Jun 18, 2024
1 parent 1f6ac3d commit fa70fda
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
15 changes: 15 additions & 0 deletions srtcore/buffer_rcv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,20 @@ void CRcvBuffer::updateGapInfo()
m_iDropOff = 0;
if (m_iEndOff < m_iMaxPosOff)
{
CPos start = incPos(m_iStartPos, m_iEndOff + 1),
end = incPos(m_iStartPos, m_iEndOff);

for (CPos i = start; i != end; i = incPos(i))
{
if (m_entries[i].status == EntryState_Avail)
{
m_iDropOff = offPos(m_iStartPos, i);
break;
}
}

/* OPTIMIZED, but buggy.
int maxend = m_szSize - m_iStartPos VALUE;
int ifrom = m_iEndOff + 1;
int ito = m_iMaxPosOff VALUE;
Expand Down Expand Up @@ -463,6 +477,7 @@ void CRcvBuffer::updateGapInfo()
}
}
}
*/

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.

// Must be found somewhere, worst case at the position
// of m_iMaxPosOff-1. If no finding loop caught it somehow,
Expand Down
12 changes: 6 additions & 6 deletions srtcore/buffer_rcv.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ const int CPos_TRAP = -1;
// NOTE: in scrap region, the first cell is empty and the last one filled.
// SPARE REGION: Region without packets
//
// | BUSY REGION |
// | | | |
// | ICR | SCRAP REGION | SPARE REGION...->
// ......->| | | |
// | FIRST-GAP | |
// | BUSY REGION |
// | | | |
// | ICR | SCRAP REGION | SPARE REGION...->
// ......->| | | |
// | /FIRST-GAP | |
// |<------------------- m_szSize ---------------------------->|
// | |<------------ m_iMaxPosOff ----------->| |
// | | | | | |
// | | | | | |
// +---+---+---+---+---+---+---+---+---+---+---+---+---+ +---+
// | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 |...| 0 | m_pUnit[]
// +---+---+---+---+---+---+---+---+---+---+---+---+---+ +---+
Expand Down

0 comments on commit fa70fda

Please sign in to comment.