voelin-stream: let the retransmission test survive a loss at the very end
The relay drops every 25th RTP packet it forwards, retransmissions included, so which packet that is shifts with timing. Under load it can be the stream's last packet, and no later packet shows the viewer the hole to ask for, so the last of the 90 frames never arrived. One more, uncounted frame now follows them; a loss in the middle still shows up as a missing frame or a gap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8ca601e669
commit
a523f995ac
1 file changed
+8
-4
@@ -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:?}");
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user