diff --git a/crates/voelin-media/src/studio/mod.rs b/crates/voelin-media/src/studio/mod.rs index 5a00624..ee5efc9 100644 --- a/crates/voelin-media/src/studio/mod.rs +++ b/crates/voelin-media/src/studio/mod.rs @@ -1411,9 +1411,16 @@ mod tests { assert_eq!((listed[0].width, listed[0].height), (64, 48)); let frames = capture.start(&SourceId::Studio, &CaptureOptions::default()).await.unwrap(); let mut frames = frames; - let frame = frames.recv_timeout(Duration::from_secs(5)).expect("a composed frame"); + // (The wait only ends a hang.) + let frame = frames.recv_timeout(Duration::from_secs(30)).expect("a composed frame"); assert_eq!((frame.width, frame.height), (64, 48)); - assert!(studio.shared.delivered.load(Ordering::Relaxed) > 0); + // A frame is counted once it has been handed over, so the count can still be + // behind when the frame is in the hands of the test. + let deadline = Instant::now() + Duration::from_secs(30); + while studio.shared.delivered.load(Ordering::Relaxed) == 0 { + assert!(Instant::now() < deadline, "the frame handed over was never counted"); + std::thread::sleep(Duration::from_millis(5)); + } capture.stop(); std::fs::remove_dir_all(&dir).ok(); }