Two voelin-core tests read Streamer::stats() once, at the moment a consumer had
seen the effect, and the stats lag behind it:
- stream::tests::test_pattern_through_stream_tasks asserted `video_frames >= 15`
right after the viewer had decoded 15 pictures. The encoder counts a frame
after the sink has taken it (`sink.send_video(..)`, then `fetch_add`), so the
15th picture can be at the viewer first: video_frames was 14 with
captured_frames 15 and the picture on screen.
- media::tests::an_automatic_bitrate_follows_the_stream asserted the layer's
bitrate in the stats right after the sink had been told the layer's format;
the stats had 0 (the layer's target is stored by the encoder thread, not by
the call that tells the sink).
Both now poll for the value with a deadline (5 s, and 10 s as the test's other
waits), which is the same assertion without the order of two threads. Before,
on a 32-core machine with 32 busy loops beside the runs: the first failed on
that assertion in 7 of 150 runs of the stream tests six at a time, the second
in 19 of 120 runs of the voelin-core lib tests six at a time. After, in 200
runs of the lib tests three at a time with 16 busy loops beside them, neither
failed on these assertions.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>