Fix div by 0 crash in stream timing stats (jitter)

This commit is contained in:
Srivats P 2023-10-14 12:05:21 +05:30
parent ebe6aef62d
commit e677dc7d16

View File

@ -81,7 +81,8 @@ StreamTiming::Stats StreamTiming::stats(uint portId, uint guid)
return stats; return stats;
stats.latency = timespecToNsecs(t.sumDelays)/t.countDelays; stats.latency = timespecToNsecs(t.sumDelays)/t.countDelays;
stats.jitter = t.sumJitter/(t.countDelays-1); if (t.countDelays > 1)
stats.jitter = t.sumJitter/(t.countDelays-1);
return stats; return stats;
} }