forge
Explore
Log in

Don't you dare go Hollow

🔀 merge(D1): the transport tells the truth at the end — one state machine, and the clock stops where the timeline does

Browse files at this commit

d9fd7cfea7ffecc50f2d451a1d3d8ed82d40dbd3Ahmet Kaan GümüşParent: 364c82133f72b4
crates/app/src/main.rsmodified+237 -71
@@ -618,6 +618,48 @@ const HIST_H: f32 = 96.;
618618 /// counts, lightened enough to read on the dark box.
619619 const HIST_INK: [u32; 3] = [0xE0_5A_5A, 0x5A_D0_7A, 0x5A_9A_E0];
620620
621+/// Where the transport is. The one answer the button's glyph, its label, its
622+/// enablement, the play key and the repaint loop all read -- there is no play
623+/// flag anywhere else, because a second one is a second answer.
624+#[derive(Clone, Copy, PartialEq, Eq, Debug)]
625+enum Transport {
626+ /// No timeline open. Nothing to play and the transport is dimmed.
627+ Stopped,
628+ Playing,
629+ Paused,
630+ /// Played out: the last frame is on screen, the decoder is finished, and the
631+ /// clock is still running past it -- which is exactly why "is the clock
632+ /// going" is not the same question as "is this playing".
633+ Ended,
634+}
635+
636+impl Transport {
637+ /// The timeline is in motion: two bars on the button, and a repaint owed
638+ /// every vsync.
639+ fn is_playing(self) -> bool {
640+ matches!(self, Transport::Playing)
641+ }
642+
643+ /// The play key and the transport button start over from the top rather
644+ /// than toggling -- the end of a timeline is where every NLE does this, and
645+ /// the button does it because the key already did.
646+ fn restarts(self) -> bool {
647+ matches!(self, Transport::Ended)
648+ }
649+}
650+
651+/// What a session's own two answers mean: the clock, unless the timeline has
652+/// been played out -- `played_out` is the engine's end of stream with no frame
653+/// still waiting on the pump, and it wins, because past the end a running clock
654+/// is measuring wall time and not a picture.
655+fn transport(playing: bool, played_out: bool) -> Transport {
656+ match (played_out, playing) {
657+ (true, _) => Transport::Ended,
658+ (_, true) => Transport::Playing,
659+ (_, false) => Transport::Paused,
660+ }
661+}
662+
621663 struct Player {
622664 /// The timeline, once there is one. A run with no file opens without it and
623665 /// waits: the first media import or project load is what fills it, and
@@ -629,11 +671,10 @@ struct Player {
629671 name: SharedString,
630672 image: Option<Arc<RenderImage>>,
631673 /// A frame that arrived before its time; shown on the tick it comes due.
674+ /// The pump's buffer, not transport state -- but a frame waiting here is
675+ /// what keeps a finished decoder from reading as [`Transport::Ended`] one
676+ /// tick early. See [`Player::transport`].
632677 held: Option<Frame>,
633- /// The decoder's channel closed. Frames may still be waiting in `held`.
634- eos: bool,
635- /// Last frame shown; nothing left to animate.
636- done: bool,
637678 /// A seek is waiting for its frame. Keeps the repaint loop alive while
638679 /// paused, which is the only way the new still ever reaches the screen.
639680 pending_seek: bool,
@@ -889,6 +930,9 @@ impl Player {
889930 /// the channel and only the last of them is shown, which *is* the
890931 /// drop-when-behind policy. A frame that is not due yet waits in `held`.
891932 fn pump(&mut self, window: &mut Window) {
933+ // Where the transport was before this drain, so the crossing into
934+ // `Ended` can be recognised as the one transition it is.
935+ let was = self.transport();
892936 // No timeline, nothing to catch up to: the window is showing its empty
893937 // state and there is no decoder to drain.
894938 let Some(session) = &mut self.session else {
@@ -904,10 +948,7 @@ impl Player {
904948 // them apart -- `frame.index` is already a timeline index.
905949 None => match session.try_frame() {
906950 Some(frame) => frame,
907- None => {
908- self.eos = session.is_eos();
909- break;
910- }
951+ None => break,
911952 },
912953 };
913954 if f64::from(frame.index) <= target {
@@ -942,29 +983,56 @@ impl Player {
942983 }
943984 }
944985
945- if self.eos && self.held.is_none() && !self.done {
946- self.done = true;
986+ if self.transport() == Transport::Ended {
947987 // A seek whose worker never produced a frame (vanished file) would
948- // otherwise repaint at vsync forever.
988+ // otherwise repaint at vsync forever. Held true for as long as the
989+ // state does, not just on the crossing: nothing else is coming.
949990 self.pending_seek = false;
950- let elapsed = self.started.map_or(0.0, |t| t.elapsed().as_secs_f64());
951- eprintln!(
952- "eof after {elapsed:.3}s wall: {} frames displayed, {} dropped, clock {:.3}s",
953- self.displayed,
954- self.dropped,
955- session.now()
956- );
991+ if was != Transport::Ended {
992+ // Ended is a *stopped* transport, so the clock stops with it,
993+ // on the out point the timecode and the playhead have been
994+ // showing all along. Nothing else ever stopped it: past the
995+ // last frame wall time takes over and `now()` walks off the end
996+ // of the timeline for as long as the window is left open -- and
997+ // the playhead is what a cut, a paste, an insert and the
998+ // analyser all act at, so every one of them was aiming into
999+ // empty space (measured: a 5 s timeline recognised its end at
1000+ // clock 17.5 s under a slow renderer). End of stream is left
1001+ // set, so this is still `Ended` and the next press restarts.
1002+ if let Some(session) = &mut self.session {
1003+ session.halt_at_end();
1004+ }
1005+ let elapsed = self.started.map_or(0.0, |t| t.elapsed().as_secs_f64());
1006+ eprintln!(
1007+ "eof after {elapsed:.3}s wall: {} frames displayed, {} dropped, clock {:.3}s",
1008+ self.displayed,
1009+ self.dropped,
1010+ self.session.as_ref().map_or(0., PlaybackSession::now)
1011+ );
1012+ }
9571013 }
9581014 }
9591015
960- /// Every end-of-stream flag is app state and the engine knows nothing about
961- /// it, so clearing them after a reseek is what stops the picture from
962- /// staying frozen on the old last frame. Edits reseek inside the engine and
963- /// still owe this.
1016+ /// Where the transport is, asked of the session rather than remembered:
1017+ /// end of stream is the engine's own flag (any seek clears it, which is why
1018+ /// an edit past the end revives the picture) and so is the clock. A held
1019+ /// frame is one still owed to the screen, so the end is not the end yet.
1020+ fn transport(&self) -> Transport {
1021+ let Some(session) = &self.session else {
1022+ return Transport::Stopped;
1023+ };
1024+ transport(
1025+ session.is_playing(),
1026+ session.is_eos() && self.held.is_none(),
1027+ )
1028+ }
1029+
1030+ /// A frame owed to the screen after a reseek, and the buffered one dropped:
1031+ /// what stops the picture from staying frozen on the old last frame. The
1032+ /// end-of-stream flag itself is the engine's and its own seek clears it --
1033+ /// edits reseek inside the engine and still owe this.
9641034 fn reset_after_reseek(&mut self) {
9651035 self.held = None;
966- self.eos = false;
967- self.done = false;
9681036 self.pending_seek = true;
9691037 // An edit moves the indices a drag in flight is holding -- a stroke
9701038 // during one is exactly that -- and an edge committed against a moved
@@ -1933,16 +2001,17 @@ impl Player {
19332001 /// door a ruler click uses -- so a step while playing keeps playing, exactly
19342002 /// as a click does. It starts from the frame the transport is showing, which
19352003 /// past the end is the last one, and that is what lets a step back off EOS
1936- /// revive the picture ([`Player::reset_after_reseek`] clears `done`). Both
2004+ /// revive the picture (the engine's seek leaves [`Transport::Ended`]). Both
19372005 /// ends clamp, so the two go-to actions are this same step asked for more
19382006 /// frames than the timeline has. Selection is untouched: a seek is not an
19392007 /// edit, and nothing it does moves a clip index.
19402008 fn step(&mut self, frames: i64, cx: &mut Context<Self>) {
2009+ let ended = self.transport() == Transport::Ended;
19412010 let Some(session) = &self.session else {
19422011 return;
19432012 };
19442013 let last = ((session.timeline_duration() * self.fps).round() as i64 - 1).max(0);
1945- let now = match self.done {
2014+ let now = match ended {
19462015 true => last,
19472016 false => i64::from(frame_at(session.now(), self.fps)),
19482017 };
@@ -2554,12 +2623,11 @@ impl Player {
25542623 }
25552624 }
25562625
2557- /// Where the playhead is, as the panel draws it. The clock keeps running
2558- /// after the last frame (wall time takes over at audio EOF) while the
2559- /// picture is frozen, so what the UI shows is the clamped one, pinned to
2560- /// the out-point once playback is done.
2626+ /// Where the playhead is, as the panel draws it: pinned to the out point
2627+ /// once playback is done, and clamped to the drawn duration otherwise -- a
2628+ /// tail being dragged draws past the timeline it is about to become.
25612629 fn playhead(&self, duration: f64) -> f64 {
2562- if self.done {
2630+ if self.transport() == Transport::Ended {
25632631 duration
25642632 } else {
25652633 self.session
@@ -2754,11 +2822,11 @@ impl Player {
27542822 self.export_path = PathBuf::new();
27552823 self.project_path = PathBuf::new();
27562824 self.fps = 30.;
2757- // No decoder to wait for a frame from: the hint is what shows.
2825+ // No decoder to wait for a frame from: the hint is what shows. The
2826+ // transport reads `Stopped` from the session being gone, so there is no
2827+ // end-of-stream state left to clear here.
27582828 self.reset_after_reseek();
27592829 self.pending_seek = false;
2760- self.eos = false;
2761- self.done = false;
27622830 }
27632831
27642832 /// One item of a library row's menu, done. Every one of them closes the
@@ -3174,11 +3242,11 @@ impl Player {
31743242 return;
31753243 }
31763244 // Nothing to play is a message, not a transport state. An empty
3177- // timeline is `done` from its one black frame onward, so the restart
3178- // below would start a clock against a zero-length timeline -- and it is
3179- // `done` again by the next repaint, so no later press could ever stop
3180- // it: the button would read "Pause" and never pause. A delete can empty
3181- // the timeline mid-play, and that press must still stop it.
3245+ // timeline is [`Transport::Ended`] from its one black frame onward, so
3246+ // the restart below would start a clock against a zero-length timeline
3247+ // -- and it is Ended again by the next repaint, so no later press could
3248+ // ever stop it: the button would read "Pause" and never pause. A delete
3249+ // can empty the timeline mid-play, and that press must still stop it.
31823250 if nothing_to_play(self.session.as_ref()) {
31833251 match self.session.as_mut().filter(|s| s.is_playing()) {
31843252 Some(session) => session.pause(),
@@ -3187,15 +3255,25 @@ impl Player {
31873255 cx.notify();
31883256 return;
31893257 }
3190- if self.done {
3191- self.seek(0., cx);
3192- if let Some(session) = &mut self.session {
3193- session.play();
3258+ match self.transport() {
3259+ // Nothing open: the button is dimmed and the key says nothing.
3260+ Transport::Stopped => {}
3261+ // Back to the top and away, for the key and the button alike --
3262+ // whichever asked, the transport was showing Play.
3263+ state if state.restarts() => {
3264+ self.seek(0., cx);
3265+ if let Some(session) = &mut self.session {
3266+ session.play();
3267+ }
3268+ }
3269+ _ => {
3270+ if let Some(session) = &mut self.session {
3271+ session.toggle();
3272+ // A paused timeline animates nothing; this is the repaint
3273+ // that puts the new glyph up.
3274+ cx.notify();
3275+ }
31943276 }
3195- } else if let Some(session) = &mut self.session {
3196- session.toggle();
3197- // Past EOF nothing else asks for a repaint.
3198- cx.notify();
31993277 }
32003278 }
32013279
@@ -3412,11 +3490,9 @@ impl Render for Player {
34123490 window.set_window_title(&title);
34133491 self.titled = title;
34143492 }
3415- // No shadow flag: the clock is the only truth about play state.
3416- let playing = self
3417- .session
3418- .as_ref()
3419- .is_some_and(PlaybackSession::is_playing);
3493+ // No shadow flag: the session is the only truth about play state, and
3494+ // [`Player::transport`] is the one place it is read.
3495+ let state = self.transport();
34203496 // A paused timeline has nothing to animate; the toggle handlers notify,
34213497 // which is what starts the loop again. A paused seek keeps the loop
34223498 // running by itself until `pump` has the frame it asked for. An export
@@ -3424,7 +3500,7 @@ impl Render for Player {
34243500 // the screen on a repaint. A notice does not: it waits to be dismissed
34253501 // rather than for a clock, so keeping the loop alive for it would spin
34263502 // the GPU until someone answered it.
3427- if (playing && !self.done) || self.pending_seek || self.export.is_some() {
3503+ if state.is_playing() || self.pending_seek || self.export.is_some() {
34283504 window.request_animation_frame();
34293505 }
34303506
@@ -3889,7 +3965,7 @@ impl Render for Player {
38893965 // Above the panel and only when there is one to show, so it costs
38903966 // the picture nothing the rest of the time.
38913967 .children(self.notice_bar(cx))
3892- .child(self.panel(position, duration, playing, cx))
3968+ .child(self.panel(position, duration, state, cx))
38933969 // Over the panel it was opened on, and under the cards: it is only
38943970 // ever up while neither of them is (`modal`).
38953971 .children(self.context_card(window.viewport_size(), cx))
@@ -4210,7 +4286,7 @@ impl Player {
42104286 &self,
42114287 position: f64,
42124288 duration: f64,
4213- playing: bool,
4289+ state: Transport,
42144290 cx: &mut Context<Self>,
42154291 ) -> impl IntoElement {
42164292 // Where the playhead is *on the bed*, which at the fit is where along
@@ -4224,7 +4300,7 @@ impl Player {
42244300 let exporting = self.exporting().is_some();
42254301 // Everything but Import and Keys needs a timeline to act on: with none
42264302 // open they are dimmed rather than silently doing nothing.
4227- let live = self.session.is_some() && !exporting;
4303+ let live = state != Transport::Stopped && !exporting;
42284304 // The project's own picture size, for the button that cycles it: read
42294305 // per render like everything else here, so a cycle shows on the button
42304306 // that made it.
@@ -4270,7 +4346,7 @@ impl Player {
42704346 // of this line is what a narrow window truncates.
42714347 (
42724348 join_detail(
4273- &self.live_decode(position, playing),
4349+ &self.live_decode(position, state.is_playing()),
42744350 &format!(
42754351 "{} copy · {} paste · {} undo · click the bar to seek · drop a file to \
42764352 import",
@@ -4309,9 +4385,9 @@ impl Player {
43094385 .overflow_x_scroll()
43104386 .child(control(
43114387 "transport",
4312- Some(transport_glyph(playing).into_any_element()),
4313- if playing { "Pause" } else { "Play" },
4314- if nothing_to_play(self.session.as_ref()) && !playing {
4388+ Some(transport_glyph(state).into_any_element()),
4389+ if state.is_playing() { "Pause" } else { "Play" },
4390+ if nothing_to_play(self.session.as_ref()) && !state.is_playing() {
43154391 format!("{} — put a clip on a lane first", key(ActionId::Play))
43164392 } else {
43174393 key(ActionId::Play)
@@ -4321,7 +4397,7 @@ impl Player {
43214397 // against nothing (the key press answers with the
43224398 // notice). Still live while it *is* playing: a delete
43234399 // can empty the timeline mid-play and that has to stop.
4324- live && (playing || !nothing_to_play(self.session.as_ref())),
4400+ live && (state.is_playing() || !nothing_to_play(self.session.as_ref())),
43254401 cx.listener(|this, _: &ClickEvent, _, cx| this.toggle_or_restart(cx)),
43264402 ))
43274403 .child(separator())
@@ -8814,9 +8890,12 @@ fn empty_hint() -> impl IntoElement {
88148890 )
88158891 }
88168892
8817-/// Two bars while playing, a triangle while paused. Drawn, so there is no icon
8818-/// font and no glyph coverage to depend on.
8819-fn transport_glyph(playing: bool) -> impl IntoElement {
8893+/// Two bars while playing, a triangle in every other state -- paused, nothing
8894+/// open, and played out, where the button's next act is to start over rather
8895+/// than to stop something. Drawn, so there is no icon font and no glyph
8896+/// coverage to depend on.
8897+fn transport_glyph(state: Transport) -> impl IntoElement {
8898+ let playing = state.is_playing();
88208899 div()
88218900 .flex()
88228901 .items_center()
@@ -8872,15 +8951,15 @@ mod tests {
88728951 KEYS_ROWS_H, KEYS_W, LABEL_H, LABEL_MIN_W, LANE_H, LANES_MAX, LETTERBOX, LIBRARY_MAX_W,
88738952 LIBRARY_MIN_W, Lane, MENU_ITEMS, MENU_PAD, MENU_ROW_H, MENU_ROWS_H, MENU_W, NO_FILE,
88748953 PANEL_H, Quality, ROW_H, RULER_HIT_H, SELECTED, SILENCE_ROWS, SOURCE_TINTS, SPEED_PRESETS,
8875- SPEED_STEP, SURFACE, SWATCH_W, Source, Speed, StreamInfo, VOLUME_W, Volume, WAVE_BPS,
8876- WAVE_COL, Wave, applicable, band_label, bitrate_refusal, can_add, cancels_export,
8954+ SPEED_STEP, SURFACE, SWATCH_W, Source, Speed, StreamInfo, Transport, VOLUME_W, Volume,
8955+ WAVE_BPS, WAVE_COL, Wave, applicable, band_label, bitrate_refusal, can_add, cancels_export,
88778956 clipboard_after_remove, color_snap, containers, envelope, eq_spectrum, eq_x, eq_y,
88788957 estimated_mb, export_path, export_settings, format_key, format_line, format_refusal,
88798958 fps_label, frac_along, frac_down, frame_at, histogram, is_bare_modifier, is_project,
88808959 keymap, lanes_h, marked, menu_at, next_container, normalise, nothing_to_play, panel_h,
88818960 project_path, push_digit, retarget, scrub_due, show_label, silence_rate, snapped,
8882- source_tint, span_partner, speed_at, summary_head, summary_tail, timecode, unseen_paths,
8883- unseen_sources, whole_take, width_frac, window_title,
8961+ source_tint, span_partner, speed_at, summary_head, summary_tail, timecode, transport,
8962+ unseen_paths, unseen_sources, whole_take, width_frac, window_title,
88848963 };
88858964 use super::{
88868965 LaneKind, Repeat, View, ZOOM_MIN_FRAMES, ZOOM_STEP, file_name, file_uri, library_rows,
@@ -8909,7 +8988,7 @@ mod tests {
89098988 use gpui::{Bounds, Pixels, point, px, size};
89108989 use std::collections::HashMap;
89118990 use std::path::{Path, PathBuf};
8912- use std::time::Duration;
8991+ use std::time::{Duration, Instant};
89138992
89148993 fn asset(name: &str) -> PathBuf {
89158994 Path::new(env!("CARGO_MANIFEST_DIR"))
@@ -10762,6 +10841,95 @@ mod tests {
1076210841 assert_eq!(volume.gain(), 0.75);
1076310842 }
1076410843
10844+ /// The whole transport in one place: the clock keeps running past the last
10845+ /// frame (wall time takes over at audio EOF), so "the clock is going" is
10846+ /// not "this is playing" -- and a button that read the clock showed Pause
10847+ /// on a timeline that had stopped moving. Ended is its own state, it draws
10848+ /// Play, and the next press starts over from the top.
10849+ #[test]
10850+ fn a_played_out_timeline_is_not_playing_and_the_next_press_starts_it_over() {
10851+ assert_eq!(transport(true, false), Transport::Playing);
10852+ assert_eq!(transport(false, false), Transport::Paused);
10853+ // The transition the bug was about: the clock is still running and the
10854+ // decoder is finished. Played out wins, however the clock reads.
10855+ assert_eq!(transport(true, true), Transport::Ended);
10856+ assert_eq!(transport(false, true), Transport::Ended);
10857+
10858+ // What the button draws, in each state. Two bars only while it moves.
10859+ assert!(Transport::Playing.is_playing());
10860+ for state in [Transport::Paused, Transport::Ended, Transport::Stopped] {
10861+ assert!(!state.is_playing(), "{state:?} must draw the Play triangle");
10862+ }
10863+
10864+ // And what a press does: start over at the end, plain toggle before it,
10865+ // nothing with no timeline. Same answer for the key and the button --
10866+ // both come through `Player::toggle_or_restart`.
10867+ assert!(Transport::Ended.restarts());
10868+ for state in [Transport::Playing, Transport::Paused, Transport::Stopped] {
10869+ assert!(!state.restarts(), "{state:?} must toggle, not reseek");
10870+ }
10871+ }
10872+
10873+ /// The half of `Ended` the eye cannot see: the clock. Wall time takes over
10874+ /// at the last frame and nothing used to stop it, so the playhead walked off
10875+ /// the end of the timeline in real time -- and the playhead is what a cut, a
10876+ /// paste, an insert and the analyser all act at. `pump` pauses on the
10877+ /// crossing; this is the engine contract that rests on, driven exactly as
10878+ /// the pump drives it.
10879+ #[test]
10880+ fn the_clock_stops_where_the_timeline_does_and_the_end_still_restarts() {
10881+ let mut session = PlaybackSession::open(asset("test_av.mp4")).expect("open the fixture");
10882+ session.set_gain(0.0);
10883+ // Start a breath short of the end: the tail is what this is about, and
10884+ // playing the whole five seconds would say nothing more.
10885+ session.seek(4.8);
10886+ session.play();
10887+
10888+ // The pump's own loop -- tick, drain, ask where the transport is --
10889+ // with a deadline so a fixture that will not decode fails as a failure
10890+ // rather than as a hang.
10891+ let deadline = Instant::now() + Duration::from_secs(20);
10892+ let mut state = transport(session.is_playing(), session.is_eos());
10893+ while state != Transport::Ended {
10894+ assert!(Instant::now() < deadline, "never reached the end of a 5s file");
10895+ session.tick();
10896+ while session.try_frame().is_some() {}
10897+ state = transport(session.is_playing(), session.is_eos());
10898+ }
10899+
10900+ // What `pump` does on the crossing, and the whole point of it: the
10901+ // position holds still afterwards instead of counting on past the end,
10902+ // and it holds still *on the out point* -- where the timecode and the
10903+ // playhead have been showing it. The clock at the moment the end is
10904+ // recognised is not that: a slow renderer reaches EOF with the clock
10905+ // seconds past the timeline, which is why this repositions rather than
10906+ // only freezing.
10907+ session.halt_at_end();
10908+ let stopped_at = session.now();
10909+ assert_eq!(stopped_at, session.timeline_duration());
10910+ std::thread::sleep(Duration::from_millis(250));
10911+ assert_eq!(session.now(), stopped_at, "the clock kept running past EOF");
10912+ // And it is still the end: pausing must not spend the state the glyph
10913+ // and the restart both read.
10914+ assert!(session.is_eos());
10915+ assert_eq!(
10916+ transport(session.is_playing(), session.is_eos()),
10917+ Transport::Ended
10918+ );
10919+
10920+ // The restart path off that frozen end, which is what the button and
10921+ // the play key do from `Ended`: back to the top, and running.
10922+ session.seek(0.);
10923+ session.play();
10924+ assert!(!session.is_eos(), "a seek revives the session");
10925+ assert!(session.now() < 1.0);
10926+ assert_eq!(
10927+ transport(session.is_playing(), session.is_eos()),
10928+ Transport::Playing
10929+ );
10930+ session.pause();
10931+ }
10932+
1076510933 /// Both ends hold under a key held down: the ABI only accepts `0.0..=1.0`,
1076610934 /// and a wrapped step count would hand it something else.
1076710935 #[test]
@@ -11725,8 +11893,6 @@ fn main() {
1172511893 name: name.clone(),
1172611894 image: None,
1172711895 held: None,
11728- eos: false,
11729- done: false,
1173011896 ruler: Rc::default(),
1173111897 // The whole timeline across the bed, which is where a
1173211898 // project opens: zooming is something the user asks for.
crates/engine/src/playback.rsmodified+19 -0
@@ -1787,6 +1787,25 @@ impl PlaybackSession {
17871787 }
17881788 }
17891789
1790+ /// Stops the transport where the timeline stops: the clock is paused and put
1791+ /// on the out point.
1792+ ///
1793+ /// Playing past the last frame is wall time counting on past the end of the
1794+ /// media -- there is no picture left to pace it -- so a session left at EOF
1795+ /// reports a `now()` that walks off the end of the timeline in real time,
1796+ /// and a caller that reads the playhead (a cut, a paste, an insert) then
1797+ /// acts at a position no clip is at. How far off depends only on how long
1798+ /// the window was left open, so no clamp in a caller is worth writing.
1799+ ///
1800+ /// End of stream is deliberately left set: the picture is still the last
1801+ /// frame and this is still the end. That is what makes it safe to call on
1802+ /// the crossing into it -- the state the transport shows does not change,
1803+ /// only the running clock stops.
1804+ pub fn halt_at_end(&mut self) {
1805+ self.pause();
1806+ self.clock.seek_to(self.timeline_duration());
1807+ }
1808+
17901809 /// Sets the monitoring gain, 0.0 (silent) to 1.0. Mute is a gain of 0.0:
17911810 /// one knob, because muting and turning it down are the same thing to the
17921811 /// device, and *which* the user meant is a question only the UI can answer