From ef8ba13dd7b993a6d3036a51a15c8910887f1d4e Mon Sep 17 00:00:00 2001 From: Sektor van Skijlen Date: Fri, 4 Oct 2019 22:26:35 +0200 Subject: [PATCH] Prevented 0 pktsInFlight to be used in calculation for loss percentage (#888) --- srtcore/congctl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srtcore/congctl.cpp b/srtcore/congctl.cpp index c7f30088f..2292f8b01 100644 --- a/srtcore/congctl.cpp +++ b/srtcore/congctl.cpp @@ -494,7 +494,7 @@ class FileCC : public SrtCongestionControlBase const int pktsInFlight = m_parent->RTT() / m_dPktSndPeriod; const int numPktsLost = m_parent->sndLossLength(); - const int lost_pcent_x10 = (numPktsLost * 1000) / pktsInFlight; + const int lost_pcent_x10 = pktsInFlight > 0 ? (numPktsLost * 1000) / pktsInFlight : 0; HLOGC(mglog.Debug, log << "FileSmootherV2: LOSS: " << "sent=" << CSeqNo::seqlen(m_iLastAck, m_parent->sndSeqNo()) << ", inFlight=" << pktsInFlight