app: leave the soundtrack alone when the clip stops drawing
record-daemon / Build, check and test (push) Failing after 1m27s
record-daemon / Build, check and test (push) Failing after 1m27s
A window that is not drawing stops pulling the clip, so the picture time stands still while the soundtrack keeps playing from its own reader. The sync loop read that growing gap as drift and seeked the sound back to the standing place on every wake, which repeats one second forever. Measured with a window over the app: the picture stayed at 430.83 s for 6192 wakes while the sound ran from 495.66 to 495.82. Only correct the soundtrack once the picture time has moved since the last correction. docs/rune-upstream.md records the three rune faults behind this and the black pause, with the file to change and how to check a fix. Rune main does not fix them (the video code is unchanged) and does not build on Windows here.
This commit is contained in:
1 parent
f6ccbf59bc
commit
4aac0ac70b
3 files changed
+65
No files matched your search
@@ -30,3 +30,8 @@ cargo run -- --snap /tmp/live.png --live --at 40 # real daemon and recordings
|
|||||||
History uses `<area>: <imperative summary>`, for example `app: open the review screen from a
|
History uses `<area>: <imperative summary>`, for example `app: open the review screen from a
|
||||||
card` or `record-daemon: stop writing a log per game`. Lowercase after the colon, no trailing
|
card` or `record-daemon: stop writing a log per game`. Lowercase after the colon, no trailing
|
||||||
period, subject at most 72 characters. The body says why, wrapped at 80 columns.
|
period, subject at most 72 characters. The body says why, wrapped at 80 columns.
|
||||||
|
|
||||||
|
## Rune gaps
|
||||||
|
|
||||||
|
`docs/rune-upstream.md` lists the faults we work around in rune, with the file to change and how
|
||||||
|
to check a fix.
|
||||||
@@ -22,6 +22,8 @@ pub struct Review {
|
|||||||
/// clock instead of the clip's, so the sound never lines up with the clock and plays silent.
|
/// clock instead of the clip's, so the sound never lines up with the clock and plays silent.
|
||||||
/// An audio-only player reads the same file and needs no video, so its sound starts at zero.
|
/// An audio-only player reads the same file and needs no video, so its sound starts at zero.
|
||||||
pub sound: Option<Player>,
|
pub sound: Option<Player>,
|
||||||
|
/// The picture time the soundtrack was last put back to, to spot a window that stopped drawing.
|
||||||
|
steady_at: f64,
|
||||||
pub time: f64,
|
pub time: f64,
|
||||||
pub duration: f64,
|
pub duration: f64,
|
||||||
pub scrubber_width: f32,
|
pub scrubber_width: f32,
|
||||||
@@ -114,6 +116,7 @@ impl Default for Review {
|
|||||||
loading: false,
|
loading: false,
|
||||||
player: None,
|
player: None,
|
||||||
sound: None,
|
sound: None,
|
||||||
|
steady_at: 0.0,
|
||||||
time: 0.0,
|
time: 0.0,
|
||||||
duration: 0.0,
|
duration: 0.0,
|
||||||
scrubber_width: 0.0,
|
scrubber_width: 0.0,
|
||||||
@@ -175,6 +178,7 @@ pub fn show(app: &mut App, game: Timeline) {
|
|||||||
}
|
}
|
||||||
app.review.player = Some(player);
|
app.review.player = Some(player);
|
||||||
app.review.sound = None;
|
app.review.sound = None;
|
||||||
|
app.review.steady_at = 0.0;
|
||||||
Review::mute_video(app.review.player.as_ref().expect("just set"));
|
Review::mute_video(app.review.player.as_ref().expect("just set"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,9 +227,17 @@ fn keep_in_step(app: &mut App) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let watching = app.review.time;
|
let watching = app.review.time;
|
||||||
|
// A window that stops drawing stops pulling the clip, so the pictures stand still while the
|
||||||
|
// soundtrack plays on. Pulling the sound back to that standing place every wake is what
|
||||||
|
// repeats one second forever: only correct when the pictures have moved since the last
|
||||||
|
// correction.
|
||||||
|
if (watching - app.review.steady_at).abs() < 0.05 {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let hearing = sound.time();
|
let hearing = sound.time();
|
||||||
if (hearing - watching).abs() > 0.25 {
|
if (hearing - watching).abs() > 0.25 {
|
||||||
sound.seek(watching);
|
sound.seek(watching);
|
||||||
|
app.review.steady_at = watching;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn tick(app: &mut App, tx: &mut Tx) -> bool {
|
pub fn tick(app: &mut App, tx: &mut Tx) -> bool {
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Rune fixes this app waits on
|
||||||
|
|
||||||
|
Three faults live in rune, not here. Each one names the file, what happens, and how to check the
|
||||||
|
fix. The app carries a workaround for the second and third.
|
||||||
|
|
||||||
|
The pin in `app/Cargo.toml` is `4ddf696`. Updating to `main` (`db7c080`) does not fix any of
|
||||||
|
them: `crates/rune/src/video` and `crates/rune/src/window/video_layer.rs` are identical between
|
||||||
|
the two revisions, and `main` does not build on Windows here because its windows-sys 0.61
|
||||||
|
migration is unfinished (`Win32::Foundation::BOOL` now lives in `windows_sys::core`).
|
||||||
|
|
||||||
|
## 1. A paused clip draws nothing
|
||||||
|
|
||||||
|
`window/video_layer.rs` takes a clip off its compositor layer as soon as it is not running, and
|
||||||
|
pausing makes it not running. The window underneath then has to draw the clip itself, and
|
||||||
|
`Native::show` in `video/windows/mod.rs` takes a frame only when nothing has been shown yet
|
||||||
|
(`Phase::Paused { .. } if self.shown.is_none()`), so `unlayer` puts no picture on the surface.
|
||||||
|
The window paints an empty surface, which reads as black.
|
||||||
|
|
||||||
|
Check: open a recording in the app, pause, the clip area is black while the same moment in the
|
||||||
|
file is bright.
|
||||||
|
|
||||||
|
Cheapest fix first:
|
||||||
|
|
||||||
|
- keep the layer while a clip is paused, instead of releasing it on `status.running == false`;
|
||||||
|
- or, in `unlayer`, set `shown = None` before calling `show`, or put the newest pipe frame on the
|
||||||
|
surface, so leaving the layer leaves a picture behind.
|
||||||
|
|
||||||
|
## 2. A layered clip reports zero as its place when paused
|
||||||
|
|
||||||
|
`live_time` in `video/windows/mod.rs` reads the compositor clock, and that clock stops with
|
||||||
|
playback. The first pause therefore reads 0, which sends any caller's scrubber to the start.
|
||||||
|
|
||||||
|
Check: pause and ask `Player::time()`; it answers 0 while the clip sits near its end.
|
||||||
|
|
||||||
|
Fix: report nothing when the clip's clock has stopped, so `time()` falls back to the clip's own
|
||||||
|
place.
|
||||||
|
|
||||||
|
The app works around it in `app/src/screens/review.rs`: `tick` ignores the player's place while
|
||||||
|
the clip is paused and keeps its own.
|
||||||
|
|
||||||
|
## 3. One reader for pictures and sound stamps the sound wrong
|
||||||
|
|
||||||
|
A video player asks Media Foundation for both streams from one reader, and that reader stamps
|
||||||
|
the sound from its own clock instead of the clip's. The sound then never lines up with the clock
|
||||||
|
and plays silent.
|
||||||
|
|
||||||
|
The app works around it in `app/src/screens/review.rs` with a second, audio-only player over the
|
||||||
|
same file, kept in step by `keep_in_step`.
|
||||||
Reference in new issue
Block a user