@@ -161,15 +161,10 @@ int CRcvBufferNew::insert(CUnit* unit)
161
161
162
162
int CRcvBufferNew::dropUpTo (int32_t seqno)
163
163
{
164
- // Can drop only when nothing to read, and
165
- // first unacknowledged packet is missing.
166
- SRT_ASSERT (m_iStartPos == m_iFirstNonreadPos);
167
-
168
164
IF_RCVBUF_DEBUG (ScopedLog scoped_log);
169
165
IF_RCVBUF_DEBUG (scoped_log.ss << " CRcvBufferNew::dropUpTo: seqno " << seqno << " m_iStartSeqNo " << m_iStartSeqNo);
170
166
171
167
int len = CSeqNo::seqoff (m_iStartSeqNo, seqno);
172
- SRT_ASSERT (len > 0 );
173
168
if (len <= 0 )
174
169
{
175
170
IF_RCVBUF_DEBUG (scoped_log.ss << " . Nothing to drop." );
@@ -180,34 +175,32 @@ int CRcvBufferNew::dropUpTo(int32_t seqno)
180
175
if (m_iMaxPosInc < 0 )
181
176
m_iMaxPosInc = 0 ;
182
177
183
- // Check that all packets being dropped are missing.
184
178
const int iDropCnt = len;
185
179
while (len > 0 )
186
180
{
187
- if (m_entries[m_iStartPos].pUnit != NULL )
181
+ CUnit* pUnit = m_entries[m_iStartPos].pUnit ;
182
+ if (pUnit != NULL )
188
183
{
184
+ if (!m_tsbpd.isEnabled () && m_bMessageAPI && !pUnit->m_Packet .getMsgOrderFlag ())
185
+ --m_numOutOfOrderPackets;
189
186
releaseUnitInPos (m_iStartPos);
190
187
}
191
-
192
- if (m_entries[m_iStartPos].status != EntryState_Empty)
193
- {
194
- SRT_ASSERT (m_entries[m_iStartPos].status == EntryState_Drop || m_entries[m_iStartPos].status == EntryState_Read);
195
- m_entries[m_iStartPos].status = EntryState_Empty;
196
- }
197
-
188
+ m_entries[m_iStartPos].status = EntryState_Empty;
198
189
SRT_ASSERT (m_entries[m_iStartPos].pUnit == NULL && m_entries[m_iStartPos].status == EntryState_Empty);
199
190
m_iStartPos = incPos (m_iStartPos);
200
191
--len;
201
192
}
202
193
203
194
// Update positions
204
195
m_iStartSeqNo = seqno;
205
- // Move forward if there are "read" entries.
196
+ // Move forward if there are "read/drop " entries.
206
197
releaseNextFillerEntries ();
207
198
// Set nonread position to the starting position before updating,
208
199
// because start position was increased, and preceeding packets are invalid.
209
200
m_iFirstNonreadPos = m_iStartPos;
210
201
updateNonreadPos ();
202
+ if (!m_tsbpd.isEnabled () && m_bMessageAPI)
203
+ updateFirstReadableOutOfOrder ();
211
204
return iDropCnt;
212
205
}
213
206
0 commit comments