Commits
Commits on
ef5832fea151ca30db92b142c8de131c5f43fc49Filtered to crates/engine/src/playback.rsClear filter2026-08-20
✨ feat(app): a transform card moves, scales, rotates and crops a clip (ctrl+k)Ahmet Kaan Gümüş · aace3b7Browse files
🐛 fix(engine): a paused preview blends the dissolve instead of hanging on plain AAhmet Kaan Gümüş · 7456e34
🐛 fix(engine): a paused preview blends the dissolve instead of hanging on plain A B's decoder opened only on the tick that first landed inside the window, so a seek or pause that landed there before B's first frame arrived showed pure A forever -- the clock is frozen, so no later tick ever came to correct it. B now opens eagerly at the span's own start (options (c)+(b) combined), well before the window is reached, and try_frame bounds a wait on B's first frame (200ms) for the rare case a seek lands in the window before that head start pays off -- bounded so a source B cannot decode never freezes the preview.
2026-08-19
✨ feat(engine): a dissolve renders in the playback preview tooAhmet Kaan Gümüş · c90e425Browse files
🐛 fix(engine): fades reach exported and played-back audioAhmet Kaan Gümüş · 9ec26f6
🐛 fix(engine): fades reach exported and played-back audio Two bugs: `forces_encode` never checked a clip's own fade, so the default Web MP4 copy path silently dropped fades from the exported AAC track. Worse, `Fade`'s frame counts are timeline (fps) frames but `Fade::apply` multiplies audio-rate sample blocks; unconverted, a fade's threshold was crossed a few milliseconds into any clip, so a fade-out muted the rest of the segment outright and a fade-in finished before an ear (or a 100ms RMS window) could catch it. `Fade::scaled` now re-counts a fade at the mix's own sample rate the moment the audio session learns it, which also fixes the same bug in live preview.
wip(engine): transform table threads through project/playback/proxy, .edith v20Ahmet Kaan Gümüş · 621274eBrowse files
✨ feat(engine): a dissolve renders in the playback preview tooAhmet Kaan Gümüş · 3e66b40
✨ feat(engine): a dissolve renders in the playback preview too The preview used to hard-cut where an export blends -- try_frame now opens B's own decoder (graded and placed at B's own start, mirroring export's Dissolve) once the playhead reaches the tail's dissolve window, and blends its BGRA picture over A's with the same dissolve_weight ramp export uses. One choke point covers both playing and scrubbed/seeked frames, since both drain try_frame the same way.
✨ feat(app): a dissolve key joins two video clips end to end (ctrl+d)Ahmet Kaan Gümüş · 474b80e
✨ feat(app): a dissolve key joins two video clips end to end (ctrl+d) Mirrors the audio crossfade: PlaybackSession::set_transition_out wraps Project::set_transition_out (Dirty::Picture), Player::dissolve_selected picks the join the same way crossfade_selected does, and a second press removes the dissolve it just made. Wired into the keymap, the dispatch table, and the clip context menu.
✨ feat(engine): clips can name a dissolve into their neighbor (edith 19, storage+format)Ahmet Kaan Gümüş · 8369d8e
✨ feat(engine): clips can name a dissolve into their neighbor (edith 19, storage+format) transition_out frames on a video clip dissolve it into the adjacent next clip; split keeps the tail's transition clamped and zeroes the head; v18 files load with hard cuts, v19 round-trips bit-exactly. Blending (playback and export) lands separately.
✨ feat(app): audio fades get wedges, drag handles and a crossfade keyAhmet Kaan Gümüş · 9ce5bf9Browse files
🐛 fix(app): the export card tells the truth about a ranged exportAhmet Kaan Gümüş · 906e7de
🐛 fix(app): the export card tells the truth about a ranged export The size estimate and the audio-codec label both ignored the marked range (a ranged export re-encodes; the card said copy and quoted the whole timeline's size). The RANGE duration is computed from the frame count instead of float seconds, and the speed card's row joins it — same truncation class. The range band gets 2px boundary ticks so it reads over the played fill. bench.rs learns export::start's fifth argument, closing the arity sweep over examples.
merge audio-fades engine (edith 18) and wire fade drag stateAhmet Kaan Gümüş · 55dd056
merge audio-fades engine (edith 18) and wire fade drag state Merges the fades/crossfade engine branch in, adds PlaybackSession wrappers (fade_in_of/set_fade_in/fade_out_of/set_fade_out/crossfade) and the FadeDrag gesture plumbing on the root (start/move/commit), ahead of the drawing and keymap work.
✨ feat(engine): per-clip audio fades and adjacency crossfade (edith 18)Ahmet Kaan Gümüş · 4e4ec16
✨ feat(engine): per-clip audio fades and adjacency crossfade (edith 18) # Conflicts: # crates/engine/src/export.rs
✨ feat(engine): per-clip audio fades, adjacency crossfade, and edith 18Ahmet Kaan Gümüş · 6d0747c
✨ feat(engine): per-clip audio fades, adjacency crossfade, and edith 18 Clip carries fade_in/fade_out, an equal-power gain envelope mixed into playback and export, a crossfade() op that sets both edges of two adjacent audio clips, and split's rule that only the kept edge keeps its fade. The project file format bumps to edith 18 to carry the two new fields; a v17 (or older) file loads with every clip's fades at zero. Fixes a stray fade_in/fade_out struct-literal fragment left outside any Clip literal in Player::trimmed (crates/app/src/player/timeline_edit.rs), which was a syntax error breaking the whole app crate's build. Adds unit coverage for Fade::gain_at's boundary/midpoint curve, the split edge rule, crossfade's adjacency refusal, the Clip size-lock test (40 -> 48 bytes), and a v17-loads-zero-fades / v18-round-trips edith.rs test.
✨ feat(app): the timeline can redo, mirroring undoAhmet Kaan Gümüş · 49a1af3
✨ feat(app): the timeline can redo, mirroring undo Project grows a redo stack: undo pushes the lanes it leaves onto it, redo pops one back, and any fresh edit (snapshot) clears it since the branch undo left behind is no longer where the edit leads. Wired through PlaybackSession::redo, Player::redo and ActionId::Redo, bound to ctrl+y -- bare "y" is already SubtitleStyle's, so redo takes only the ctrl chord.
✨ feat(engine): the project's sample rate is its own to name (.edith v17)Ahmet Kaan Gümüş · 3a2e5eaBrowse files
✨ feat(engine): a project can name its own sample rateAhmet Kaan Gümüş · 31981de
✨ feat(engine): a project can name its own sample rate .edith goes to v17 with an optional samplerate line; the session carries it, save/load round-trip it, and the one audio-open seam every consumer shares (open_multi_streams_speed_at) conforms all segments to the named rate — playback rebuild and both export encoders inherit it for free. Proxies keep their film's own rate. A v16 file loads with the rate unset, meaning derived-from-source as before.
✨ feat(engine): a library preview opens the row's own audio streamAhmet Kaan Gümüş · e6a2fc1
✨ feat(engine): a library preview opens the row's own audio stream PlaybackSession::open_with_audio_stream binds a chosen audio track instead of always the file's first, closing the corner-cut open_preview named. Library rows already carry their own stream index (one row per audio track on a remux), so the preview button now passes it straight through.
✨ feat(app): resolution and rate are choosable before any file opensAhmet Kaan Gümüş · dc9a2c2
✨ feat(app): resolution and rate are choosable before any file opens A pick made on an empty player waits in pending_settings and lands on the next session the moment it is built, the same way a saved project's own numbers do. The inspector rows and the Resolution keystroke work with nothing open; a .edith's saved settings still win over a stale pre-import pick. Engine test proves a later import never touches an explicit resolution or rate.
🐛 fix(engine): the late-drop escape valve survives the speed skipAhmet Kaan Gümüş · 43ff2f2
🐛 fix(engine): the late-drop escape valve survives the speed skip
run() and run_hw() checked abort.late(due) && skipped < LATE_RUN as one
condition, so once LATE_RUN pictures in a row had been dropped for
lateness, the branch fell through to skip_for_speed -- and if that also
said skip (which it does on every other frame at >1x), the escape valve
that is supposed to guarantee one picture in LATE_RUN reaches the screen
never fired. A machine falling behind at speed could go fully silent.
Reordered so lateness is decided first and completely: still-within-run
skips for being late, past-run sends unconditionally (skipped=0), and
skip_for_speed only gets a say once lateness has already said "send".
Measured with a throwaway probe (deleted) against two real files, SW
decode (this box has no HW decode path), 15s per run, same machine
before/after:
a large 4K H.264 mp4 (the falling-behind, worst-case class the
escape valve exists for):
1.0x 219->322 shown, 5->2 resyncs, p99 1131.8ms->75.8ms
1.5x 173->165 shown, 7->7 resyncs, p99 1049.6ms->1113.4ms (noise)
2.0x 134->141 shown, 7->7 resyncs, p99 1055.7ms->970.6ms
a small screen-recording mp4 (keeps up, never hits abort.late): 0
resyncs before and after at all three speeds, numbers unchanged --
the reorder does not touch a file that was never late.
Net: better or a wash everywhere measured, no regression on the class
the bug actually bites.
Adds a deterministic unit test for skip_for_speed's alternation at 2x
and its never-skip guarantee on a span's last frame.🐛 fix(playback): a captions-only group delete clamps the playhead tooAhmet Kaan Gümüş · b980282
🐛 fix(playback): a captions-only group delete clamps the playhead too Since a grouped caption delete ripples every member's own sub lane, a caption grouped only with other captions can shrink timeline_frames() -- and the branch that said such a delete "moves nothing that plays" skipped the one clamp mechanism there is. Grouped-ness for a caption is its link alone, so the dispatch now asks that, and the caption-only group takes the Dirty::Both path like its clip-anchored kin. Cue text itself was never stale: subtitle overlay is pull-rendered every paint.
2026-08-16
🐛 fix(playback): the playhead follows the re-rate through the same mapAhmet Kaan Gümüş · 6d8f3a1
🐛 fix(playback): the playhead follows the re-rate through the same map A speed change left the playhead at its own timeline position while write_speed re-timed the group under it, so the scene changed with the rate -- at 2x from the middle of a clip the cursor jumped a clip's worth of content. Both the commit and every live sample of the bar now map the playhead through a TimelineMap built from the group's own old geometry: each clip member by its old rate against the new one about its own head, each caption member by the held clip's proportion about the held clip's head, and a playhead outside every member unmoved -- nothing ripples, so the difference is the gap's to absorb. TimelineMap (engine/src/map.rs) is the one piecewise-affine answer the re-timing ops will share; this is its read-side consumer, with the laws pinned (monotone, exact on the ends, invertible on the image) and the playhead its first user. The delete and paste migrations land next; until they do, invert and the total shift answer the laws tests alone.
2026-08-15
🐛 fix(playback): a silence cut's boundary decodes forward, not flushAhmet Kaan Gümüş · e045b5e
🐛 fix(playback): a silence cut's boundary decodes forward, not flush Cutting silences leaves a timeline of same-file micro-clips, and every boundary reseeked the worker the expensive way: decoder FLUSH, demuxer seek to the RAP, skip-decode RAP->clip-start (up to a GOP of VCN work, the GPU spikes), then a re-prime whose ~178ms ttff at 4K outlasts the 0.15-0.65s clips -- so the picture starved while the continuous audio feeder played on (the freeze), and LATE_RESYNC answered the starved picture with another flush storm every RESYNC_GAP. - engine-hw: seek_to reaches a target ahead of the decoder, within FORWARD_SECS (0.5s) of it, by decoding forward and dropping through the existing skip path -- no flush, no RAP seek, no re-prime; behind, past the reach, and past EOF keep the flush. Decision extracted as the pure reposition() + tests; position tracked per popped handle. - playback: the session reports picture_priming() -- owed from span start until its first frame -- and the player's resync waits out a prime instead of restarting into it (resync_due, constants kept). - bench cutloop: the freeze metric -- an N-region cut timeline played end to end, displayed/dropped per second, restarts and resyncs.
🐛 fix(timeline): caption flag resets match the engine's reseek exactlyAhmet Kaan Gümüş · cda6d0e
🐛 fix(timeline): caption flag resets match the engine's reseek exactly The app gated its grouped-caption drag and trim flag resets on the caption carrying any link at all, while the engine reseeks only when the group holds clips: a caption grouped only with another caption (ctrl-click two captions, Group) latched the seek wait with no frame ever delivered -- an unbounded repaint loop while paused. PlaybackSession::caption_grouped_with_clips is now the one public answer, asked before the edit moves indices, and both reset gates read it: drag from the press's lane and live index, trim from the trim's own lane and index. The two sides can no longer disagree.
🐛 fix(timeline): grouped caption edits reseek, and the link counter clears caption idsAhmet Kaan Gümüş · 25855e8
🐛 fix(timeline): grouped caption edits reseek, and the link counter clears caption ids A grouped caption's drag and trim move the group's clips with it -- a timeline->source change -- so PlaybackSession::move_sub and trim_sub now invalidate Dirty::Both when the caption is grouped with clips (the check delete_sub already made, now shared as caption_grouped_with_clips), and the app pays the reset_after_reseek a clip's drag and trim pay on the same paths. The link counter a load seeds now sits past every id the file names: from_parts chains the subs a lane already holds, and with_subs -- the door a load's placements actually come through, after from_parts -- raises the counter past the ids its captions carry. A hand-grouped caption holding the file's highest id could have had it re-issued to the next group that asked, silently grouping it with clips it never met. A palette drop onto a subtitle lane renumbers that lane alone; the picks it held now follow the discipline of every other renumbering edit -- kept off the lane, re-read for the marked caption, other lanes' picks untouched. Also folds in the v16 caption-group round-trip test that had been left out of the previous commit.
✨ feat(engine): offset-preserving groups over clips and captionsAhmet Kaan Gümüş · 48cacb6
✨ feat(engine): offset-preserving groups over clips and captions The engine half of manual clip grouping: SubClip gains a link id, the group invariant becomes one-placement-per-lane (span equality dropped), group_all builds a hand group over clips and captions with mates riding along, splits keep the left group and share one fresh id on the right (captions included), deletes ripple each media member's own span on its own lane and lift caption members, grouped caption drags and group trims move every member by one delta clamped to each member's own walls, and the save format grows an optional 6th sub field as v16. App half (Selection refactor, ctrl+click, ctrl+A, oracle/menu, marks) follows.
2026-08-14
✨ feat(engine): the words a project places are in the file it savesAhmet Kaan Gümüş · df4020f
✨ feat(engine): the words a project places are in the file it saves The `.edith` grows a `sub` line -- `sub <lane> <start> <frames> <track> <in> <out>` -- and a bare `sub <lane>` for a subtitle lane holding nothing, written in the lane's own place among the video and audio ones so the display order a load rebuilds is the one that was saved. Both of a caption's clocks are on the line: the placement in timeline frames like everything else, the window in the microseconds its cues are timed in. MAGIC is `edith 15`. `Project::without_orphan_sources` stops filtering the subtitle lanes out of its `Parts` and `Project::lane_gains` stops filtering them out of its gains -- the two are zipped by `edith::emit`, so they were only ever allowed to filter in step, and now neither does. What is *on* those lanes travels beside them in the new `Project::lane_subs`, one list per lane exactly as the gains are, and comes back through `Project::with_subs`, which is `from_parts` for words: it refuses a caption on a lane that is not a subtitle lane, an empty span or window, a track the palette does not have, a span past the last frame there is, and a lane that overlaps itself. The parser refuses the same file by line number. A v14 project is one that named subtitle files and could place none of them: it loads with its palette whole and no subtitle lane at all, which is what it always meant, and re-saves as v15 having invented neither. Also fixes a version-bump straggler in tests/silence.rs, which asserted `edith 13` against a `edith 14` writer and was red before this change.
✨ feat(engine): the session hands the subtitle lane the rate a project does not knowAhmet Kaan Gümüş · 6a02fb1
✨ feat(engine): the session hands the subtitle lane the rate a project does not know A placement's position is in timeline frames while its words are in microseconds, and the frame rate that joins the two is the one thing a `Project` never holds. So the trim and the mapping-out are asked through `PlaybackSession`, which has the rate, and a front-end never converts a cue's microseconds itself. Grafted from the losing best-of-2 branch, whose wrapper layer this is, and reshaped onto the lane handles the winner speaks: `add_lane`, `remove_lane` and `move_lane` already carry a subtitle lane, so the wrappers are the six calls that are new -- the placements, the two drags, the room a drag has, the lift, and the cues a repaint draws. Nothing here reseeks or invalidates: cues are drawn over whatever picture is on screen, so no decoded frame stops being right.
✨ feat(app): the seat that writes the picture is picked on the card, not by an env pinAhmet Kaan Gümüş · 50af5b5
✨ feat(app): the seat that writes the picture is picked on the card, not by an env pin The export card gains an Encoder row: Auto, Hardware or Software, three rows in a list like every other setting with more than two values -- `e` steps it, a click opens the list, and the planned line under the rows re-probes and says which seat it measured. Auto is what every export did before (the GPU where there is one). Hardware is the GPU or a refusal in words -- `Enc::open` refuses before the muxer exists, so nothing is written -- and it is now the only door to the plugin's AV1 seat, which `VE_HW_AV1=1` used to guard: an env pin nobody exporting a film would ever find. A person who picks it for AV1 gets a plain row naming what happened on this box's driver, and the pick still stands. Software forces the CPU encoder, which also takes the zero-copy path off the table by construction (`Enc::dma_want` answers only for the two hardware seats). Kept with the project: `.edith` gains an `encoder` line at v14, written only when it is not Auto, and a v13 file loads as Auto. - engine: `ExportSettings::force_sw` -> `seat: EncoderSeat`; `hw_seat` returns the refusal instead of falling back; `planned_video` says `NO_HW_SEAT` where it would - app: `Pick::Encoder`/`Choice::Encoder`, card row, `e` in the card's own keyboard and in the keys menu (`FIXED`) - tests: the backends sweep runs all three seats (the AV1 hardware seat excepted, as before), and asserts the refusal is only what a missing seat produces
✨ feat(app): the stand-ins are made when a project asks, not whenever a big film arrivesAhmet Kaan Gümüş · 269b0c2
✨ feat(app): the stand-ins are made when a project asks, not whenever a big film arrives A project now says whether an import makes a proxy by itself. On is the default and the line left out, so every project that came before behaves exactly as it did; off makes nothing at all, and turning Proxies on is what asks for the ones the project is missing -- the only ask there is, since no per-source item exists. The file grows an `autoproxy` line and the version goes to 13: a v12 project makes them by itself, which is all any project could do. The switch is a button beside Proxies in the PROJECT panel, ctrl+o, and a row on the actions card -- the three doors together, as the two sync tests require.
2026-08-13
🔀 merge(engine): the stand-in decides one path, and the intra file keeps its marksAhmet Kaan Gümüş · eff035e
🔀 merge(engine): the stand-in decides one path, and the intra file keeps its marks Lane P's proxy workflow meets a main that had taken S's persistent decode workers, E's pipelined export and E4's zero-copy encode. * `start_span` keeps S's reuse door and P's single substitution point at once: `picture_path(source)` is resolved *before* the door and handed to both halves of it. A worker holding the film is then asked for a span of the stand-in, declines on the path it already has (`Worker::reseek`), and `set_proxies`' seek becomes a respawn on the other file -- while a span that did not change files still costs no thread and no VA-API init. Asking the project for the path at the door, as main did, would have left every proxied span opening a worker from scratch. * `Enc::encode_dma` takes P's `intra` flag, which is not symmetry: a proxy of a file already small enough is coded at that file's own size (`proxy::size_for` -- `wanted` is true for HEVC and AV1 at any size), so an intraframe export's decoder and encoder can agree on a surface and the buffer goes straight across. Marked `false` there, an all-intra stand-in would have carried no sync point at all, which is the exact bug `gop_limit` was written against, reached by the other door. * The five other conflicts were both sides adding a field: `drop_late` and `proxies` next to each other, in the struct and in all three opens. * `enc_depth` is keyed by codec, so the intra seat takes H.264's two. Said in its doc rather than left to be re-derived: that seat is the same entrypoint with every inter dependency removed, so a picture there is finished no later than one on the seat the two was measured on. `nm -D libengine_hw.so` lists sixteen: P's `vh_enc_open_intra` beside E4's `vh_next_frame_dma`, `vh_enc_dma_geometry`, `vh_enc_frame_dma` and main's `vh_seek`. `picture_path` still has exactly one call site outside the tests, and it is in `playback` -- an export reads the film. The intra seat and the zero-copy path are read, not run: every test that would reach either is hardware-gated and the GPU is wedged.
🐛 fix(decode): the queue a file opens with, and the driver a parked worker holdsAhmet Kaan Gümüş · 7985bd5
🐛 fix(decode): the queue a file opens with, and the driver a parked worker holds Five findings from the lane's verification, in the order they bite. DEPTH NEVER ENGAGED ON THE PRIMARY PATH. Every session opens its first worker pass-through -- a freshly opened file *is* the project resolution -- and a pass-through canvas cannot say how big the pictures will be, so it answered 2: the bound this engine had before there was any decode-ahead. A whole file played at that depth until the first seek built a real canvas. The depth now comes from the stream the sync opener already read (`scale::queue_depth`), and a paused burst off a freshly opened 720p file is 17 pictures where it was 3. A PARKED WORKER NO LONGER HOLDS THE DRIVER. The thread that outlives its span used to park on its command channel with the VA-API session open, which widened the Mesa `atexit` window from "quit during a decode" to "quit any time after opening a file". The wait is in two halves now: the fast one keeps everything, so a seek, a scrub step and a clip boundary still find the decoder where they left it, and past two seconds idle the hardware session is closed. The demuxer stays -- it is a file handle and an index, not driver state, and it is what costs seconds to rebuild. DENSITY IS BOUNDED AGAIN. The suite's pump had been weakened to "indices increase", which a one-in-N delivery regression passes. It asserts contiguity again -- every session there is a pull consumer, owed every frame -- and a new test holds a *watched* session to the same contiguity plus a density floor whenever the decoder is measurably keeping up. The queue-depth doc now states the measured numbers (16 at 720p, 12 at 1080p, 3 at 3840x2160, 2 at 4096x2160; a burst is depth + 1), and two comments that still said "cancelled" for what a seek now abandons, and claimed the drop replaced the front-end's resync, are corrected: both mechanisms are live and the drop is the first line.
Merge branch 'main' into worktree-agent-ab6fdf12423ce2e46Ahmet Kaan Gümüş · dd2001c
Merge branch 'main' into worktree-agent-ab6fdf12423ce2e46 # Conflicts: # crates/engine/src/playback.rs
⚡ perf(decode): the queue runs deeper and stops carrying pictures nobody can seeAhmet Kaan Gümüş · fffcda0
⚡ perf(decode): the queue runs deeper and stops carrying pictures nobody can see Two frames of decode-ahead was the whole buffer, so any hiccup emptied it and the decoder could never build a lead. The bound is now a budget in bytes (~96 MB: eleven 1080p pictures, two 4K ones), which is what makes the second half safe: a deeper queue full of stale pictures would be worse than a shallow one, so the worker is told where the playhead stands and stops paying the conversion and the queue slot for anything already behind it. The policy has a floor of its own. A machine that cannot decode in real time is late on every picture, and dropping every picture is a black screen rather than a stutter, so one in nine is handed over regardless -- roughly what the front-end's restart-every-two-seconds produced, without the VA-API init each restart cost. Off unless a caller says it is watching in real time: an export, the file-level API and a test draining as fast as it can each asked for a range of frames and are owed every one of them. The window turns it on, where `Player::pump` was already taking those pictures off the channel and throwing them away one repaint later. The playback suite's own pump asserted contiguous indices; it now asserts increasing ones, which is the invariant that survives a drop -- nothing out of order, nothing twice.
🔀 merge: main's live underrun query beside the lane's ownAhmet Kaan Gümüş · 64a9817
🔀 merge: main's live underrun query beside the lane's own Their `ao_underruns(session, last_at)` is the richer of the two -- it says where the last starved callback was, not only how many there have been -- so it is the one that stays, required symbol and all. What this lane keeps is the *meaning* of the number it reports: the `primed` gate in the RT callback, so the head of a restart and the tail of a played-out stream are not counted, and `ao_stream_ended` beside it.
🐛 fix(audio): a stream that has ended is not a decoder that fell behindAhmet Kaan Gümüş · c179364
🐛 fix(audio): a stream that has ended is not a decoder that fell behind The last unattributed underruns were the *tail* of a stream: once the decoder is done, the ring drains and every quantum after it was counted as lateness, though there was nothing left to be late with. Ten to sixteen per session on a file played to its end, four hundred on a cold scrub. `ao_stream_ended` (optional symbol, like the counter) unprimes the flag when the feeder's decode channel closes -- under the device lock and past the epoch check, so a superseded feeder cannot say it about the stream that replaced it. What is already queued still plays out untouched: this is not a flush and not a pause. The device is also stopped where the audio really is over (`tick`'s played-out branch), since nothing will ever be queued for that stream again, and the stamp goes with it so a later play defers to the first sample of whatever comes next. Whole `--include-ignored` playback suite, 31 sessions: not one `engine_audio: N underruns` line left, where the same run printed 9-16 for `seek_past_the_end_clamps` and ~400 for a 200-step cold scrub before.
✨ feat(engine): the picture may come off the stand-in, the delivery never doesAhmet Kaan Gümüş · 79c69dd
✨ feat(engine): the picture may come off the stand-in, the delivery never does One switch for the project, saved with it as the v12 `proxy` line, and one place that reads it: the span open asks `picture_path`, which hands back the stand-in where the cache has one and the film itself everywhere else. The sound is opened elsewhere and is always the film's; `export` reads the project's own sources and knows nothing of proxies, so a delivery cannot come off one -- and both sides now say out loud which file they read (`export source:` / `picture: proxy`), so that is a grep rather than a belief. *Which* films have a stand-in is deliberately not saved: a proxy is found by the film's own path, length and modification time, so the cache is the single answer and a project file cannot go stale about it. A v11 project loads unchanged and is cut on its films, which is all it could ever do.
🐛 fix(import): Cancel stops the read, not only the landingAhmet Kaan Gümüş · 4d0dd2b
🐛 fix(import): Cancel stops the read, not only the landing The Cancel beside the import line gave the window back and let the disk carry on: a cancelled cold 24 GB remux still cost its twenty seconds, and the notice said so rather than doing anything about it. The flag now reaches the walk — `demux::with_cancel` installs it as the reading thread's own, and every Matroska cluster the header index and the subtitle pass step over checks it and gives up there, with `is_cancelled` telling an abandoned read from a file that would not open. Thread-scoped rather than a parameter, deliberately: a read *is* a thread here (an import worker, an audio feeder, a decode worker), and the walk that has to stop sits five frames under an `open` with a dozen callers, none of which have anything to cancel. An mp4's header stays uncancellable — it is one read inside `mp4::Mp4Reader` with no flag to poll — so the notice and the button say the read stops "where the container lets it" instead of promising the disk went quiet. The feeder's own abandoned opens are NOT wired to this, and the corner-cut in `spawn_feeder_deferred` says why: three runs of one build over 200 cold scrub steps measured 14, 101 and 137 live workers, so that number is the machine's and not the cancel's — and cancelling every step's walk would stop the sidecar index from ever being written, which is the thing that makes the second pass over a film fast.
⚡ perf(decode): the worker that decoded a span stays for the next oneAhmet Kaan Gümüş · bbdd4d6
⚡ perf(decode): the worker that decoded a span stays for the next one A seek used to cost a thread, a container parse and a VA-API initialisation (98 ms measured worst case) before it could decode a single picture, because every span opened a decoder of its own and threw it away again. The worker now outlives its span: it parks on a command channel, and a seek onto the file it already has open reaches it through Worker::reseek -- a demuxer seek and a decoder flush, 1-4 ms measured against a 28-37 ms open of the same file warm. The plugin learns the same trick from the other side: vh_seek repositions an open session exactly as vh_open_at positions a new one, and it is an optional symbol, so a plugin built before it still decodes and its caller simply opens a session per seek as it always did. Cancelling and abandoning become two different things: a seek abandons the span (the thread, the file and the decoder stay), a replacement cancels the worker (the thread ends, and the command channel goes with it, so nothing parks in recv past the session that owns it and no VA-API session meets Mesa's atexit).
🐛 fix(audio): the device waits for a sample instead of playing its own silenceAhmet Kaan Gümüş · 290699e
🐛 fix(audio): the device waits for a sample instead of playing its own silence A seek made the output active before its stream existed: the open runs on the feeder now, so a cold one left the device playing an empty ring and counting a starved quantum for every millisecond of it -- 1721 of them over a scripted cold play-seek-scrub, against 5 warm. The count stopped meaning "the decoder was late" and started meaning "a seek happened". The intent to play is now a flag (`Audio::wants_active`) written under the device lock beside the `content_at` stamp the feeder writes there, so whichever side takes the lock first the other sees its half: the device is started by the first real sample, and a pause landing during an open can never be overtaken by a late activation. Two halves it needed on the way: - the ring refuses a write while a flush is pending and only a *running* device's callback clears the flag, so a device that waits for the write and a write that waits for the device park on each other -- the feeder therefore starts the device on that refusal too, with the sample already in hand. - the restart's own head is no longer counted at all: `Shared::primed` is false from the open and from every flush until something is queued, and a callback that finds nothing while it is false is a stream that has not started rather than a decoder that fell behind. That also takes the callbacks between the connect and the first write out of the count. `ao_underruns` exposes the counter live (optional symbol: a plugin without it plays, it just cannot say), so a storm can attribute starvation to the seek that caused it instead of reading one number at exit. Guard: 50 random seeks into the 2h film off a cold cache, every one of them required to resume -- 0 underruns, where the same storm counted one per seek before.
⚡ perf(engine): a header the session has already read is not read againAhmet Kaan Gümüş · 739bec4
⚡ perf(engine): a header the session has already read is not read again `place_stream_at` and `import_audio` each open two containers on the thread that draws -- the file's own audio header and the timeline's first source's ([`audio_matches`], [`first_audio_of`]) -- and a drop is exactly when that thread is being watched. Measured with `AudioSession::probe`: 10.4 ms warm on a 4.3 GB 1080p H.264 mp4, 6.7 ms on a 12.9 GB 2160p AV1 mkv, and 1701.7 ms on a 3.1 GB 1080p HEVC mkv with its pages cold, against 5.7 ms for that same file warm. A header does not change while a session holds the file, so the session keeps the ones it has read and both doors ask it instead. The free functions stay for `probe_import`, which runs on a worker and is supposed to pay. Proved by answering rather than by timing: the memo is filled with a layout the file does not have and the place is refused in that layout's words, which only a door reading the memo can do.
✨ feat(bench): a seek storm and a play loop, and the underruns they costAhmet Kaan Gümüş · 8271b5d
✨ feat(bench): a seek storm and a play loop, and the underruns they cost The complaint is a long film jumped around in: the sound runs dry and the picture jumps. Neither was measurable. The audio plugin counted its starved callbacks and only whispered them on the way out, so a session could be asked nothing while it ran; `ao_underruns` reads the same counter -- two relaxed atomic loads, nothing added to the RT path but one store on the starved branch -- and `PlaybackSession::audio_underruns` hands it over in device seconds. The picture's half is `restarts`, counted where a worker is replaced, so a seek, a clip boundary and a late-picture resync all land in one number. Two metrics use them. `seekstorm` plays the file and seeks fifty seeded random places, cold then warm, and reports first-frame p50/p95/max beside the underruns each pass cost -- playing, because a paused device runs no callbacks and can never starve. `playloop` runs the app's own pump for N seconds with a jump every five, and reports the gap between frames (p50/p99), the underruns and the restarts, with its own count of late-picture resyncs beside them. Both name the decode backend in the note, as seek and scrub already do: a row that does not say `backend HW` was measured in software. And it would have been. `cargo build -p engine-hw --example bench` selects example targets in every package it is given, and a cdylib is not one, so the line that exists to build the plugin built nothing and the LD_LIBRARY_PATH below it pointed at an empty directory. The plugins are their own build now.