From 03f662e5ce27cd6e13677bed30d564a6aa1deee5 Mon Sep 17 00:00:00 2001 From: Dmytro Bogovych Date: Tue, 24 Feb 2026 12:49:39 +0300 Subject: [PATCH] - fix packet loss reporting --- src/engine/media/MT_AudioReceiver.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/engine/media/MT_AudioReceiver.cpp b/src/engine/media/MT_AudioReceiver.cpp index a5f550c6..70f0bbd4 100644 --- a/src/engine/media/MT_AudioReceiver.cpp +++ b/src/engine/media/MT_AudioReceiver.cpp @@ -238,11 +238,11 @@ RtpBuffer::FetchResult RtpBuffer::fetch() // Gap between new packet and previous on int gap = (int64_t)seqno - (int64_t)*mLastSeqno - 1; - gap = std::min(gap, 127); + // gap = std::min(gap, 127); if (gap > 0) { // std::cout << "Increase the packet loss for SSRC " << std::hex << mSsrc << std::endl; - mStat.mPacketLoss++; + mStat.mPacketLoss += gap; auto currentTimestamp = std::chrono::microseconds(uint64_t(packet.rtp()->GetReceiveTime().GetDouble() * 1000000)); if (mStat.mPacketLossTimeline.empty() || (mStat.mPacketLossTimeline.back().mEndSeqno != seqno)) @@ -251,8 +251,7 @@ RtpBuffer::FetchResult RtpBuffer::fetch() .mGap = gap, .mTimestamp = currentTimestamp}); - mLastSeqno = *mLastSeqno + 1; // As we deal with the audio gap - return the silence and increase last seqno - + mLastSeqno = seqno; result = {FetchResult::Status::Gap}; } else