Skip to content

Commit

Permalink
unused var fix
Browse files Browse the repository at this point in the history
  • Loading branch information
disa6302 committed Feb 23, 2024
1 parent 233a831 commit 3bc1961
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/source/PeerConnection/PeerConnection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1832,8 +1832,8 @@ STATUS twccManagerOnPacketSent(PKvsPeerConnection pKvsPeerConnection, PRtpPacket
ENTERS();
STATUS retStatus = STATUS_SUCCESS;
BOOL locked = FALSE;
UINT16 seqNum, updatedSeqNum;
PTwccRtpPacketInfo pTwccRtpPktInfo, tempTwccRtpPktInfo;
UINT16 seqNum;
PTwccRtpPacketInfo pTwccRtpPktInfo;

CHK(pKvsPeerConnection != NULL && pRtpPacket != NULL, STATUS_NULL_ARG);
CHK(pKvsPeerConnection->onSenderBandwidthEstimation != NULL && pKvsPeerConnection->pTwccManager != NULL, STATUS_SUCCESS);
Expand Down
20 changes: 9 additions & 11 deletions src/source/PeerConnection/Rtcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,9 @@ STATUS parseRtcpTwccPacket(PRtcpPacket pRtcpPacket, PTwccManager pTwccManager)
STATUS onRtcpTwccPacket(PRtcpPacket pRtcpPacket, PKvsPeerConnection pKvsPeerConnection)
{
STATUS retStatus = STATUS_SUCCESS;
PTwccManager twcc;
PTwccManager pTwccManager;
BOOL locked = FALSE;
BOOL empty = TRUE;
UINT64 sn = 0;
INT64 ageOfOldestPacket;
UINT64 localStartTimeKvs, localEndTimeKvs;
UINT64 sentBytes = 0, receivedBytes = 0;
UINT64 sentPackets = 0, receivedPackets = 0;
Expand All @@ -318,21 +316,21 @@ STATUS onRtcpTwccPacket(PRtcpPacket pRtcpPacket, PKvsPeerConnection pKvsPeerConn

MUTEX_LOCK(pKvsPeerConnection->twccLock);
locked = TRUE;
twcc = pKvsPeerConnection->pTwccManager;
CHK_STATUS(parseRtcpTwccPacket(pRtcpPacket, twcc));
sn = twcc->prevReportedBaseSeqNum;
pTwccManager = pKvsPeerConnection->pTwccManager;
CHK_STATUS(parseRtcpTwccPacket(pRtcpPacket, pTwccManager));
sn = pTwccManager->prevReportedBaseSeqNum;

// Use != instead to cover the case where the group of sequence numbers being checked
// are trending towards MAX_UINT16 and rolling over to 0+, example range [65534, 10]
// We also check for twcc->lastReportedSeqNum + 1 to include the last seq number in the
// report. Without this, we do not check for the seqNum that could cause it to not be cleared
// from memory
for (seqNum = sn; seqNum != (twcc->lastReportedSeqNum + 1); seqNum++) {
for (seqNum = sn; seqNum != (pTwccManager->lastReportedSeqNum + 1); seqNum++) {
if (!localStartTimeRecorded) {
// This could happen if the prev packet was deleted as part of rolling window or if there
// is an overlap of RTP packet statuses between TWCC packets. This could also fail if it is
// the first ever packet (seqNum 0)
if (hashTableGet(twcc->pTwccRtpPktInfosHashTable, seqNum - 1, &value) == STATUS_HASH_KEY_NOT_PRESENT) {
if (hashTableGet(pTwccManager->pTwccRtpPktInfosHashTable, seqNum - 1, &value) == STATUS_HASH_KEY_NOT_PRESENT) {
localStartTimeKvs = TWCC_PACKET_UNITIALIZED_TIME;
} else {
pTwccPacket = (PTwccRtpPacketInfo) value;
Expand All @@ -341,7 +339,7 @@ STATUS onRtcpTwccPacket(PRtcpPacket pRtcpPacket, PKvsPeerConnection pKvsPeerConn
}
if (localStartTimeKvs == TWCC_PACKET_UNITIALIZED_TIME) {
// time not yet set. If prev seqNum was deleted
if (STATUS_SUCCEEDED(hashTableGet(twcc->pTwccRtpPktInfosHashTable, seqNum, &value))) {
if (STATUS_SUCCEEDED(hashTableGet(pTwccManager->pTwccRtpPktInfosHashTable, seqNum, &value))) {
pTwccPacket = (PTwccRtpPacketInfo) value;
localStartTimeKvs = pTwccPacket->localTimeKvs;
localStartTimeRecorded = TRUE;
Expand All @@ -351,7 +349,7 @@ STATUS onRtcpTwccPacket(PRtcpPacket pRtcpPacket, PKvsPeerConnection pKvsPeerConn

// The time it would not succeed is if there is an overlap in the RTP packet status between the TWCC
// packets
if (STATUS_SUCCEEDED(hashTableGet(twcc->pTwccRtpPktInfosHashTable, seqNum, &value))) {
if (STATUS_SUCCEEDED(hashTableGet(pTwccManager->pTwccRtpPktInfosHashTable, seqNum, &value))) {
pTwccPacket = (PTwccRtpPacketInfo) value;
localEndTimeKvs = pTwccPacket->localTimeKvs;
duration = localEndTimeKvs - localStartTimeKvs;
Expand All @@ -360,7 +358,7 @@ STATUS onRtcpTwccPacket(PRtcpPacket pRtcpPacket, PKvsPeerConnection pKvsPeerConn
if (pTwccPacket->remoteTimeKvs != TWCC_PACKET_LOST_TIME) {
receivedBytes += pTwccPacket->packetSize;
receivedPackets++;
if (STATUS_SUCCEEDED(hashTableRemove(pKvsPeerConnection->pTwccManager->pTwccRtpPktInfosHashTable, seqNum))) {
if (STATUS_SUCCEEDED(hashTableRemove(pTwccManager->pTwccRtpPktInfosHashTable, seqNum))) {
SAFE_MEMFREE(pTwccPacket);
}
}
Expand Down
6 changes: 6 additions & 0 deletions tst/RtcpFunctionalityTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,12 @@ TEST_F(RtcpFunctionalityTest, onpli)

static void testBwHandler(UINT64 customData, UINT32 txBytes, UINT32 rxBytes, UINT32 txPacketsCnt, UINT32 rxPacketsCnt,
UINT64 duration) {
UNUSED_PARAM(customData);
UNUSED_PARAM(txBytes);
UNUSED_PARAM(rxBytes);
UNUSED_PARAM(txPacketsCnt);
UNUSED_PARAM(rxPacketsCnt);
UNUSED_PARAM(duration);
return;
}

Expand Down

0 comments on commit 3bc1961

Please sign in to comment.