rtp/session: guard against a busy wait with no members

If the number of members is 0, then the calculated time to the next rtcp
wakup would be 'now' and could result in a busy loop in the rtcp
processing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1618>
This commit is contained in:
Matthew Waters 2024-06-12 17:50:03 +10:00 committed by GStreamer Marge Bot
parent 84a9f9c61f
commit 2d1f556794

View file

@ -1352,8 +1352,10 @@ impl Session {
"members {n}, RTCP bandwidth {rtcp_bw}, average RTCP size {}",
self.average_rtcp_size
);
let t_nanos = (compensation_ns
.mul_div_round(self.average_rtcp_size as u64 * n, rtcp_bw.max(1) as u64))
let t_nanos = (compensation_ns.mul_div_round(
self.average_rtcp_size as u64 * n.max(1),
rtcp_bw.max(1) as u64,
))
.unwrap()
.max(min_rtcp_interval.as_nanos() as u64);
trace!("deterministic rtcp interval {t_nanos}ns");