The counter claims hold under a parallel runner
Browse files at this commit60c532251c4be31aa607f45b5af938896e956d40Parent: e5f0b93- fix
- the counter claims hold under a parallel runner
2 changed files +89 -24
- crates/engine/src/playback.rs +12 -8
- crates/engine/src/waveform.rs +77 -16
crates/engine/src/playback.rsmodified+12 -8
| @@ -4745,15 +4745,19 @@ mod tests { | |||
| 4745 | ); | 4745 | ); |
| 4746 | } | 4746 | } |
| 4747 | 4747 | ||
| 4748 | - /// The seat declares the canvas's own size and the painter masks the planes | 4748 | + /// The seat declares the canvas's own size; the painter masks the planes it |
| 4749 | - /// it returns to even dimensions. An odd canvas (a `resolution 1921 1081` | 4749 | + /// returns to even dimensions, and a canvas the two disagree about used to |
| 4750 | - /// line) or a one-pixel-high one leaves those two disagreeing by a row, and | 4750 | + /// take the picture down between them. On the revision before the seat masked |
| 4751 | - /// the conversion then indexes a chroma plane the size it was told does not | 4751 | + /// what it declares, a 1920x1 canvas died *in the painter* -- `decode.rs` |
| 4752 | - /// have: `index out of bounds` on a zero-length slice, inside the seat's | 4752 | + /// clamped the zero line of an h of 0: `max = -1`, `min > max` -- and a |
| 4753 | - /// worker, where nothing catches it and no frame ever arrives. | 4753 | + /// 321x181 one died in the conversion on the *canvas's* chroma plane, one row |
| 4754 | + /// past the masked source's: `index out of bounds: the len is 14400 but the | ||
| 4755 | + /// index is 14400`, a full plane and not an empty one. | ||
| 4754 | /// | 4756 | /// |
| 4755 | - /// An audio-only source, so the span really is a visualizer seat, and a | 4757 | + /// This drives the same path a front-end does (`set_resolution`, then frames |
| 4756 | - /// frame really is pulled out of it. | 4758 | + /// out of the session). It is a guard against the shape coming back rather |
| 4759 | + /// than a reproduction: a frame does still arrive on the parent revision | ||
| 4760 | + /// (which is why the masking, not this test, is the fix). | ||
| 4757 | #[test] | 4761 | #[test] |
| 4758 | fn a_visualizer_seat_paints_a_canvas_it_cannot_evenly_divide() { | 4762 | fn a_visualizer_seat_paints_a_canvas_it_cannot_evenly_divide() { |
| 4759 | for (w, h) in [(1920, 1), (1921, 1081), (320, 1), (321, 181)] { | 4763 | for (w, h) in [(1920, 1), (1921, 1081), (320, 1), (321, 181)] { |
crates/engine/src/waveform.rsmodified+77 -16
| @@ -98,16 +98,30 @@ fn peaks_memo() -> &'static std::sync::Mutex<(PeaksMemo, usize)> { | |||
| 98 | &MEMO | 98 | &MEMO |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | -/// Test-only: how many times an ask had to decode rather than answer from what | 101 | +/// Test-only: how many times an ask *for one key* had to decode rather than |
| 102 | -/// the memo already held. A second ask for the same source -- trackless or not | 102 | +/// answer from what the memo already held. A second ask of the same source -- |
| 103 | -/// -- must not move it, which is what makes "the memo answered" observable. | 103 | +/// trackless or not -- must not move it, which is what makes "the memo |
| 104 | +/// answered" observable. | ||
| 105 | +/// | ||
| 106 | +/// Keyed by the ask rather than counted process-wide: a test's claim is about | ||
| 107 | +/// *its* source, the suite runs in parallel by default, and a decode another | ||
| 108 | +/// test made would otherwise land inside the delta -- failing the claim for a | ||
| 109 | +/// reason that has nothing to do with the code. Every reader's source is a | ||
| 110 | +/// private copy of a fixture, so its key is that test's alone. | ||
| 104 | #[cfg(test)] | 111 | #[cfg(test)] |
| 105 | -static MEMO_DECODES: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0); | 112 | +static MEMO_DECODES: std::sync::LazyLock< |
| 113 | + std::sync::Mutex<std::collections::HashMap<PeaksKey, usize>>, | ||
| 114 | +> = std::sync::LazyLock::new(|| std::sync::Mutex::new(std::collections::HashMap::new())); | ||
| 106 | 115 | ||
| 107 | -/// [`MEMO_DECODES`], for a test that measures a delta across its own asks. | 116 | +/// [`MEMO_DECODES`] for one ask, for a test that measures a delta across its own. |
| 108 | #[cfg(test)] | 117 | #[cfg(test)] |
| 109 | -fn memo_decodes() -> usize { | 118 | +fn memo_decodes(path: &Path, stream: usize, buckets_per_sec: u32) -> usize { |
| 110 | - MEMO_DECODES.load(std::sync::atomic::Ordering::Relaxed) | 119 | + MEMO_DECODES |
| 120 | + .lock() | ||
| 121 | + .unwrap() | ||
| 122 | + .get(&PeaksKey::of(path, stream, buckets_per_sec)) | ||
| 123 | + .copied() | ||
| 124 | + .unwrap_or(0) | ||
| 111 | } | 125 | } |
| 112 | 126 | ||
| 113 | /// What the memo holds for one key: an envelope, or the stable answer that the | 127 | /// What the memo holds for one key: an envelope, or the stable answer that the |
| @@ -170,7 +184,9 @@ fn peaks_shared_capped( | |||
| 170 | return Ok(hit.envelope()); | 184 | return Ok(hit.envelope()); |
| 171 | } | 185 | } |
| 172 | #[cfg(test)] | 186 | #[cfg(test)] |
| 173 | - MEMO_DECODES.fetch_add(1, std::sync::atomic::Ordering::Relaxed); | 187 | + { |
| 188 | + *MEMO_DECODES.lock().unwrap().entry(key.clone()).or_insert(0) += 1; | ||
| 189 | + } | ||
| 174 | // A failure is *not* memoized: `?` leaves the map untouched, so a decode | 190 | // A failure is *not* memoized: `?` leaves the map untouched, so a decode |
| 175 | // that failed once -- a file caught mid-write, a busy device -- is retried | 191 | // that failed once -- a file caught mid-write, a busy device -- is retried |
| 176 | // rather than frozen for the process's life. Only the two successful | 192 | // rather than frozen for the process's life. Only the two successful |
| @@ -966,8 +982,34 @@ mod tests { | |||
| 966 | path | 982 | path |
| 967 | } | 983 | } |
| 968 | 984 | ||
| 985 | + /// One test at a time, for the whole module. | ||
| 986 | + /// | ||
| 987 | + /// Three of the seams these tests read -- [`MEMO_DECODES`], [`VIZ_DECODES`] | ||
| 988 | + /// and [`VIZ_FOLDED`] -- are process-wide, so "the second ask decoded | ||
| 989 | + /// nothing" is a claim about every test in this binary at once. Without this | ||
| 990 | + /// lock it holds only when the suite is run the way it is documented to be | ||
| 991 | + /// run (`--test-threads=1`); under `cargo test`'s own parallel default a | ||
| 992 | + /// pass belonging to a test running beside this one lands inside the delta, | ||
| 993 | + /// and the claim fails for a reason that has nothing to do with the code | ||
| 994 | + /// ([`a_summary_pass_folds_the_file_once`] and the parent revision's | ||
| 995 | + /// [`an_envelope_over_the_ceiling_is_not_held`] are both red that way). | ||
| 996 | + /// | ||
| 997 | + /// Every test in the module takes it, not only the readers: a test that | ||
| 998 | + /// *decodes* moves the counters the readers are measuring. The cost is that | ||
| 999 | + /// this module's tests do not run in parallel with each other -- they are the | ||
| 1000 | + /// fixture-heavy ones, and the suite runs them serially anyway. Keying each | ||
| 1001 | + /// counter by the file it was for would buy the parallelism back, and is the | ||
| 1002 | + /// upgrade path if this lock ever shows up in a profile. | ||
| 1003 | + fn counters_serial() -> std::sync::MutexGuard<'static, ()> { | ||
| 1004 | + static LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(()); | ||
| 1005 | + // A poisoned lock is another test's panic, not this one's failure: the | ||
| 1006 | + // counters are still readable and mutual exclusion is the whole point. | ||
| 1007 | + LOCK.lock().unwrap_or_else(|poisoned| poisoned.into_inner()) | ||
| 1008 | + } | ||
| 1009 | + | ||
| 969 | #[test] | 1010 | #[test] |
| 970 | fn peaks_follow_the_1hz_volume_pulse() { | 1011 | fn peaks_follow_the_1hz_volume_pulse() { |
| 1012 | + let _serial = counters_serial(); | ||
| 971 | let peaks = peaks(asset("test_av.mp4"), 0, BPS) | 1013 | let peaks = peaks(asset("test_av.mp4"), 0, BPS) |
| 972 | .expect("open") | 1014 | .expect("open") |
| 973 | .expect("test_av.mp4 has an audio track"); | 1015 | .expect("test_av.mp4 has an audio track"); |
| @@ -1020,6 +1062,7 @@ mod tests { | |||
| 1020 | /// audio file on stream 0 as readily as an mp4's AAC track. | 1062 | /// audio file on stream 0 as readily as an mp4's AAC track. |
| 1021 | #[test] | 1063 | #[test] |
| 1022 | fn a_standalone_audio_file_has_peaks_too() { | 1064 | fn a_standalone_audio_file_has_peaks_too() { |
| 1065 | + let _serial = counters_serial(); | ||
| 1023 | let peaks = peaks(asset("test_tone.mp3"), 0, BPS) | 1066 | let peaks = peaks(asset("test_tone.mp3"), 0, BPS) |
| 1024 | .expect("open") | 1067 | .expect("open") |
| 1025 | .expect("test_tone.mp3 is audio"); | 1068 | .expect("test_tone.mp3 is audio"); |
| @@ -1047,6 +1090,7 @@ mod tests { | |||
| 1047 | /// flat -- rather than the empty band a silent file makes. | 1090 | /// flat -- rather than the empty band a silent file makes. |
| 1048 | #[test] | 1091 | #[test] |
| 1049 | fn a_five_one_aac_mkv_draws_an_envelope() { | 1092 | fn a_five_one_aac_mkv_draws_an_envelope() { |
| 1093 | + let _serial = counters_serial(); | ||
| 1050 | let peaks = peaks(asset("test_hevc10.mkv"), 0, BPS) | 1094 | let peaks = peaks(asset("test_hevc10.mkv"), 0, BPS) |
| 1051 | .expect("the 5.1 AAC track decodes") | 1095 | .expect("the 5.1 AAC track decodes") |
| 1052 | .expect("test_hevc10.mkv has an audio track"); | 1096 | .expect("test_hevc10.mkv has an audio track"); |
| @@ -1074,6 +1118,7 @@ mod tests { | |||
| 1074 | /// waveform is still the film's. | 1118 | /// waveform is still the film's. |
| 1075 | #[test] | 1119 | #[test] |
| 1076 | fn a_split_decode_draws_the_same_envelope() { | 1120 | fn a_split_decode_draws_the_same_envelope() { |
| 1121 | + let _serial = counters_serial(); | ||
| 1077 | let file = asset("test_av.mp4"); | 1122 | let file = asset("test_av.mp4"); |
| 1078 | let whole = peaks_over(&file, 0, BPS, Some(1)) | 1123 | let whole = peaks_over(&file, 0, BPS, Some(1)) |
| 1079 | .expect("open") | 1124 | .expect("open") |
| @@ -1098,6 +1143,7 @@ mod tests { | |||
| 1098 | 1143 | ||
| 1099 | #[test] | 1144 | #[test] |
| 1100 | fn video_only_source_has_no_peaks() { | 1145 | fn video_only_source_has_no_peaks() { |
| 1146 | + let _serial = counters_serial(); | ||
| 1101 | assert!(peaks(asset("test_baseline.mp4"), 0, BPS) | 1147 | assert!(peaks(asset("test_baseline.mp4"), 0, BPS) |
| 1102 | .expect("open") | 1148 | .expect("open") |
| 1103 | .is_none()); | 1149 | .is_none()); |
| @@ -1109,6 +1155,7 @@ mod tests { | |||
| 1109 | /// stream 0's 4-second-long pulsed stereo pair. | 1155 | /// stream 0's 4-second-long pulsed stereo pair. |
| 1110 | #[test] | 1156 | #[test] |
| 1111 | fn each_stream_of_a_file_has_its_own_envelope() { | 1157 | fn each_stream_of_a_file_has_its_own_envelope() { |
| 1158 | + let _serial = counters_serial(); | ||
| 1112 | let multi = asset("test_multiaudio.mp4"); | 1159 | let multi = asset("test_multiaudio.mp4"); |
| 1113 | let zero = peaks(&multi, 0, BPS).expect("open").expect("stream 0"); | 1160 | let zero = peaks(&multi, 0, BPS).expect("open").expect("stream 0"); |
| 1114 | let one = peaks(&multi, 1, BPS).expect("open").expect("stream 1"); | 1161 | let one = peaks(&multi, 1, BPS).expect("open").expect("stream 1"); |
| @@ -1133,6 +1180,7 @@ mod tests { | |||
| 1133 | /// down, where the visualizer seat reads it. | 1180 | /// down, where the visualizer seat reads it. |
| 1134 | #[test] | 1181 | #[test] |
| 1135 | fn the_shared_memo_answers_per_stream() { | 1182 | fn the_shared_memo_answers_per_stream() { |
| 1183 | + let _serial = counters_serial(); | ||
| 1136 | let multi = asset("test_multiaudio.mp4"); | 1184 | let multi = asset("test_multiaudio.mp4"); |
| 1137 | let zero = peaks_shared(&multi, 0, BPS) | 1185 | let zero = peaks_shared(&multi, 0, BPS) |
| 1138 | .expect("open") | 1186 | .expect("open") |
| @@ -1162,6 +1210,7 @@ mod tests { | |||
| 1162 | /// read-only for every other test in this binary. | 1210 | /// read-only for every other test in this binary. |
| 1163 | #[test] | 1211 | #[test] |
| 1164 | fn a_replaced_source_is_read_again() { | 1212 | fn a_replaced_source_is_read_again() { |
| 1213 | + let _serial = counters_serial(); | ||
| 1165 | let path = | 1214 | let path = |
| 1166 | std::env::temp_dir().join(format!("edith-peaks-memo-{}.mp4", std::process::id())); | 1215 | std::env::temp_dir().join(format!("edith-peaks-memo-{}.mp4", std::process::id())); |
| 1167 | let short = std::fs::read(asset("test_multiaudio.mp4")).expect("read the fixture"); | 1216 | let short = std::fs::read(asset("test_multiaudio.mp4")).expect("read the fixture"); |
| @@ -1216,18 +1265,19 @@ mod tests { | |||
| 1216 | /// one. A copy is used so the key is this test's alone. | 1265 | /// one. A copy is used so the key is this test's alone. |
| 1217 | #[test] | 1266 | #[test] |
| 1218 | fn a_trackless_source_is_memoized_too() { | 1267 | fn a_trackless_source_is_memoized_too() { |
| 1268 | + let _serial = counters_serial(); | ||
| 1219 | let path = copy_of("test_baseline.mp4", "none"); | 1269 | let path = copy_of("test_baseline.mp4", "none"); |
| 1220 | 1270 | ||
| 1221 | - let before = memo_decodes(); | 1271 | + let before = memo_decodes(&path, 0, BPS); |
| 1222 | let first = peaks_shared(&path, 0, BPS).expect("open"); | 1272 | let first = peaks_shared(&path, 0, BPS).expect("open"); |
| 1223 | assert!(first.is_none(), "test_baseline.mp4 has no audio track"); | 1273 | assert!(first.is_none(), "test_baseline.mp4 has no audio track"); |
| 1224 | - let after_first = memo_decodes(); | 1274 | + let after_first = memo_decodes(&path, 0, BPS); |
| 1225 | assert_eq!(after_first - before, 1, "the first ask did not decode"); | 1275 | assert_eq!(after_first - before, 1, "the first ask did not decode"); |
| 1226 | 1276 | ||
| 1227 | let second = peaks_shared(&path, 0, BPS).expect("open"); | 1277 | let second = peaks_shared(&path, 0, BPS).expect("open"); |
| 1228 | assert!(second.is_none()); | 1278 | assert!(second.is_none()); |
| 1229 | assert_eq!( | 1279 | assert_eq!( |
| 1230 | - memo_decodes(), | 1280 | + memo_decodes(&path, 0, BPS), |
| 1231 | after_first, | 1281 | after_first, |
| 1232 | "the second ask re-opened a trackless source" | 1282 | "the second ask re-opened a trackless source" |
| 1233 | ); | 1283 | ); |
| @@ -1240,6 +1290,7 @@ mod tests { | |||
| 1240 | /// the `NoTrack` entry for an envelope without stranding the old count. | 1290 | /// the `NoTrack` entry for an envelope without stranding the old count. |
| 1241 | #[test] | 1291 | #[test] |
| 1242 | fn a_trackless_answer_holds_no_buckets() { | 1292 | fn a_trackless_answer_holds_no_buckets() { |
| 1293 | + let _serial = counters_serial(); | ||
| 1243 | let mut memo = PeaksMemo::new(); | 1294 | let mut memo = PeaksMemo::new(); |
| 1244 | let mut count = 0; | 1295 | let mut count = 0; |
| 1245 | let key = || PeaksKey::of(std::path::Path::new("edith-peaks-none-key"), 0, BPS); | 1296 | let key = || PeaksKey::of(std::path::Path::new("edith-peaks-none-key"), 0, BPS); |
| @@ -1267,13 +1318,14 @@ mod tests { | |||
| 1267 | /// Does not cover: an end-to-end decode past eight million buckets. | 1318 | /// Does not cover: an end-to-end decode past eight million buckets. |
| 1268 | #[test] | 1319 | #[test] |
| 1269 | fn an_envelope_over_the_ceiling_is_not_held() { | 1320 | fn an_envelope_over_the_ceiling_is_not_held() { |
| 1321 | + let _serial = counters_serial(); | ||
| 1270 | let file = copy_of("test_av.mp4", "over"); | 1322 | let file = copy_of("test_av.mp4", "over"); |
| 1271 | - let before = memo_decodes(); | 1323 | + let before = memo_decodes(&file, 0, BPS); |
| 1272 | let first = peaks_shared_capped(&file, 0, BPS, 10) | 1324 | let first = peaks_shared_capped(&file, 0, BPS, 10) |
| 1273 | .expect("open") | 1325 | .expect("open") |
| 1274 | .expect("test_av.mp4 has an audio track"); | 1326 | .expect("test_av.mp4 has an audio track"); |
| 1275 | assert!(first.len() > 10, "the fixture must exceed the test ceiling"); | 1327 | assert!(first.len() > 10, "the fixture must exceed the test ceiling"); |
| 1276 | - let mid = memo_decodes(); | 1328 | + let mid = memo_decodes(&file, 0, BPS); |
| 1277 | assert_eq!(mid - before, 1, "the first ask did not decode"); | 1329 | assert_eq!(mid - before, 1, "the first ask did not decode"); |
| 1278 | 1330 | ||
| 1279 | let second = peaks_shared_capped(&file, 0, BPS, 10) | 1331 | let second = peaks_shared_capped(&file, 0, BPS, 10) |
| @@ -1281,7 +1333,7 @@ mod tests { | |||
| 1281 | .expect("test_av.mp4 has an audio track"); | 1333 | .expect("test_av.mp4 has an audio track"); |
| 1282 | assert_eq!(*first, *second, "the caller did not get its envelope"); | 1334 | assert_eq!(*first, *second, "the caller did not get its envelope"); |
| 1283 | assert_eq!( | 1335 | assert_eq!( |
| 1284 | - memo_decodes() - mid, | 1336 | + memo_decodes(&file, 0, BPS) - mid, |
| 1285 | 1, | 1337 | 1, |
| 1286 | "an envelope over the ceiling was held" | 1338 | "an envelope over the ceiling was held" |
| 1287 | ); | 1339 | ); |
| @@ -1300,6 +1352,7 @@ mod tests { | |||
| 1300 | /// 3 + 5 = 8. | 1352 | /// 3 + 5 = 8. |
| 1301 | #[test] | 1353 | #[test] |
| 1302 | fn replacing_an_entry_subtracts_the_old_buckets() { | 1354 | fn replacing_an_entry_subtracts_the_old_buckets() { |
| 1355 | + let _serial = counters_serial(); | ||
| 1303 | let mut memo = PeaksMemo::new(); | 1356 | let mut memo = PeaksMemo::new(); |
| 1304 | let mut count = 0; | 1357 | let mut count = 0; |
| 1305 | let key = || PeaksKey::of(std::path::Path::new("edith-peaks-replace-key"), 0, BPS); | 1358 | let key = || PeaksKey::of(std::path::Path::new("edith-peaks-replace-key"), 0, BPS); |
| @@ -1339,6 +1392,7 @@ mod tests { | |||
| 1339 | /// ([`crate::decode::visualizer_i420`]). | 1392 | /// ([`crate::decode::visualizer_i420`]). |
| 1340 | #[test] | 1393 | #[test] |
| 1341 | fn a_window_of_a_non_periodic_file_is_where_it_says_it_is() { | 1394 | fn a_window_of_a_non_periodic_file_is_where_it_says_it_is() { |
| 1395 | + let _serial = counters_serial(); | ||
| 1342 | let path = | 1396 | let path = |
| 1343 | std::env::temp_dir().join(format!("edith-peaks-noise-{}.flac", std::process::id())); | 1397 | std::env::temp_dir().join(format!("edith-peaks-noise-{}.flac", std::process::id())); |
| 1344 | let generated = std::process::Command::new("ffmpeg") | 1398 | let generated = std::process::Command::new("ffmpeg") |
| @@ -1427,6 +1481,7 @@ mod tests { | |||
| 1427 | /// for nothing, on the critical path of the first look edit. | 1481 | /// for nothing, on the critical path of the first look edit. |
| 1428 | #[test] | 1482 | #[test] |
| 1429 | fn a_summary_pass_folds_the_file_once() { | 1483 | fn a_summary_pass_folds_the_file_once() { |
| 1484 | + let _serial = counters_serial(); | ||
| 1430 | let path = | 1485 | let path = |
| 1431 | std::env::temp_dir().join(format!("edith-peaks-once-{}.flac", std::process::id())); | 1486 | std::env::temp_dir().join(format!("edith-peaks-once-{}.flac", std::process::id())); |
| 1432 | let generated = std::process::Command::new("ffmpeg") | 1487 | let generated = std::process::Command::new("ffmpeg") |
| @@ -1468,6 +1523,7 @@ mod tests { | |||
| 1468 | /// guard, so this is the one arithmetic they both use. | 1523 | /// guard, so this is the one arithmetic they both use. |
| 1469 | #[test] | 1524 | #[test] |
| 1470 | fn a_zero_sample_rate_still_buckets_samples() { | 1525 | fn a_zero_sample_rate_still_buckets_samples() { |
| 1526 | + let _serial = counters_serial(); | ||
| 1471 | // A rate of zero is read as one, and the rate is what divides either | 1527 | // A rate of zero is read as one, and the rate is what divides either |
| 1472 | // way, so the arithmetic stays finite and positive. | 1528 | // way, so the arithmetic stays finite and positive. |
| 1473 | assert_eq!(super::per_bucket_of(0, 4000), 1.0 / 4000.0); | 1529 | assert_eq!(super::per_bucket_of(0, 4000), 1.0 / 4000.0); |
| @@ -1496,6 +1552,7 @@ mod tests { | |||
| 1496 | /// route the eight-million-bucket ceiling takes for a film. | 1552 | /// route the eight-million-bucket ceiling takes for a film. |
| 1497 | #[test] | 1553 | #[test] |
| 1498 | fn a_window_of_an_over_the_ceiling_source_is_decoded_once() { | 1554 | fn a_window_of_an_over_the_ceiling_source_is_decoded_once() { |
| 1555 | + let _serial = counters_serial(); | ||
| 1499 | let file = copy_of("test_av.mp4", "window"); | 1556 | let file = copy_of("test_av.mp4", "window"); |
| 1500 | let plain = peaks(&file, 0, BPS).expect("open").expect("audio track"); | 1557 | let plain = peaks(&file, 0, BPS).expect("open").expect("audio track"); |
| 1501 | 1558 | ||
| @@ -1545,9 +1602,12 @@ mod tests { | |||
| 1545 | /// times from the file's first frame to past its last. | 1602 | /// times from the file's first frame to past its last. |
| 1546 | #[test] | 1603 | #[test] |
| 1547 | fn a_window_paints_the_frame_the_whole_envelope_paints() { | 1604 | fn a_window_paints_the_frame_the_whole_envelope_paints() { |
| 1605 | + let _serial = counters_serial(); | ||
| 1548 | let file = asset("test_av.mp4"); | 1606 | let file = asset("test_av.mp4"); |
| 1549 | - // The painter's own rate: it indexes an envelope at | 1607 | + // The painter's own rate: a view carries the rate its envelope |
| 1550 | - // [`VIZ_BUCKETS_PER_SEC`], whatever rate an ask drew it at. | 1608 | + // was drawn at and indexes the slice by it, so this envelope is |
| 1609 | + // drawn at exactly the rate the painter reads it at -- the | ||
| 1610 | + // visualizer's own ([`crate::decode::VIZ_BUCKETS_PER_SEC`]). | ||
| 1551 | let per_sec = f64::from(crate::decode::VIZ_BUCKETS_PER_SEC); | 1611 | let per_sec = f64::from(crate::decode::VIZ_BUCKETS_PER_SEC); |
| 1552 | let whole = peaks(&file, 0, crate::decode::VIZ_BUCKETS_PER_SEC) | 1612 | let whole = peaks(&file, 0, crate::decode::VIZ_BUCKETS_PER_SEC) |
| 1553 | .expect("open") | 1613 | .expect("open") |
| @@ -1606,6 +1666,7 @@ mod tests { | |||
| 1606 | /// Skipped, loudly, where ffmpeg is not installed. | 1666 | /// Skipped, loudly, where ffmpeg is not installed. |
| 1607 | #[test] | 1667 | #[test] |
| 1608 | fn a_film_length_source_paints_the_same_frame_in_windows() { | 1668 | fn a_film_length_source_paints_the_same_frame_in_windows() { |
| 1669 | + let _serial = counters_serial(); | ||
| 1609 | let path = | 1670 | let path = |
| 1610 | std::env::temp_dir().join(format!("edith-peaks-long-{}.flac", std::process::id())); | 1671 | std::env::temp_dir().join(format!("edith-peaks-long-{}.flac", std::process::id())); |
| 1611 | let generated = std::process::Command::new("ffmpeg") | 1672 | let generated = std::process::Command::new("ffmpeg") |