forge
Explore
Log in

Don't you dare go Hollow

A failed waveform decode is asked again

Browse files at this commit

43e146d27ead5c6e4cd15ee6e19f1b2fb19ee6c6Ahmet Kaan GümüşParent: 9c53bb8
  • fix
    • a failed waveform decode is asked again
Show full message
🐛 fix(player): a failed waveform decode is asked again

Presence in the wave map means asked, so one transient failure -- a file imported while it was still being copied, a disk hiccup -- left a lane with no envelope for the rest of the session. The failure carries the moment it happened now and a repaint past a five second cooldown asks again, which is the engine's own rule that a failure is never memoized; a file with no audio stays an answer that is never re-asked.
crates/app/src/importing.rsmodified+9 -4
@@ -18,10 +18,15 @@ pub(crate) enum Wave {
18 Loading,18 Loading,
19 /// The file has no audio track. An answer, not a miss.19 /// The file has no audio track. An answer, not a miss.
20 Silent,20 Silent,
21- /// The decode failed. Drawn as its own mark rather than as [`Self::Silent`]:21+ /// The decode failed, at the moment it did. Drawn as its own mark rather
22- /// "this file's sound could not be read" and "this file has no sound" look22+ /// than as [`Self::Silent`]: "this file's sound could not be read" and
23- /// the same on a lane, and the first is a bug report waiting to happen.23+ /// "this file has no sound" look the same on a lane, and the first is a
24- Failed,24+ /// bug report waiting to happen. It is *not* an answer, though: a failure
25+ /// may have had a reason that has since gone away (a file still being
26+ /// copied when it arrived), so [`crate::subs::unseen_sources`] asks again
27+ /// once the stamp is older than its cooldown -- which is what the stamp is
28+ /// for.
29+ Failed(std::time::Instant),
25 Peaks(Arc<Vec<(f32, f32)>>),30 Peaks(Arc<Vec<(f32, f32)>>),
26 }31 }
27 32
crates/app/src/player/export.rsmodified+7 -2
@@ -2,6 +2,7 @@
2 //! two of them decide.2 //! two of them decide.
3 3
4 use crate::*;4 use crate::*;
5+use std::time::Instant;
5 6
6 impl Player {7 impl Player {
7 /// What [`timeline_math::lane_refuses`] asks to decide a video lane's8 /// What [`timeline_math::lane_refuses`] asks to decide a video lane's
@@ -231,7 +232,7 @@ impl Player {
231 }232 }
232 starting.push(path);233 starting.push(path);
233 }234 }
234- for key in unseen_sources(session.sources(), &self.waves) {235+ for key in unseen_sources(session.sources(), &self.waves, Instant::now()) {
235 self.waves.insert(key.clone(), Wave::Loading);236 self.waves.insert(key.clone(), Wave::Loading);
236 let decoded = cx.background_executor().spawn({237 let decoded = cx.background_executor().spawn({
237 let (path, stream) = key.clone();238 let (path, stream) = key.clone();
@@ -254,7 +255,11 @@ impl Player {
254 // A file whose sound we could not read is not a255 // A file whose sound we could not read is not a
255 // silent one, and a lane that drew it as silent is256 // silent one, and a lane that drew it as silent is
256 // how a broken decode passes for a design choice.257 // how a broken decode passes for a design choice.
257- Err(_) => Wave::Failed,258+ // Stamped, and not an answer: a repaint past
259+ // [`WAVE_RETRY`] asks again, so a failure whose
260+ // cause went away (a file still being copied when
261+ // it arrived) draws its envelope without a reopen.
262+ Err(_) => Wave::Failed(Instant::now()),
258 },263 },
259 );264 );
260 cx.notify();265 cx.notify();
crates/app/src/subs.rsmodified+21 -7
@@ -333,9 +333,7 @@ pub(crate) fn subtitle_tail(session: &mut PlaybackSession, subs: Subs) -> Option
333 match subs {333 match subs {
334 Ok(tracks) => match session.add_subtitle_tracks(tracks) {334 Ok(tracks) => match session.add_subtitle_tracks(tracks) {
335 0 => None,335 0 => None,
336- n => Some(format!(336+ n => Some(format!(" · {n} subtitle track(s)")),
337- " · {n} subtitle track(s)"
338- )),
339 },337 },
340 Err(e) => Some(format!(" — SUBTITLES UNREAD: {e}")),338 Err(e) => Some(format!(" — SUBTITLES UNREAD: {e}")),
341 }339 }
@@ -705,17 +703,33 @@ pub(crate) fn cues_at(cues: &[engine::subtitle::Cue], at: f64) -> Vec<&engine::s
705 .collect()703 .collect()
706 }704 }
707 705
708-/// The sources a repaint has not asked about yet. A key that is already there706+/// How long a failed waveform decode is left alone before the next repaint asks
709-/// means "asked", whatever state it is in, which is what stops a decode already707+/// again: long enough that sixty repaints a second do not become sixty decodes,
710-/// running from being started again by the next of sixty repaints a second.708+/// short enough that a file which arrived mid-copy has its envelope a moment
709+/// after it lands. The engine memoizes no failure for the same reason
710+/// ([`engine::waveform`]): the reason one failed may have gone away.
711+pub(crate) const WAVE_RETRY: std::time::Duration = std::time::Duration::from_secs(5);
712+
713+/// The sources a repaint has not asked about yet, as of `now`. A key that is
714+/// already there means "asked", whatever state it is in -- which is what stops
715+/// a decode already running from being started again by the next of sixty
716+/// repaints a second -- with one exception: a [`Wave::Failed`] older than
717+/// [`WAVE_RETRY`] is asked again, because a decode that failed once is not an
718+/// answer about the file, only about the moment it was tried. A file with no
719+/// audio (`Wave::Silent`) is an answer like any other and is never re-asked.
711 pub(crate) fn unseen_sources(720 pub(crate) fn unseen_sources(
712 sources: &[Source],721 sources: &[Source],
713 waves: &HashMap<(PathBuf, usize), Wave>,722 waves: &HashMap<(PathBuf, usize), Wave>,
723+ now: std::time::Instant,
714 ) -> Vec<(PathBuf, usize)> {724 ) -> Vec<(PathBuf, usize)> {
715 sources725 sources
716 .iter()726 .iter()
717 .map(|s| (s.path.clone(), s.audio_stream))727 .map(|s| (s.path.clone(), s.audio_stream))
718- .filter(|key| !waves.contains_key(key))728+ .filter(|key| match waves.get(key) {
729+ None => true,
730+ Some(Wave::Failed(at)) => now.duration_since(*at) >= WAVE_RETRY,
731+ Some(_) => false,
732+ })
719 .collect()733 .collect()
720 }734 }
721 735
crates/app/src/tests/editing.rsmodified+109 -114
@@ -109,11 +109,9 @@ fn a_song_opens_the_window_by_itself() {
109 // ...and it places, on the audio lane, through the door `insert_source`109 // ...and it places, on the audio lane, through the door `insert_source`
110 // uses: a second copy of the song at the playhead.110 // uses: a second copy of the song at the playhead.
111 session.seek(1.0);111 session.seek(1.0);
112- assert!(112+ assert!(session
113- session113+ .place_stream_at(1.0, &path, 0, Some(Lane::A1))
114- .place_stream_at(1.0, &path, 0, Some(Lane::A1))114+ .expect("its own file is on this timeline"));
115- .expect("its own file is on this timeline")
116- );
117 assert_eq!(session.lane_clips(Lane::A1).len(), 2);115 assert_eq!(session.lane_clips(Lane::A1).len(), 2);
118 assert!(session.lane_clips(Lane::V1).is_empty(), "still no picture");116 assert!(session.lane_clips(Lane::V1).is_empty(), "still no picture");
119 117
@@ -345,13 +343,11 @@ fn a_caption_is_deleted_by_the_same_row_and_stroke_every_box_is() {
345 );343 );
346 // ...and the same reading with a clip under it is the clip menu, untouched:344 // ...and the same reading with a clip under it is the clip menu, untouched:
347 // the flag is off wherever a `Clip` was clicked.345 // the flag is off wherever a `Clip` was clicked.
348- assert!(346+ assert!(menu_items(Ctx {
349- menu_items(Ctx {347+ timeline: true,
350- timeline: true,348+ ..Ctx::default()
351- ..Ctx::default()349+ })
352- })350+ .contains(&ActionId::Cut));
353- .contains(&ActionId::Cut)
354- );
355 }351 }
356 352
357 /// A timeline with a subtitle palette and an empty subtitle lane: what a353 /// A timeline with a subtitle palette and an empty subtitle lane: what a
@@ -939,16 +935,14 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() {
939 }935 }
940 assert!(!whole(ActionId::Delete, live).yes());936 assert!(!whole(ActionId::Delete, live).yes());
941 assert!(!whole(ActionId::Paste, live).yes());937 assert!(!whole(ActionId::Paste, live).yes());
942- assert!(938+ assert!(whole(
943- whole(939+ ActionId::Paste,
944- ActionId::Paste,940+ Ctx {
945- Ctx {941+ clipboard: true,
946- clipboard: true,942+ ..live
947- ..live943+ }
948- }944+ )
949- )945+ .yes());
950- .yes()
951- );
952 assert!(!whole(ActionId::CancelExport, live).yes());946 assert!(!whole(ActionId::CancelExport, live).yes());
953 let busy = Ctx {947 let busy = Ctx {
954 exporting: true,948 exporting: true,
@@ -988,7 +982,10 @@ fn the_clip_menu_dims_what_the_playhead_is_not_on_and_stays_in_the_window() {
988 assert_eq!(menu_at(point(px(10.), px(10.)), viewport, 150.), (10., 10.));982 assert_eq!(menu_at(point(px(10.), px(10.)), viewport, 150.), (10., 10.));
989 assert_eq!(983 assert_eq!(
990 menu_at(point(px(700.), px(380.)), viewport, 150.),984 menu_at(point(px(700.), px(380.)), viewport, 150.),
991- (800. - crate::layout::MENU_EDGE - MENU_W, 400. - crate::layout::MENU_EDGE - 150.)985+ (
986+ 800. - crate::layout::MENU_EDGE - MENU_W,
987+ 400. - crate::layout::MENU_EDGE - 150.
988+ )
992 );989 );
993 // A window smaller than the menu loses its bottom, never its top: the990 // A window smaller than the menu loses its bottom, never its top: the
994 // top-left margin wins over the bottom-right one, because the items are991 // top-left margin wins over the bottom-right one, because the items are
@@ -1165,16 +1162,14 @@ fn a_menu_offers_only_what_applies_and_is_drawn_inside_the_window() {
1165 assert!(row_enable(RowItem::RemoveWithClips, placed).yes());1162 assert!(row_enable(RowItem::RemoveWithClips, placed).yes());
1166 let unplaced = row_items(live);1163 let unplaced = row_items(live);
1167 assert!(unplaced.contains(&RowItem::Remove) && !unplaced.contains(&RowItem::RemoveWithClips));1164 assert!(unplaced.contains(&RowItem::Remove) && !unplaced.contains(&RowItem::RemoveWithClips));
1168- assert!(1165+ assert!(!row_enable(
1169- !row_enable(1166+ RowItem::RemoveWithClips,
1170- RowItem::RemoveWithClips,1167+ RowCtx {
1171- RowCtx {1168+ exporting: true,
1172- exporting: true,1169+ ..placed
1173- ..placed1170+ }
1174- }1171+ )
1175- )1172+ .yes());
1176- .yes()
1177- );
1178 assert!(!row_enable(RowItem::Add, RowCtx::default()).yes());1173 assert!(!row_enable(RowItem::Add, RowCtx::default()).yes());
1179 // Every refusal is short enough to sit in the hint column beside its1174 // Every refusal is short enough to sit in the hint column beside its
1180 // label, the clip menu's rule.1175 // label, the clip menu's rule.
@@ -1282,7 +1277,11 @@ fn the_hanging_menus_mount_at_the_room_root_and_their_rows_wear_chords_not_prose
1282 }1277 }
1283 // §9: no junk drawer. A label that fits the plate whole beside its1278 // §9: no junk drawer. A label that fits the plate whole beside its
1284 // chord, and never a sentence.1279 // chord, and never a sentence.
1285- assert!(item.label().split_whitespace().count() <= 4, "{}", item.label());1280+ assert!(
1281+ item.label().split_whitespace().count() <= 4,
1282+ "{}",
1283+ item.label()
1284+ );
1286 }1285 }
1287 // The two removes must not read as the same verb now that the column1286 // The two removes must not read as the same verb now that the column
1288 // beside them is empty.1287 // beside them is empty.
@@ -1604,11 +1603,9 @@ fn adding_a_row_drops_the_whole_source_in_at_the_playhead() {
1604 let frames = session.file_frames(&second);1603 let frames = session.file_frames(&second);
1605 // Through the engine door `insert_source` uses, with the row's own1604 // Through the engine door `insert_source` uses, with the row's own
1606 // stream: the button, the drop and this are one call.1605 // stream: the button, the drop and this are one call.
1607- assert!(1606+ assert!(session
1608- session1607+ .place_stream_at(2.0, &second, 0, None)
1609- .place_stream_at(2.0, &second, 0, None)1608+ .expect("av2 is already on the timeline"));
1610- .expect("av2 is already on the timeline")
1611- );
1612 // The whole of source 1 went in and nothing was painted over: the1609 // The whole of source 1 went in and nothing was painted over: the
1613 // timeline is longer by exactly that file.1610 // timeline is longer by exactly that file.
1614 assert_eq!(session.timeline_duration(), 9.0);1611 assert_eq!(session.timeline_duration(), 9.0);
@@ -1635,11 +1632,9 @@ fn adding_a_row_drops_the_whole_source_in_at_the_playhead() {
1635 let path = session.sources()[0].path.clone();1632 let path = session.sources()[0].path.clone();
1636 let frames = session.file_frames(&path);1633 let frames = session.file_frames(&path);
1637 let end = session.timeline_duration();1634 let end = session.timeline_duration();
1638- assert!(1635+ assert!(session
1639- session1636+ .place_stream_at(end, &path, 1, None)
1640- .place_stream_at(end, &path, 1, None)1637+ .expect("the French track shares the timeline's parameters"));
1641- .expect("the French track shares the timeline's parameters")
1642- );
1643 assert_eq!(session.sources()[1].audio_stream, 1);1638 assert_eq!(session.sources()[1].audio_stream, 1);
1644 assert_eq!(session.timeline_duration(), end * 2.0);1639 assert_eq!(session.timeline_duration(), end * 2.0);
1645 // Both rows are the same file, so both rows are that file's length --1640 // Both rows are the same file, so both rows are that file's length --
@@ -1689,11 +1684,9 @@ fn a_row_dropped_on_the_open_bed_lands_under_the_pointer() {
1689 1684
1690 // ...and what the release does with it: the frame back through the same1685 // ...and what the release does with it: the frame back through the same
1691 // rate every box is drawn at, into the door the Add button uses too.1686 // rate every box is drawn at, into the door the Add button uses too.
1692- assert!(1687+ assert!(session
1693- session1688+ .place_stream_at(f64::from(at) / fps, &second, 0, None)
1694- .place_stream_at(f64::from(at) / fps, &second, 0, None)1689+ .expect("av2 is already on this timeline"));
1695- .expect("av2 is already on this timeline")
1696- );
1697 let head = |lane| {1690 let head = |lane| {
1698 session1691 session
1699 .lane_clips(lane)1692 .lane_clips(lane)
@@ -1727,11 +1720,9 @@ fn removing_a_row_is_refused_while_it_plays_and_takes_the_row_away() {
1727 session.import(&asset("test_av2.mp4")).expect("av2 matches");1720 session.import(&asset("test_av2.mp4")).expect("av2 matches");
1728 let second = session.sources()[1].path.clone();1721 let second = session.sources()[1].path.clone();
1729 let end = session.timeline_duration();1722 let end = session.timeline_duration();
1730- assert!(1723+ assert!(session
1731- session1724+ .place_stream_at(end, &second, 0, None)
1732- .place_stream_at(end, &second, 0, None)1725+ .expect("a file just imported is on this timeline"));
1733- .expect("a file just imported is on this timeline")
1734- );
1735 let streams = HashMap::new();1726 let streams = HashMap::new();
1736 let rows = |session: &PlaybackSession| {1727 let rows = |session: &PlaybackSession| {
1737 library_rows(session.sources(), &streams, &HashMap::new(), None, |_| 0).len()1728 library_rows(session.sources(), &streams, &HashMap::new(), None, |_| 0).len()
@@ -2058,11 +2049,9 @@ fn a_track_can_be_added_dropped_on_edited_and_taken_back() {
2058 // A library row let go over that row: the same door the Add button2049 // A library row let go over that row: the same door the Add button
2059 // uses, told which lane it was let go over.2050 // uses, told which lane it was let go over.
2060 let path = session.sources()[0].path.clone();2051 let path = session.sources()[0].path.clone();
2061- assert!(2052+ assert!(session
2062- session2053+ .place_stream_at(1.0, &path, 0, Some(v2))
2063- .place_stream_at(1.0, &path, 0, Some(v2))2054+ .expect("its own file is on this timeline"));
2064- .expect("its own file is on this timeline")
2065- );
2066 assert_eq!(session.lane_clips(v2).len(), 1, "the drop landed on V2");2055 assert_eq!(session.lane_clips(v2).len(), 1, "the drop landed on V2");
2067 assert_eq!(session.lane_clips(v2)[0].start, 30, "at the playhead");2056 assert_eq!(session.lane_clips(v2)[0].start, 30, "at the playhead");
2068 // ...with the sound it came with, on the row of its own the drop added:2057 // ...with the sound it came with, on the row of its own the drop added:
@@ -2149,22 +2138,18 @@ fn a_selection_drag_moves_every_pick_by_the_same_delta() {
2149 2138
2150 // clip0 on V1 at the fixture's own start; clip1 on V1 ten seconds in,2139 // clip0 on V1 at the fixture's own start; clip1 on V1 ten seconds in,
2151 // appended to the open bed and rippling nothing.2140 // appended to the open bed and rippling nothing.
2152- assert!(2141+ assert!(session
2153- session2142+ .place_stream_at(10.0, &second, 0, None)
2154- .place_stream_at(10.0, &second, 0, None)2143+ .expect("av2 is on this timeline"));
2155- .expect("av2 is on this timeline")
2156- );
2157 let clip0 = session.lane_clips(Lane::V1)[0];2144 let clip0 = session.lane_clips(Lane::V1)[0];
2158 let clip1 = session.lane_clips(Lane::V1)[1];2145 let clip1 = session.lane_clips(Lane::V1)[1];
2159 assert_eq!((clip0.start, clip1.start), (0, 300));2146 assert_eq!((clip0.start, clip1.start), (0, 300));
2160 2147
2161 // clipC on a second video row, well past both of the above.2148 // clipC on a second video row, well past both of the above.
2162 let v2 = session.add_lane(LaneKind::Video);2149 let v2 = session.add_lane(LaneKind::Video);
2163- assert!(2150+ assert!(session
2164- session2151+ .place_stream_at(20.0, &path, 0, Some(v2))
2165- .place_stream_at(20.0, &path, 0, Some(v2))2152+ .expect("test_av.mp4 is on this timeline"));
2166- .expect("test_av.mp4 is on this timeline")
2167- );
2168 let clip_c = session.lane_clips(v2)[0];2153 let clip_c = session.lane_clips(v2)[0];
2169 assert_eq!(clip_c.start, 600);2154 assert_eq!(clip_c.start, 600);
2170 2155
@@ -2217,28 +2202,22 @@ fn a_selection_drag_refuses_as_one_set_when_any_pick_cannot_land() {
2217 session.import(&asset("test_av2.mp4")).expect("av2 matches");2202 session.import(&asset("test_av2.mp4")).expect("av2 matches");
2218 let second = session.sources()[1].path.clone();2203 let second = session.sources()[1].path.clone();
2219 2204
2220- assert!(2205+ assert!(session
2221- session2206+ .place_stream_at(10.0, &second, 0, None)
2222- .place_stream_at(10.0, &second, 0, None)2207+ .expect("av2 is on this timeline"));
2223- .expect("av2 is on this timeline")
2224- );
2225 let clip0 = session.lane_clips(Lane::V1)[0];2208 let clip0 = session.lane_clips(Lane::V1)[0];
2226 let clip1 = session.lane_clips(Lane::V1)[1];2209 let clip1 = session.lane_clips(Lane::V1)[1];
2227 2210
2228 let v2 = session.add_lane(LaneKind::Video);2211 let v2 = session.add_lane(LaneKind::Video);
2229- assert!(2212+ assert!(session
2230- session2213+ .place_stream_at(0.0, &path, 0, Some(v2))
2231- .place_stream_at(0.0, &path, 0, Some(v2))2214+ .expect("test_av.mp4 is on this timeline"));
2232- .expect("test_av.mp4 is on this timeline")
2233- );
2234 let clip_c = session.lane_clips(v2)[0];2215 let clip_c = session.lane_clips(v2)[0];
2235 // A clip clip1 is not picked, blocking the road on V2 the drag is about2216 // A clip clip1 is not picked, blocking the road on V2 the drag is about
2236 // to try: clip1 dragged onto V2 lands its head inside this one.2217 // to try: clip1 dragged onto V2 lands its head inside this one.
2237- assert!(2218+ assert!(session
2238- session2219+ .place_stream_at(10.0, &second, 0, Some(v2))
2239- .place_stream_at(10.0, &second, 0, Some(v2))2220+ .expect("av2 is on this timeline"));
2240- .expect("av2 is on this timeline")
2241- );
2242 let blocker = session.lane_clips(v2)[1];2221 let blocker = session.lane_clips(v2)[1];
2243 assert_eq!(blocker.start, 300);2222 assert_eq!(blocker.start, 300);
2244 2223
@@ -2293,20 +2272,16 @@ fn a_three_pick_copy_paste_preserves_gaps_and_lane_assignment() {
2293 session.import(&asset("test_av2.mp4")).expect("av2 matches");2272 session.import(&asset("test_av2.mp4")).expect("av2 matches");
2294 let second = session.sources()[1].path.clone();2273 let second = session.sources()[1].path.clone();
2295 2274
2296- assert!(2275+ assert!(session
2297- session2276+ .place_stream_at(10.0, &second, 0, None)
2298- .place_stream_at(10.0, &second, 0, None)2277+ .expect("av2 is on this timeline"));
2299- .expect("av2 is on this timeline")
2300- );
2301 let clip0 = session.lane_clips(Lane::V1)[0];2278 let clip0 = session.lane_clips(Lane::V1)[0];
2302 let clip1 = session.lane_clips(Lane::V1)[1];2279 let clip1 = session.lane_clips(Lane::V1)[1];
2303 2280
2304 let v2 = session.add_lane(LaneKind::Video);2281 let v2 = session.add_lane(LaneKind::Video);
2305- assert!(2282+ assert!(session
2306- session2283+ .place_stream_at(20.0, &path, 0, Some(v2))
2307- .place_stream_at(20.0, &path, 0, Some(v2))2284+ .expect("test_av.mp4 is on this timeline"));
2308- .expect("test_av.mp4 is on this timeline")
2309- );
2310 let clip_c = session.lane_clips(v2)[0];2285 let clip_c = session.lane_clips(v2)[0];
2311 2286
2312 // Copied in click order, out of the lanes each was clicked in -- exactly2287 // Copied in click order, out of the lanes each was clicked in -- exactly
@@ -2354,20 +2329,16 @@ fn a_colliding_set_paste_refuses_whole() {
2354 session.import(&asset("test_av2.mp4")).expect("av2 matches");2329 session.import(&asset("test_av2.mp4")).expect("av2 matches");
2355 let second = session.sources()[1].path.clone();2330 let second = session.sources()[1].path.clone();
2356 2331
2357- assert!(2332+ assert!(session
2358- session2333+ .place_stream_at(10.0, &second, 0, None)
2359- .place_stream_at(10.0, &second, 0, None)2334+ .expect("av2 is on this timeline"));
2360- .expect("av2 is on this timeline")
2361- );
2362 let clip0 = session.lane_clips(Lane::V1)[0];2335 let clip0 = session.lane_clips(Lane::V1)[0];
2363 let clip1 = session.lane_clips(Lane::V1)[1];2336 let clip1 = session.lane_clips(Lane::V1)[1];
2364 2337
2365 let v2 = session.add_lane(LaneKind::Video);2338 let v2 = session.add_lane(LaneKind::Video);
2366- assert!(2339+ assert!(session
2367- session2340+ .place_stream_at(20.0, &path, 0, Some(v2))
2368- .place_stream_at(20.0, &path, 0, Some(v2))2341+ .expect("test_av.mp4 is on this timeline"));
2369- .expect("test_av.mp4 is on this timeline")
2370- );
2371 let clip_c = session.lane_clips(v2)[0];2342 let clip_c = session.lane_clips(v2)[0];
2372 2343
2373 let items = [(Lane::V1, clip0), (Lane::V1, clip1), (v2, clip_c)];2344 let items = [(Lane::V1, clip0), (Lane::V1, clip1), (v2, clip_c)];
@@ -2422,11 +2393,9 @@ fn a_grouped_clip_on_an_added_lane_closes_its_hole_with_its_caption() {
2422 let (mut session, sub_lane) = with_subtitle_lane();2393 let (mut session, sub_lane) = with_subtitle_lane();
2423 let v2 = session.add_lane(LaneKind::Video);2394 let v2 = session.add_lane(LaneKind::Video);
2424 let path = session.sources()[0].path.clone();2395 let path = session.sources()[0].path.clone();
2425- assert!(2396+ assert!(session
2426- session2397+ .place_stream_at(0.0, &path, 0, Some(v2))
2427- .place_stream_at(0.0, &path, 0, Some(v2))2398+ .expect("its own file is on this timeline"));
2428- .expect("its own file is on this timeline")
2429- );
2430 session2399 session
2431 .place_sub(sub_lane, 0, one_second(0))2400 .place_sub(sub_lane, 0, one_second(0))
2432 .expect("the caption goes down");2401 .expect("the caption goes down");
@@ -2486,20 +2455,38 @@ fn a_source_is_only_ever_asked_for_its_peaks_once() {
2486 .collect::<Vec<_>>()2455 .collect::<Vec<_>>()
2487 };2456 };
2488 let mut waves: HashMap<(PathBuf, usize), Wave> = HashMap::new();2457 let mut waves: HashMap<(PathBuf, usize), Wave> = HashMap::new();
2489- assert_eq!(unseen_sources(&sources, &waves), keys(&sources));2458+ assert_eq!(
2459+ unseen_sources(&sources, &waves, std::time::Instant::now()),
2460+ keys(&sources)
2461+ );
2490 // The entry goes in when the decode *starts*, so the sixty repaints a2462 // The entry goes in when the decode *starts*, so the sixty repaints a
2491 // second that happen while it runs must not start it again -- which is2463 // second that happen while it runs must not start it again -- which is
2492 // what this asserts about a key whose value is not an answer yet.2464 // what this asserts about a key whose value is not an answer yet.
2493 waves.insert((a.clone(), 0), Wave::Loading);2465 waves.insert((a.clone(), 0), Wave::Loading);
2494 assert_eq!(2466 assert_eq!(
2495- unseen_sources(&sources, &waves),2467+ unseen_sources(&sources, &waves, std::time::Instant::now()),
2496 keys(&sources[1..]),2468 keys(&sources[1..]),
2497 "the file's other stream is a key of its own"2469 "the file's other stream is a key of its own"
2498 );2470 );
2499 // A file with no audio is an answer like any other: never re-asked.2471 // A file with no audio is an answer like any other: never re-asked.
2500 waves.insert((a, 1), Wave::Silent);2472 waves.insert((a, 1), Wave::Silent);
2501 waves.insert((b.clone(), 0), Wave::Silent);2473 waves.insert((b.clone(), 0), Wave::Silent);
2502- assert!(unseen_sources(&sources, &waves).is_empty());2474+ assert!(unseen_sources(&sources, &waves, std::time::Instant::now()).is_empty());
2475+ // A decode that *failed* is not an answer: the reason may have gone away
2476+ // (the file was still being copied when it arrived), so it is asked again
2477+ // -- once the stamp is older than the cooldown, so sixty repaints a second
2478+ // do not become sixty decodes.
2479+ let now = std::time::Instant::now();
2480+ waves.insert((b.clone(), 0), Wave::Failed(now));
2481+ assert!(
2482+ unseen_sources(&sources, &waves, now).is_empty(),
2483+ "a failure that just landed is not re-asked at once"
2484+ );
2485+ assert_eq!(
2486+ unseen_sources(&sources, &waves, now + crate::subs::WAVE_RETRY),
2487+ keys(&sources[2..]),
2488+ "and is asked again once the cooldown is out"
2489+ );
2503 // The stream probe is per *file*: the two entries of `a` ask once.2490 // The stream probe is per *file*: the two entries of `a` ask once.
2504 let mut streams: HashMap<PathBuf, Vec<StreamInfo>> = HashMap::new();2491 let mut streams: HashMap<PathBuf, Vec<StreamInfo>> = HashMap::new();
2505 assert_eq!(2492 assert_eq!(
@@ -2802,13 +2789,21 @@ fn every_verb_the_spine_carried_is_a_right_click_row() {
2802 // Every menu is a list of actions the keyboard already reaches, so every2789 // Every menu is a list of actions the keyboard already reaches, so every
2803 // row can wear its chord (DESIGN §4): a row built here out of an id the2790 // row can wear its chord (DESIGN §4): a row built here out of an id the
2804 // registry never files would print an empty column.2791 // registry never files would print an empty column.
2805- for action in MENU_ITEMS.into_iter().chain(BENCH_ITEMS).chain(heads.iter().copied()) {2792+ for action in MENU_ITEMS
2793+ .into_iter()
2794+ .chain(BENCH_ITEMS)
2795+ .chain(heads.iter().copied())
2796+ {
2806 assert!(2797 assert!(
2807 ActionId::ALL.contains(&action),2798 ActionId::ALL.contains(&action),
2808 "{action:?} is a menu row and not a registered action"2799 "{action:?} is a menu row and not a registered action"
2809 );2800 );
2810 }2801 }
2811- for list in [MENU_ITEMS.to_vec(), BENCH_ITEMS.to_vec(), lane_items(Lane::A1)] {2802+ for list in [
2803+ MENU_ITEMS.to_vec(),
2804+ BENCH_ITEMS.to_vec(),
2805+ lane_items(Lane::A1),
2806+ ] {
2812 let first = list.iter().position(|&a| destructive(a));2807 let first = list.iter().position(|&a| destructive(a));
2813 if let Some(first) = first {2808 if let Some(first) = first {
2814 assert!(2809 assert!(