diff --git a/crates/voelin-stream/tests/loopback.rs b/crates/voelin-stream/tests/loopback.rs index c2540ee..cda110b 100644 --- a/crates/voelin-stream/tests/loopback.rs +++ b/crates/voelin-stream/tests/loopback.rs @@ -232,19 +232,23 @@ async fn stream_noise( /// One media packet in 25 lost on the way to the viewer: the viewer asks /// again (NACK) and the streamer retransmits (RTX) before the depacketizer -/// gives up, so every frame arrives whole and in order. +/// gives up, so every frame arrives whole and in order. A NACK needs a later +/// packet to show the hole, so one more frame follows the 90 counted: a loss +/// at the very end (retransmissions shift which packet is the 25th) can only +/// cut that one. #[tokio::test(flavor = "multi_thread")] async fn losses_are_repaired_by_retransmission() { let _ = tracing_subscriber::fmt().with_env_filter("warn").with_test_writer().try_init(); let relay = Relay::new(Rule::LoseEvery(25)).await; let config = PeerConfig { bandwidth_estimation: false, ..PeerConfig::loopback() }; let (streamer, mut viewer) = connect(&config, &config, Some(&relay)).await; - // 3 s at 30 fps, 12 KB frames (about 10 packets each), keyframes of 60 KB. - let received = stream_noise(streamer, &mut viewer, (90, 30, 12_000), (30, 60_000)).await; + // 3 s at 30 fps, 12 KB frames (about 10 packets each), keyframes of 60 KB, + // and the one more frame. + let received = stream_noise(streamer, &mut viewer, (91, 30, 12_000), (30, 60_000)).await; let (media, lost) = relay.media(); eprintln!("{received:?}; relay: {lost} of {media} media packets lost"); assert!(lost >= 30, "the relay lost too little: {lost} of {media}"); - assert_eq!(received.frames, 90, "{received:?}"); + assert!(received.frames >= 90, "{received:?}"); assert_eq!(received.gaps, 0, "a loss reached the viewer: {received:?}"); }