Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion quest/m1/test-flakes-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Public API: none. Wire: none.
## Required

- [TS decoded content](/quest/m1/test-flakes-2/ts-video-content.md) - CI's TS compliance decoded-content checks fail only on real loss, and the exporter names every frame it drops
- [TS resume late frames](/quest/m1/test-flakes-2/ts-resume-late-frames.md) - the same-instance TS resume test keeps its late frames, fixed in production or the fixture as the evidence says
- [WebTransport close release](/quest/m1/test-flakes-2/interop-close-release.md) - a compatible published adapter contains the acknowledged-close fix
- [Interop close code](/quest/m1/test-flakes-2/interop-close-code.md) - adopt that release so the browser reliably sees `unauthorized` for a refused session
- [Auth refresh mocks time](/quest/m1/test-flakes-2/auth-refresh-mock-time.md) - moq-relay's auth refresh and fixed-lease tests measure a grant's life on one mocked clock
Expand Down
32 changes: 0 additions & 32 deletions quest/m1/test-flakes-2/ts-resume-late-frames.md

This file was deleted.

47 changes: 25 additions & 22 deletions rs/moq-cli/tests/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ use tokio::task::JoinHandle;
const TIMEOUT: Duration = Duration::from_secs(30);
/// About three seconds of HEVC and Opus.
const CLIP: &[u8] = include_bytes!("../../moq-mux/src/container/ts/test_data/bbb_cbr.ts");
/// Five seconds of the same capture at the same rate, which leaves media to come once an export
/// has waited out the PCR-rate window and its delay (`ffmpeg -i scte35/bbb5s.ts -c copy
/// -muxrate 400000 -f mpegts bbb5s_cbr.ts`).
const LONG: &[u8] = include_bytes!("../../moq-mux/src/container/ts/test_data/bbb5s_cbr.ts");
/// Fragmented AV1, which the TS export does not carry.
const AV1: &[u8] = include_bytes!("../../moq-mux/src/container/fmp4/test_data/av1.mp4");

Expand Down Expand Up @@ -508,18 +512,23 @@ async fn the_same_instance_within_the_linger_continues() {

// Continue one capture across a transport loss. Replaying its beginning in a fresh
// importer would change the catalog clock and reuse groups for already sent content.
// The TS catalog waits for its PCR-rate measurement; a fixed midpoint can still
// be behind that gate. Publish to the measured rate, leaving the new tail unread.
// The capture keeps its schedule throughout, as a live one does: the export releases
// each frame a delay after its time, so pausing the capture while the export joins or
// the publisher reconnects would make the rest late by the pause, and dropped. The
// interval bursts whatever a stall held back. The export joins after the catalog's
// PCR-rate window and writes a delay after that, so publish until it has written.
let mut pace = tokio::time::interval(Duration::from_millis(150));
let mut chunks = LONG.chunks(188 * 40);
let mut split = 0;
for chunk in CLIP.chunks(188 * 40) {
feed(&mut import, chunk).await;
while output.lock().unwrap().is_empty()
&& let Some(chunk) = chunks.next()
{
pace.tick().await;
import.decode(chunk).unwrap();
split += chunk.len();
if catalog.snapshot().ext.mpegts.mux_rate.is_some() {
break;
}
}
assert!(split < CLIP.len(), "the capture has a tail after its PCR-rate window");
export.output_past(0).await;
assert!(split < LONG.len(), "the capture has a tail after the export joined");
let old = relay.origin.request_broadcast("demo", None).await.unwrap();
assert_eq!(old.info().epoch.as_ref(), Some(&epoch));
let clock = catalog.snapshot().clock;
Expand All @@ -536,7 +545,10 @@ async fn the_same_instance_within_the_linger_continues() {
.unwrap();
assert_eq!(back.info().epoch.as_ref(), Some(&epoch));
assert!(!back.is_clone(&old), "the old relay copy was replaced");
feed(&mut import, &CLIP[split..]).await;
for chunk in chunks {
pace.tick().await;
import.decode(chunk).unwrap();
}
assert_eq!(catalog.snapshot().clock, clock, "the capture keeps its catalog clock");
import.finish().unwrap();
catalog.finish().unwrap();
Expand All @@ -550,14 +562,13 @@ async fn the_same_instance_within_the_linger_continues() {

let output = output.lock().unwrap();
let after = &output[mark..];
// The rate-measurement prefix leaves less than a second of this capture. Its
// packet count depends on the buffered prefix; only new capture timestamps
// prove the return continued instead of replaying already served content.
// The packet count after the mark depends on the buffered prefix; only new capture
// timestamps prove the return continued instead of replaying already served content.
assert!(
latest_pts(&output) > latest_pts(&CLIP[..split]),
latest_pts(&output) > latest_pts(&LONG[..split]),
"the returned output carries the capture's new tail: {} packets after {mark} bytes, capture split {split}/{}; exporter stderr: {errors}",
packets(after).count(),
CLIP.len()
LONG.len()
);
let versions: Vec<u8> = packets(&output).filter_map(|p| pat_version(p)).collect();
assert!(
Expand All @@ -566,14 +577,6 @@ async fn the_same_instance_within_the_linger_continues() {
);
}

/// Feed the capture at the same pace as the stdin importer fixture.
async fn feed(import: &mut ts::Import<ts::Ext>, data: &[u8]) {
for chunk in data.chunks(188 * 40) {
import.decode(chunk).unwrap();
tokio::time::sleep(Duration::from_millis(150)).await;
}
}

/// The latest PES timestamp, so replayed content cannot masquerade as a continuation.
fn latest_pts(ts: &[u8]) -> u64 {
let mut reader = TsPacketReader::new(Cursor::new(ts));
Expand Down
Binary file not shown.
Loading