forge
Explore
Log in

Don't you dare go Hollow

A decode failure reaches the strip, as the lost sound device does

Browse files at this commit

6bc4cc2459a5d0f99b1bfb56976800557fa4317fAhmet Kaan GümüşParent: 2052c96
  • feat
    • a decode failure reaches the strip, as the lost sound device does
Show full message
feat(app): a decode failure reaches the strip, as the lost sound device does

`PlaybackSession::video_failure_reason` (the engine half is the previous
commit) had no consumer, so a decode failure still reached nobody: the
worker printed it to stderr, dropped the channel, and the app read the
closed channel as the film finishing. The transport said ENDED over a
frozen last good frame with nothing in the window saying why.

It goes through the **existing** notice queue, not a second banner
system: `decode_failed_line` is `audio_lost_line`'s twin, and
`decode_change_notice` is `audio_change_notice`'s, step for step, because
the thing that changed is the same kind of thing -- a reason the engine
started or stopped stating between two frames. `watch_decode` sits beside
`watch_audio` in the pump, keyed to `session_gen` for the same reason, so
a preview flip cannot announce the other session's failure.

`AudioStep`/`audio_step` become `ReasonStep`/`reason_step`: the pure
decision was never about audio, it is a comparison of one session
generation and two reasons, and the picture side now needs it too. A
second copy of that state machine would have been the wrong answer.

The retraction is what keeps this from becoming noise: a decode that
fails, is seeked away from and succeeds takes its line back, or the strip
keeps saying DECODE FAILED over a film that plays. Asserted both ways,
along with the two lines not taking each other down.

