BlueGit

ict rusty-teams

fix(calls): network jitter only from audio streams

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-10-13 · 7 weeks ago

Hash
3665ed105b63c4ca6f17caf58517a1168c1efd32
Parent
cba98fdc
1 file changed +4 −1
crates/calling/src/health.rs +4 −1
@@ -224,7 +224,9 @@ pub fn health_from_stats(stats: &[RtcStats]) -> (HealthCounters, TransportDetail
224 224 counters.packets_received += inbound.received.packets_received;
225 225 counters.packets_lost += inbound.received.packets_lost.max(0) as u64;
226 226 counters.bytes_received += inbound.inbound.bytes_received;
227 counters.jitter_ms = counters.jitter_ms.max(inbound.received.jitter * 1000.);
227 if inbound.stream.kind == "audio" {
228 counters.jitter_ms = counters.jitter_ms.max(inbound.received.jitter * 1000.);
229 }
228 230 }
229 231 RtcStats::OutboundRtp(outbound) => {
230 232 counters.bytes_sent += outbound.sent.bytes_sent;
@@ -396,6 +398,7 @@ mod tests {
396 398 fn stats_parse_into_counters_and_transport_details() {
397 399 let stats = vec![
398 400 RtcStats::InboundRtp(InboundRtpStats {
401 stream: RtpStreamStats { kind: "audio".into(), ..Default::default() },
399 402 received: ReceivedRtpStreamStats { packets_received: 50, packets_lost: 5, jitter: 0.012 },
400 403 inbound: InboundRtpStreamStats { bytes_received: 4000, ..Default::default() },
401 404 ..Default::default()
@@ -224,7 +224,9 @@ pub fn health_from_stats(stats: &[RtcStats]) -> (HealthCounters, TransportDetail
224 counters.packets_received += inbound.received.packets_received;
224 counters.packets_received += inbound.received.packets_received;
225 counters.packets_lost += inbound.received.packets_lost.max(0) as u64;
225 counters.packets_lost += inbound.received.packets_lost.max(0) as u64;
226 counters.bytes_received += inbound.inbound.bytes_received;
226 counters.bytes_received += inbound.inbound.bytes_received;
227 counters.jitter_ms = counters.jitter_ms.max(inbound.received.jitter * 1000.);
227 if inbound.stream.kind == "audio" {
228 counters.jitter_ms = counters.jitter_ms.max(inbound.received.jitter * 1000.);
229 }
228 }
230 }
229 RtcStats::OutboundRtp(outbound) => {
231 RtcStats::OutboundRtp(outbound) => {
230 counters.bytes_sent += outbound.sent.bytes_sent;
232 counters.bytes_sent += outbound.sent.bytes_sent;
@@ -396,6 +398,7 @@ mod tests {
396 fn stats_parse_into_counters_and_transport_details() {
398 fn stats_parse_into_counters_and_transport_details() {
397 let stats = vec![
399 let stats = vec![
398 RtcStats::InboundRtp(InboundRtpStats {
400 RtcStats::InboundRtp(InboundRtpStats {
401 stream: RtpStreamStats { kind: "audio".into(), ..Default::default() },
399 received: ReceivedRtpStreamStats { packets_received: 50, packets_lost: 5, jitter: 0.012 },
402 received: ReceivedRtpStreamStats { packets_received: 50, packets_lost: 5, jitter: 0.012 },
400 inbound: InboundRtpStreamStats { bytes_received: 4000, ..Default::default() },
403 inbound: InboundRtpStreamStats { bytes_received: 4000, ..Default::default() },
401 ..Default::default()
404 ..Default::default()