修复获取webrtc推流丢包率除0的bug

This commit is contained in:
xiongziliang 2022-06-11 14:23:43 +08:00
parent f6b4eb418f
commit df7a3242bb

View File

@ -612,11 +612,11 @@ public:
} }
int getLossRate() { int getLossRate() {
if (!_rtcp_context.getExpectedPacketsInterval()) { auto expected = _rtcp_context.getExpectedPacketsInterval();
//_rtcp_context.getExpectedPacketsInterval()取值总为零? if (!expected) {
return 0; return 0;
} }
return _rtcp_context.geLostInterval() * 100 / _rtcp_context.getExpectedPacketsInterval(); return _rtcp_context.geLostInterval() * 100 / expected;
} }
private: private: