Skip to content

Commit

Permalink
[core] Refactored CRcvBuffer::isRcvDataReady(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko authored and rndi committed Oct 16, 2019
1 parent d7da7f5 commit 8e025fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
37 changes: 18 additions & 19 deletions srtcore/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1139,27 +1139,26 @@ bool CRcvBuffer::getRcvReadyMsg(ref_t<uint64_t> tsbpdtime, ref_t<int32_t> curpkt
*/
bool CRcvBuffer::isRcvDataReady(ref_t<uint64_t> tsbpdtime, ref_t<int32_t> curpktseq)
{
*tsbpdtime = 0;
*tsbpdtime = 0;

if (m_bTsbPdMode)
{
CPacket* pkt = getRcvReadyPacket();
if ( pkt )
{
/*
* Acknowledged data is available,
* Only say ready if time to deliver.
* Report the timestamp, ready or not.
*/
*curpktseq = pkt->getSeqNo();
*tsbpdtime = getPktTsbPdTime(pkt->getMsgTimeStamp());
if (*tsbpdtime <= CTimer::getTime())
return true;
}
return false;
}
if (m_bTsbPdMode)
{
CPacket* pkt = getRcvReadyPacket();
if (!pkt)
return false;

/*
* Acknowledged data is available,
* Only say ready if time to deliver.
* Report the timestamp, ready or not.
*/
*curpktseq = pkt->getSeqNo();
*tsbpdtime = getPktTsbPdTime(pkt->getMsgTimeStamp());

return (*tsbpdtime <= CTimer::getTime());
}

return isRcvDataAvailable();
return isRcvDataAvailable();
}

// XXX This function may be called only after checking
Expand Down
7 changes: 6 additions & 1 deletion srtcore/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class CSndBuffer
CSndBuffer(int size = 32, int mss = 1500);
~CSndBuffer();

public:

/// Insert a user buffer into the sending list.
/// @param [in] data pointer to the user data block.
/// @param [in] len size of the block.
Expand Down Expand Up @@ -245,6 +247,9 @@ class CRcvBuffer
CRcvBuffer(CUnitQueue* queue, int bufsize_pkts = 65536);
~CRcvBuffer();


public:

/// Write data into the buffer.
/// @param [in] unit pointer to a data unit containing new packet
/// @param [in] offset offset from last ACK point.
Expand Down Expand Up @@ -304,7 +309,7 @@ class CRcvBuffer
/// Query how many data of the receive buffer is acknowledged.
/// @param [in] now current time in us.
/// @return none.

void updRcvAvgDataSize(uint64_t now);
#endif /* SRT_ENABLE_RCVBUFSZ_MAVG */

Expand Down

0 comments on commit 8e025fc

Please sign in to comment.