Skip to content

Commit

Permalink
[core] Fixed repeated use of countBytes
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko authored and rndi committed Nov 7, 2019
1 parent be1b304 commit 96103f7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions srtcore/buffer.cpp
Expand Up @@ -1693,6 +1693,8 @@ int CRcvBuffer::readMsg(char* data, int len, ref_t<SRT_MSGCTRL> r_msgctl)
while (p != (q + 1) % m_iSize)
{
const int pktlen = (int)m_pUnit[p]->m_Packet.getLength();
// When unitsize is less than pktlen, only a fragment is copied to the output 'data',
// but still the whole packet is removed from the receiver buffer.
if (pktlen > 0)
countBytes(-1, -pktlen, true);

Expand All @@ -1705,9 +1707,6 @@ int CRcvBuffer::readMsg(char* data, int len, ref_t<SRT_MSGCTRL> r_msgctl)
memcpy(data, m_pUnit[p]->m_Packet.m_pcData, unitsize);
data += unitsize;
rs -= unitsize;
/* we removed bytes form receive buffer */
countBytes(-1, -unitsize, true);


#if ENABLE_HEAVY_LOGGING
{
Expand Down

0 comments on commit 96103f7

Please sign in to comment.