Fix stream rate calculation when avg rate changes from 0 to > 0
Fixes #294
This commit is contained in:
parent
176fc7dd15
commit
018a8490cf
@ -187,6 +187,11 @@ void Port::setAveragePacketRate(double packetsPerSec)
|
|||||||
Q_ASSERT(false); // Unreachable!!
|
Q_ASSERT(false); // Unreachable!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if old avgPps is 0, new rate will be calculated as nan (infinity)
|
||||||
|
// because of divide by 0 (old avgPps) above - fix that
|
||||||
|
if (std::isnan(rate))
|
||||||
|
rate = packetsPerSec;
|
||||||
|
|
||||||
qDebug("cur stream pps = %g", s->averagePacketRate());
|
qDebug("cur stream pps = %g", s->averagePacketRate());
|
||||||
|
|
||||||
s->setAveragePacketRate(rate);
|
s->setAveragePacketRate(rate);
|
||||||
@ -261,6 +266,11 @@ void Port::setAverageBitRate(double bitsPerSec)
|
|||||||
Q_ASSERT(false); // Unreachable!!
|
Q_ASSERT(false); // Unreachable!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if old avgBps is 0, new rate will be calculated as nan (infinity)
|
||||||
|
// because of divide by 0 (old avgBps) above - fix that
|
||||||
|
if (std::isnan(rate))
|
||||||
|
rate = bitsPerSec/((s->frameLenAvg()+kEthOverhead)*8);
|
||||||
|
|
||||||
qDebug("cur stream pps = %g", s->averagePacketRate());
|
qDebug("cur stream pps = %g", s->averagePacketRate());
|
||||||
|
|
||||||
s->setAveragePacketRate(rate);
|
s->setAveragePacketRate(rate);
|
||||||
|
Loading…
Reference in New Issue
Block a user