BlueGit

ict rusty-teams

fix(calls): blur mask-age test no longer races the worker start

- the test waits until the worker took frame 0, so the mask always comes from frame 0
- CI failed when the worker started before the second frame replaced the first

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

metis Daniel Däschle · pushed by metis

Authored 2026-11-20 · 11 days ago

Hash
128a04b6d75dbc98ae2e827f4af1714ea6552364
Parent
2e420a37
1 file changed +6 −3
crates/calling/src/blur.rs +6 −3
@@ -736,20 +736,23 @@ mod tests {
736 736 let seen = Arc::new(Mutex::new(Vec::new()));
737 737 let mut source = MaskSource::with_inference(SlowSegmenter {
738 738 delay: Duration::from_millis(60),
739 seen,
739 seen: seen.clone(),
740 740 });
741 741 assert!(!source.refresh(|| marked_frame(5)));
742 742 let deadline = Instant::now() + Duration::from_secs(10);
743 while seen.lock().unwrap().is_empty() && Instant::now() < deadline {
744 std::thread::sleep(Duration::from_millis(1));
745 }
743 746 let mut shown = 1;
744 747 while !source.refresh(|| marked_frame(6)) && Instant::now() < deadline {
745 748 shown += 1;
746 749 std::thread::sleep(Duration::from_millis(10));
747 750 }
748 751 assert!(shown >= 3, "the mask came back before the model was done");
749 assert_eq!(source.age(), shown - 1);
752 assert_eq!(source.age(), shown);
750 753 assert_eq!(source.reference().values.len(), 4);
751 754 assert!(!source.refresh(|| marked_frame(7)));
752 assert_eq!(source.age(), shown);
755 assert_eq!(source.age(), shown + 1);
753 756 }
754 757
755 758 #[test]
@@ -736,20 +736,23 @@ mod tests {
736 let seen = Arc::new(Mutex::new(Vec::new()));
736 let seen = Arc::new(Mutex::new(Vec::new()));
737 let mut source = MaskSource::with_inference(SlowSegmenter {
737 let mut source = MaskSource::with_inference(SlowSegmenter {
738 delay: Duration::from_millis(60),
738 delay: Duration::from_millis(60),
739 seen,
739 seen: seen.clone(),
740 });
740 });
741 assert!(!source.refresh(|| marked_frame(5)));
741 assert!(!source.refresh(|| marked_frame(5)));
742 let deadline = Instant::now() + Duration::from_secs(10);
742 let deadline = Instant::now() + Duration::from_secs(10);
743 while seen.lock().unwrap().is_empty() && Instant::now() < deadline {
744 std::thread::sleep(Duration::from_millis(1));
745 }
743 let mut shown = 1;
746 let mut shown = 1;
744 while !source.refresh(|| marked_frame(6)) && Instant::now() < deadline {
747 while !source.refresh(|| marked_frame(6)) && Instant::now() < deadline {
745 shown += 1;
748 shown += 1;
746 std::thread::sleep(Duration::from_millis(10));
749 std::thread::sleep(Duration::from_millis(10));
747 }
750 }
748 assert!(shown >= 3, "the mask came back before the model was done");
751 assert!(shown >= 3, "the mask came back before the model was done");
749 assert_eq!(source.age(), shown - 1);
752 assert_eq!(source.age(), shown);
750 assert_eq!(source.reference().values.len(), 4);
753 assert_eq!(source.reference().values.len(), 4);
751 assert!(!source.refresh(|| marked_frame(7)));
754 assert!(!source.refresh(|| marked_frame(7)));
752 assert_eq!(source.age(), shown);
755 assert_eq!(source.age(), shown + 1);
753 }
756 }
754
757
755 #[test]
758 #[test]