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
@@ -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.
|
||||
/// An audio-only player reads the same file and needs no video, so its sound starts at zero.
|
||||
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 duration: f64,
|
||||
pub scrubber_width: f32,
|
||||
@@ -114,6 +116,7 @@ impl Default for Review {
|
||||
loading: false,
|
||||
player: None,
|
||||
sound: None,
|
||||
steady_at: 0.0,
|
||||
time: 0.0,
|
||||
duration: 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.sound = None;
|
||||
app.review.steady_at = 0.0;
|
||||
Review::mute_video(app.review.player.as_ref().expect("just set"));
|
||||
}
|
||||
|
||||
@@ -223,9 +227,17 @@ fn keep_in_step(app: &mut App) {
|
||||
return;
|
||||
}
|
||||
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();
|
||||
if (hearing - watching).abs() > 0.25 {
|
||||
sound.seek(watching);
|
||||
app.review.steady_at = watching;
|
||||
}
|
||||
}
|
||||
pub fn tick(app: &mut App, tx: &mut Tx) -> bool {
|
||||
|
||||
Reference in new issue
Block a user