Skip to content

Commit

Permalink
Fix skip_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdr428 committed Sep 21, 2023
1 parent 3bd1492 commit 051d59e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tsMuxer/ioContextDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,12 @@ void IOContextDemuxer::skip_bytes(const int64_t size)
int readRez = 0;
int64_t skipLeft = size;

if (skipLeft < m_bufEnd - m_curPos)
if (m_curPos < m_bufEnd)
{
m_curPos += skipLeft;
m_processedBytes += skipLeft;
return;
const int64_t copyLen = min(m_bufEnd - m_curPos, skipLeft);
skipLeft -= copyLen;
m_curPos += copyLen;
m_processedBytes += copyLen;
}

if (skipLeft > 2LL * m_fileBlockSize)
Expand Down

0 comments on commit 051d59e

Please sign in to comment.