Skip to content

Commit

Permalink
Prevented 0 pktsInFlight to be used in calculation for loss percentage (
Browse files Browse the repository at this point in the history
  • Loading branch information
ethouris authored and rndi committed Oct 4, 2019
1 parent c39b88a commit ef8ba13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion srtcore/congctl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ef8ba13

Please sign in to comment.