cargo test -p edith --bin edith tests::media -- 34/34.
crates/app/src/main.rsmodified+14 -5
@@ -68,11 +68,11 @@ use engine::transform::TransformParams;
68 use engine::{Clip, Codec, ExportHandle, Frame, MediaBitrate, PlaybackSession};68 use engine::{Clip, Codec, ExportHandle, Frame, MediaBitrate, PlaybackSession};
69 use gpui::{69 use gpui::{
70 AnyElement, App, Application, Bounds, ClickEvent, Context, Corners, CursorStyle, Div,70 AnyElement, App, Application, Bounds, ClickEvent, Context, Corners, CursorStyle, Div,
71- DragMoveEvent, FocusHandle, KeyDownEvent, MouseButton, MouseDownEvent,71+ DragMoveEvent, FocusHandle, KeyDownEvent, MouseButton, MouseDownEvent, MouseExitEvent,
72- MouseExitEvent, MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, Point, RenderImage,72+ MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, Point, RenderImage, ScrollDelta,
73- ScrollDelta, ScrollHandle, ScrollWheelEvent, SharedString, Size, Stateful, TextAlign,73+ ScrollHandle, ScrollWheelEvent, SharedString, Size, Stateful, TextAlign, TitlebarOptions,
74- TitlebarOptions, Window, WindowBounds, WindowOptions, canvas, div, point, prelude::*, px,74+ Window, WindowBounds, WindowOptions, canvas, div, point, prelude::*, px, relative, rgb, rgba,
75- relative, rgb, rgba, size,75+ size,
76 };76 };
77 77
78 struct Player {78 struct Player {
@@ -796,6 +796,13 @@ struct Player {
796 /// while the sound is up; seeded by [`Player::session_swapped`], which every796 /// while the sound is up; seeded by [`Player::session_swapped`], which every
797 /// door that installs or drops a session already calls.797 /// door that installs or drops a session already calls.
798 audio_reason: Option<String>,798 audio_reason: Option<String>,
799+ /// The engine's last word on the *picture*, cached so a frame can tell a
800+ /// reason that changed from one that was merely read again. Keyed to
801+ /// `session_gen` for the same reason `audio_watch_gen` is: `pump` serves
802+ /// the preview while one is up and the timeline otherwise, and an unkeyed
803+ /// cache would read the other session's reason.
804+ decode_reason_cache: Option<String>,
805+ decode_watch_gen: u64,
799 /// Which session generation (`session_gen`) the cached reason above describes:806 /// Which session generation (`session_gen`) the cached reason above describes:
800 /// the watch is keyed to the session it is a statement about, so a preview807 /// the watch is keyed to the session it is a statement about, so a preview
801 /// opening or closing seeds the cache instead of announcing the *other*808 /// opening or closing seeds the cache instead of announcing the *other*
@@ -1134,6 +1141,8 @@ fn main() {
1134 // it serves.1141 // it serves.
1135 audio_reason: None,1142 audio_reason: None,
1136 audio_watch_gen: 0,1143 audio_watch_gen: 0,
1144+ decode_reason_cache: None,
1145+ decode_watch_gen: 0,
1137 viz_slot: VizSlot::Main,1146 viz_slot: VizSlot::Main,
1138 viz_hex_edit: None,1147 viz_hex_edit: None,
1139 pending_viz: None,1148 pending_viz: None,
crates/app/src/notices.rsmodified+56 -10
@@ -64,11 +64,30 @@ pub(crate) fn audio_lost_line(reason: &str) -> String {
64 format!("AUDIO LOST{}", audio_tail(reason))64 format!("AUDIO LOST{}", audio_tail(reason))
65 }65 }
66 66
67-/// What a frame of the sound watch decides, as a pure value: the cache's own67+/// A decode failure that arrives *after* a file was opened, said on its own
68+/// line: the same shape as [`audio_lost_line`] and for the same reason -- a
69+/// death mid-session has no open line to hang a tail off, so it leads with the
70+/// state word the strip reads first.
71+///
72+/// The picture twin of the sound line above, and it exists because a decode
73+/// failure used to reach nobody at all: the worker printed it to stderr and
74+/// dropped the channel, and a closed channel is what a finished film looks like
75+/// from the app's side. A file with a damaged middle froze on its last good
76+/// picture and the transport said ENDED. The reason is the engine's own words,
77+/// verbatim -- the app spells none of them.
78+pub(crate) fn decode_failed_line(reason: &str) -> String {
79+ format!("DECODE FAILED — {reason}")
80+}
81+
82+/// What a frame of a reason watch decides, as a pure value: the cache's own
68 /// session generation against the frame's says whether the two are even talking83 /// session generation against the frame's says whether the two are even talking
69 /// about the same session, and only then what the reason did.84 /// about the same session, and only then what the reason did.
85+///
86+/// One type for every reason the engine states, not one per source: the sound
87+/// device and the decode worker both write a string the app has to notice
88+/// changed, and the thing that decides is the same comparison in both cases.
70 #[derive(Clone, Copy, PartialEq, Eq, Debug)]89 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
71-pub(crate) enum AudioStep {90+pub(crate) enum ReasonStep {
72 /// The cache describes the session *before* this one91 /// The cache describes the session *before* this one
73 /// (`Player::session_swapped`): it is seeded and nothing is announced -- a92 /// (`Player::session_swapped`): it is seeded and nothing is announced -- a
74 /// preview that opens or closes is not a device that came back.93 /// preview that opens or closes is not a device that came back.
@@ -81,7 +100,8 @@ pub(crate) enum AudioStep {
81 Nothing,100 Nothing,
82 }101 }
83 102
84-/// [`Player::watch_audio`]'s whole decision, pure: `cached_gen` is the session103+/// [`Player::watch_audio`]'s and [`Player::watch_decode`]'s whole decision,
104+/// pure: `cached_gen` is the session
85 /// generation the cache describes, `session_gen` the one the frame is serving, and105 /// generation the cache describes, `session_gen` the one the frame is serving, and
86 /// two reasons are what the engine says the sound is (`None` for sound that is106 /// two reasons are what the engine says the sound is (`None` for sound that is
87 /// up).107 /// up).
@@ -91,20 +111,20 @@ pub(crate) enum AudioStep {
91 /// so a flip reads a reason that was never about the cached session at all -- a111 /// so a flip reads a reason that was never about the cached session at all -- a
92 /// live device on one side and a dead one on the other is not a change, it is112 /// live device on one side and a dead one on the other is not a change, it is
93 /// two different questions.113 /// two different questions.
94-pub(crate) fn audio_step(114+pub(crate) fn reason_step(
95 cached_gen: u64,115 cached_gen: u64,
96 session_gen: u64,116 session_gen: u64,
97 was: Option<&str>,117 was: Option<&str>,
98 now: Option<&str>,118 now: Option<&str>,
99-) -> AudioStep {119+) -> ReasonStep {
100 if cached_gen != session_gen {120 if cached_gen != session_gen {
101- return AudioStep::Seed;121+ return ReasonStep::Seed;
102 }122 }
103 match (was, now) {123 match (was, now) {
104- (Some(was), Some(now)) if was == now => AudioStep::Nothing,124+ (Some(was), Some(now)) if was == now => ReasonStep::Nothing,
105- (_, Some(_)) => AudioStep::Push,125+ (_, Some(_)) => ReasonStep::Push,
106- (Some(_), None) => AudioStep::Clear,126+ (Some(_), None) => ReasonStep::Clear,
107- (None, None) => AudioStep::Nothing,127+ (None, None) => ReasonStep::Nothing,
108 }128 }
109 }129 }
110 130
@@ -140,6 +160,32 @@ pub(crate) fn audio_change_notice(
140 }160 }
141 }161 }
142 162
163+/// What a *change* in the engine's **decode** reason does to the notice queue:
164+/// the line pushed when a reason arrives, the same line taken back when the
165+/// reason clears. [`audio_change_notice`]'s twin, step for step, because the
166+/// thing that changed is the same kind of thing -- a reason the engine started
167+/// or stopped stating between two frames.
168+///
169+/// The retraction is what keeps this from becoming noise: a decode that fails,
170+/// is seeked away from and succeeds has to take its line back, or the strip
171+/// keeps saying DECODE FAILED over a film that plays.
172+pub(crate) fn decode_change_notice(
173+ notices: &mut std::collections::VecDeque<SharedString>,
174+ was: Option<&str>,
175+ now: Option<&str>,
176+) {
177+ match (was, now) {
178+ (_, Some(reason)) if was != Some(reason) => {
179+ push_notice(notices, decode_failed_line(reason).into());
180+ }
181+ (Some(was), None) => {
182+ let line = decode_failed_line(was);
183+ notices.retain(|notice| notice.as_ref() != line.as_str());
184+ }
185+ _ => {}
186+ }
187+}
188+
143 /// The strip's own width is finite and its message is one line: what a189 /// The strip's own width is finite and its message is one line: what a
144 /// too-long line must never do is lose its *state* word, which sits at the190 /// too-long line must never do is lose its *state* word, which sits at the
145 /// front, or stop mid-word with nothing saying it stopped (user report,191 /// front, or stop mid-word with nothing saying it stopped (user report,
crates/app/src/player/transport.rsmodified+61 -4
@@ -50,19 +50,19 @@ impl Player {
50 /// without the key a preview opening or closing would read the *other*50 /// without the key a preview opening or closing would read the *other*
51 /// session's reason and announce a device loss that never happened.51 /// session's reason and announce a device loss that never happened.
52 pub(crate) fn watch_audio(&mut self) {52 pub(crate) fn watch_audio(&mut self) {
53- let step = audio_step(53+ let step = reason_step(
54 self.audio_watch_gen,54 self.audio_watch_gen,
55 self.session_gen,55 self.session_gen,
56 self.audio_reason.as_deref(),56 self.audio_reason.as_deref(),
57 self.sound_reason(),57 self.sound_reason(),
58 );58 );
59- if step == AudioStep::Nothing {59+ if step == ReasonStep::Nothing {
60 return;60 return;
61 }61 }
62 let was = self.audio_reason.take();62 let was = self.audio_reason.take();
63 self.audio_reason = self.sound_reason().map(str::to_owned);63 self.audio_reason = self.sound_reason().map(str::to_owned);
64 self.audio_watch_gen = self.session_gen;64 self.audio_watch_gen = self.session_gen;
65- if step == AudioStep::Seed {65+ if step == ReasonStep::Seed {
66 // A session swap is not a change: the new session's own open line66 // A session swap is not a change: the new session's own open line
67 // carries its reason, so only a line left over from the session67 // carries its reason, so only a line left over from the session
68 // before is taken back -- and only when this one's sound is up.68 // before is taken back -- and only when this one's sound is up.
@@ -82,6 +82,61 @@ impl Player {
82 );82 );
83 }83 }
84 84
85+ /// The engine's word on the *picture*, watched rather than asked once --
86+ /// [`Self::watch_audio`]'s twin, and the reason a damaged file stops being
87+ /// indistinguishable from a finished one.
88+ ///
89+ /// `PlaybackSession::video_failure_reason` is the writer's side: a decode
90+ /// worker that gave up on a broken packet used to print it to stderr and
91+ /// drop the channel, and a closed channel is what a film reaching its own
92+ /// end looks like from here -- so the transport said ENDED, the picture
93+ /// froze on the last good frame, and nothing in the window said why.
94+ ///
95+ /// Keyed to the session exactly as the sound watch is, for the same reason:
96+ /// `pump` serves the preview while one is up and the timeline otherwise, so
97+ /// an unkeyed cache would read the other session's reason and announce a
98+ /// failure that never happened.
99+ pub(crate) fn watch_decode(&mut self) {
100+ let now = self.decode_reason();
101+ let step = reason_step(
102+ self.decode_watch_gen,
103+ self.session_gen,
104+ self.decode_reason_cache.as_deref(),
105+ now.as_deref(),
106+ );
107+ if step == ReasonStep::Nothing {
108+ return;
109+ }
110+ let was = self.decode_reason_cache.take();
111+ self.decode_reason_cache = now;
112+ self.decode_watch_gen = self.session_gen;
113+ if step == ReasonStep::Seed {
114+ // A session swap is not a change: the new session's own open line
115+ // carries its reason, so only a line left over from the session
116+ // before is taken back -- and only when this one is healthy.
117+ if self.decode_reason_cache.is_none()
118+ && let Some(was) = was
119+ {
120+ let line = decode_failed_line(&was);
121+ self.notices
122+ .retain(|notice| notice.as_ref() != line.as_str());
123+ }
124+ return;
125+ }
126+ decode_change_notice(
127+ &mut self.notices,
128+ was.as_deref(),
129+ self.decode_reason_cache.as_deref(),
130+ );
131+ }
132+
133+ /// The engine's word on the picture for the session the pump serves, read
134+ /// off that session and no other -- the same rule as [`Self::sound_reason`].
135+ fn decode_reason(&self) -> Option<String> {
136+ self.active_session()
137+ .and_then(PlaybackSession::video_failure_reason)
138+ }
139+
85 /// Catches the display up to the clock: everything already due is taken off140 /// Catches the display up to the clock: everything already due is taken off
86 /// the channel and only the last of them is shown, which *is* the141 /// the channel and only the last of them is shown, which *is* the
87 /// drop-when-behind policy. A frame that is not due yet waits in `held`, and142 /// drop-when-behind policy. A frame that is not due yet waits in `held`, and
@@ -90,8 +145,10 @@ impl Player {
90 pub(crate) fn pump(&mut self, window: &mut Window) {145 pub(crate) fn pump(&mut self, window: &mut Window) {
91 // Before the drain, on the one read that does not need the session146 // Before the drain, on the one read that does not need the session
92 // mutably: the sound can die at any point in a frame, and the notice it147 // mutably: the sound can die at any point in a frame, and the notice it
93- // earns is owed to the frame it died in.148+ // earns is owed to the frame it died in. The picture can fail for the
149+ // same reason and earns the same courtesy.
94 self.watch_audio();150 self.watch_audio();
151+ self.watch_decode();
95 // Where the transport was before this drain, so the crossing into152 // Where the transport was before this drain, so the crossing into
96 // `Ended` can be recognised as the one transition it is.153 // `Ended` can be recognised as the one transition it is.
97 let was = self.transport();154 let was = self.transport();
crates/app/src/tests/media.rsmodified+109 -26
@@ -6,15 +6,84 @@ use crate::player::library::{
6 auto_proxies_pref_path, load_auto_proxies_pref, save_auto_proxies_pref,6 auto_proxies_pref_path, load_auto_proxies_pref, save_auto_proxies_pref,
7 };7 };
8 use crate::subs::{8 use crate::subs::{
9- audio_import_tail, load_subtitle_style, save_subtitle_style, sub_line_h_for,9+ SUB_SIZE_RANGE, audio_import_tail, load_subtitle_style, save_subtitle_style, sub_line_h_for,
10- subtitle_style_path, SUB_SIZE_RANGE,10+ subtitle_style_path,
11 };11 };
12 use crate::ui::preview::{bgra_to_rgba, screenshot_path};12 use crate::ui::preview::{bgra_to_rgba, screenshot_path};
13 13
14 /// The notice queue's own half of the sound watch, and the three words it is14 /// The notice queue's own half of the sound watch, and the three words it is
15 /// spelled with -- reached by name because the app's own glob does not carry15 /// spelled with -- reached by name because the app's own glob does not carry
16 /// them (`notices` is a private module re-exported for the window).16 /// them (`notices` is a private module re-exported for the window).
17-use crate::notices::{audio_change_notice, audio_lost_line, audio_tail};17+use crate::notices::{
18+ audio_change_notice, audio_lost_line, audio_tail, decode_change_notice, decode_failed_line,
19+};
20+
21+/// The picture twin of the sound watch above, and the same shape for the same
22+/// reason: a decode failure that arrives between two frames used to reach no
23+/// consumer at all, because the worker printed it to stderr and dropped the
24+/// channel -- and a closed channel is what a finished film looks like from the
25+/// app's side, so the transport said ENDED over a frozen frame with nothing in
26+/// the window saying why.
27+///
28+/// Driven through the queue step, because a test cannot make a decoder fail on
29+/// cue; the engine's writer is the decode worker's, and
30+/// `engine::tests::decode_failure` observes it end to end on the engine side.
31+#[test]
32+fn a_decode_that_fails_under_an_open_file_says_so_and_unsays_it() {
33+ let mut notices: std::collections::VecDeque<gpui::SharedString> =
34+ ["OPENED take.mp4".into()].into_iter().collect();
35+ let failed = decode_failed_line("decode error at access unit 130");
36+ assert!(
37+ failed.starts_with("DECODE FAILED"),
38+ "the line lost the state word the strip reads first: {failed}"
39+ );
40+ // The file was fine, and then the picture stopped: the reason arrives
41+ // between two frames.
42+ decode_change_notice(&mut notices, None, Some("decode error at access unit 130"));
43+ assert_eq!(
44+ notices.back().map(|notice| &***notice),
45+ Some(failed.as_str()),
46+ "a decode failure that arrives mid-session is never pushed"
47+ );
48+ // The same reason read again on the next frame is not news.
49+ decode_change_notice(
50+ &mut notices,
51+ Some("decode error at access unit 130"),
52+ Some("decode error at access unit 130"),
53+ );
54+ assert_eq!(notices.len(), 2, "one failure was announced twice");
55+ // Seeked away from, and it decodes again: the line goes with it, or the
56+ // strip keeps saying DECODE FAILED over a film that plays.
57+ decode_change_notice(&mut notices, Some("decode error at access unit 130"), None);
58+ assert_eq!(
59+ notices.iter().map(|notice| &***notice).collect::<Vec<_>>(),
60+ vec!["OPENED take.mp4"],
61+ "the DECODE FAILED line is still on the strip over a film that plays"
62+ );
63+ // The sound line is a different line and is none of this step's business.
64+ audio_change_notice(&mut notices, None, Some("AUDIO_LOST"));
65+ decode_change_notice(&mut notices, None, Some("decode error at access unit 7"));
66+ decode_change_notice(&mut notices, Some("decode error at access unit 7"), None);
67+ assert_eq!(
68+ notices.iter().map(|notice| &***notice).collect::<Vec<_>>(),
69+ vec!["OPENED take.mp4", audio_lost_line("AUDIO_LOST").as_str()],
70+ "one reason's retraction took the other one's line with it"
71+ );
72+ // The wiring: the pump is the one place every frame passes through, and a
73+ // watcher nothing calls is a message nobody reads.
74+ assert!(
75+ fn_body("pump").contains("self.watch_decode();"),
76+ "the pump stopped watching the engine's decode reason, so a corrupt \
77+ file is a silent freeze again"
78+ );
79+ // ...and it reads the reason off the session the pump is serving, the same
80+ // rule the sound watch follows.
81+ assert!(
82+ fn_body("decode_reason").contains("self.active_session()"),
83+ "the decode watch reads a reason off a session the pump is not \
84+ serving, so a preview flip announces the other session's failure"
85+ );
86+}
18 87
19 /// A reason that changes under a session that is already open says so, and stops88 /// A reason that changes under a session that is already open says so, and stops
20 /// saying so when it clears. This side is the *reader*: the writer of a reason is89 /// saying so when it clears. This side is the *reader*: the writer of a reason is
@@ -72,7 +141,7 @@ fn a_device_that_dies_under_an_open_file_says_so_and_unsays_it() {
72 // cannot be answered as if it were the cached session's own change.141 // cannot be answered as if it were the cached session's own change.
73 let watch = fn_body("watch_audio");142 let watch = fn_body("watch_audio");
74 let args = watch143 let args = watch
75- .split_once("audio_step(")144+ .split_once("reason_step(")
76 .expect(145 .expect(
77 "the watch decides for itself instead of through the pure step the flip test drives",146 "the watch decides for itself instead of through the pure step the flip test drives",
78 )147 )
@@ -106,29 +175,41 @@ fn a_device_that_dies_under_an_open_file_says_so_and_unsays_it() {
106 /// speaks.175 /// speaks.
107 #[test]176 #[test]
108 fn a_preview_flip_is_not_a_device_that_came_back() {177 fn a_preview_flip_is_not_a_device_that_came_back() {
109- use crate::notices::{audio_step, AudioStep};178+ use crate::notices::{ReasonStep, reason_step};
110 // A swap, every way round: seeded, never announced.179 // A swap, every way round: seeded, never announced.
111- assert_eq!(audio_step(7, 8, None, Some("AUDIO_LOST")), AudioStep::Seed);
112- assert_eq!(audio_step(7, 8, Some("AUDIO_LOST"), None), AudioStep::Seed);
113 assert_eq!(180 assert_eq!(
114- audio_step(7, 8, Some("AUDIO_LOST"), Some("AUDIO_LOST")),181+ reason_step(7, 8, None, Some("AUDIO_LOST")),
115- AudioStep::Seed,182+ ReasonStep::Seed
183+ );
184+ assert_eq!(
185+ reason_step(7, 8, Some("AUDIO_LOST"), None),
186+ ReasonStep::Seed
187+ );
188+ assert_eq!(
189+ reason_step(7, 8, Some("AUDIO_LOST"), Some("AUDIO_LOST")),
190+ ReasonStep::Seed,
116 "a flip whose reason reads the same on both sides is still a flip"191 "a flip whose reason reads the same on both sides is still a flip"
117 );192 );
118 // The same session, the reason arriving, changing, and going.193 // The same session, the reason arriving, changing, and going.
119- assert_eq!(audio_step(7, 7, None, Some("AUDIO_LOST")), AudioStep::Push);
120 assert_eq!(194 assert_eq!(
121- audio_step(7, 7, Some("AUDIO_LOST"), Some("device gone")),195+ reason_step(7, 7, None, Some("AUDIO_LOST")),
122- AudioStep::Push196+ ReasonStep::Push
197+ );
198+ assert_eq!(
199+ reason_step(7, 7, Some("AUDIO_LOST"), Some("device gone")),
200+ ReasonStep::Push
201+ );
202+ assert_eq!(
203+ reason_step(7, 7, Some("AUDIO_LOST"), None),
204+ ReasonStep::Clear
123 );205 );
124- assert_eq!(audio_step(7, 7, Some("AUDIO_LOST"), None), AudioStep::Clear);
125 assert_eq!(206 assert_eq!(
126- audio_step(7, 7, Some("AUDIO_LOST"), Some("AUDIO_LOST")),207+ reason_step(7, 7, Some("AUDIO_LOST"), Some("AUDIO_LOST")),
127- AudioStep::Nothing,208+ ReasonStep::Nothing,
128 "the same reason read again on the next frame is not news"209 "the same reason read again on the next frame is not news"
129 );210 );
130- assert_eq!(audio_step(7, 7, None, None), AudioStep::Nothing);211+ assert_eq!(reason_step(7, 7, None, None), ReasonStep::Nothing);
131- assert_eq!(audio_step(0, 0, None, None), AudioStep::Nothing);212+ assert_eq!(reason_step(0, 0, None, None), ReasonStep::Nothing);
132 }213 }
133 214
134 /// The toast tail an audio import earns: rate, channel count and rounded215 /// The toast tail an audio import earns: rate, channel count and rounded
@@ -152,8 +233,8 @@ fn an_audio_import_names_its_rate_channels_and_length() {
152 /// stuck read and never as a frozen window.233 /// stuck read and never as a frozen window.
153 #[test]234 #[test]
154 fn an_import_line_says_a_stage_has_stopped_moving_and_only_then() {235 fn an_import_line_says_a_stage_has_stopped_moving_and_only_then() {
155- use std::sync::atomic::{AtomicU8, Ordering::Relaxed};
156 use std::sync::Arc;236 use std::sync::Arc;
237+ use std::sync::atomic::{AtomicU8, Ordering::Relaxed};
157 let stage = Arc::new(AtomicU8::new(ImportStage::Header as u8));238 let stage = Arc::new(AtomicU8::new(ImportStage::Header as u8));
158 let started = Instant::now() - Duration::from_secs(9);239 let started = Instant::now() - Duration::from_secs(9);
159 let mut import = Import {240 let mut import = Import {
@@ -364,8 +445,8 @@ fn the_wheel_draws_the_sample_a_drag_is_holding() {
364 #[test]445 #[test]
365 fn the_strand_slot_starts_at_the_complement_and_the_write_chooses_it() {446 fn the_strand_slot_starts_at_the_complement_and_the_write_chooses_it() {
366 use engine::decode::{447 use engine::decode::{
367- viz_hue_ui, viz_sat_ui, viz_strand_hue_ui, viz_strand_sat_ui, viz_strand_set,448+ VIZ_PAINT_AZURE, viz_hue_ui, viz_sat_ui, viz_strand_hue_ui, viz_strand_sat_ui,
368- with_viz_paint_hue, with_viz_paint_strands, VIZ_PAINT_AZURE,449+ viz_strand_set, with_viz_paint_hue, with_viz_paint_strands,
369 };450 };
370 451
371 let paint = with_viz_paint_strands(VIZ_PAINT_AZURE, 2);452 let paint = with_viz_paint_strands(VIZ_PAINT_AZURE, 2);
@@ -407,8 +488,8 @@ fn the_strand_slot_starts_at_the_complement_and_the_write_chooses_it() {
407 #[test]488 #[test]
408 fn a_strand_slot_on_a_single_strand_clip_is_the_clip_s_own_colour() {489 fn a_strand_slot_on_a_single_strand_clip_is_the_clip_s_own_colour() {
409 use engine::decode::{490 use engine::decode::{
410- viz_hue_ui, viz_sat_ui, viz_strand_set, viz_strands_of, with_viz_paint_hue,491+ VIZ_PAINT_AZURE, viz_hue_ui, viz_sat_ui, viz_strand_set, viz_strands_of,
411- with_viz_paint_sat, with_viz_paint_strands, VIZ_PAINT_AZURE,492+ with_viz_paint_hue, with_viz_paint_sat, with_viz_paint_strands,
412 };493 };
413 494
414 let one = with_viz_paint_strands(495 let one = with_viz_paint_strands(
@@ -449,8 +530,8 @@ fn a_seek_says_so_only_once_it_has_stood() {
449 /// fifty-one seconds on a 25 GB film.530 /// fifty-one seconds on a 25 GB film.
450 #[test]531 #[test]
451 fn a_silence_card_is_up_while_its_scan_runs_and_says_where_it_has_got_to() {532 fn a_silence_card_is_up_while_its_scan_runs_and_says_where_it_has_got_to() {
452- use std::sync::atomic::Ordering::Relaxed;
453 use std::sync::Arc;533 use std::sync::Arc;
534+ use std::sync::atomic::Ordering::Relaxed;
454 let progress = Arc::new(engine::silence::Progress::default());535 let progress = Arc::new(engine::silence::Progress::default());
455 // Two hours and eight minutes, as the header claims it.536 // Two hours and eight minutes, as the header claims it.
456 progress.total.store(7680, Relaxed);537 progress.total.store(7680, Relaxed);
@@ -880,9 +961,11 @@ fn every_codec_row_is_offered_or_says_why_not() {
880 detail.contains("ec-vorbis"),961 detail.contains("ec-vorbis"),
881 "the row names the encoder like every other live one: {detail}"962 "the row names the encoder like every other live one: {detail}"
882 );963 );
883- assert!(FORMATS964+ assert!(
884- .into_iter()965+ FORMATS
885- .any(|(row, _, _, detail)| row.contains(&Format::Hevc) && detail.contains("intra")));966+ .into_iter()
967+ .any(|(row, _, _, detail)| row.contains(&Format::Hevc) && detail.contains("intra"))
968+ );
886 // The destination follows the format and keeps the stem, mp4 included.969 // The destination follows the format and keeps the stem, mp4 included.
887 assert_eq!(970 assert_eq!(
888 retarget(std::path::Path::new("/a/take.export.mp4"), Format::Wav),971 retarget(std::path::Path::new("/a/take.export.mp4"), Format::Wav),