From 0e7f55cb0e8845200388703cfa255f35d9988500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Ma=C5=82ecki?= Date: Thu, 26 Sep 2019 13:12:24 +0200 Subject: [PATCH] Prevented 0 pktsInFlight to be used in calculation for loss percentage --- 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