Commits
Commits on
eef3d5d644c1eeccb15c810ef846ec75129dca072026-08-14
✨ feat(app): the words get a track of their own, dragged and trimmed like everything elseAhmet Kaan Gümüş · eef3d5d
✨ feat(app): the words get a track of their own, dragged and trimmed like everything else The subtitle strip under the lanes is gone and the subtitle lanes the engine model landed are drawn as lanes: the same row, the same header, the same bed. A palette row is dragged out of the Subtitles list onto one, a placement is dragged along it or onto another subtitle track, either end is trimmed, and the box's own × lifts it off -- a caption is not in the clip selection's index space, so no stroke reaches it and a lane holding one may not be removed. The row is `lane_row`, unbranched: a subtitle lane holds no `Clip` and every other lane holds no `SubClip`, so the two lists are never both full and there is no second kind of row to keep in step. Headers reorder and remove through the machinery every lane already had. An `Ok` is never a toast: `move_sub` and `trim_sub` answer a pick-up-put-back and an edge stopped at a wall with `Ok` and no undo step, so only the refusals are shown, in the engine's own words after the head. A subtitle lane refuses media in `lane_refuses`, so the shadow is red on the way down. Each lane's header carries its eye, on by default and dropped wholesale when a lane is removed or reordered -- what reads it over the picture is the next slice; nothing is saved yet either.
🐛 fix(engine): a palette row that goes takes the placements' indexes with itAhmet Kaan Gümüş · 03073e6
🐛 fix(engine): a palette row that goes takes the placements' indexes with it A `SubClip` names its subtitle track by index into the project's palette, exactly as a `Clip` names its source -- so `remove_subtitles` owed `remove_source`'s rule and did not have it: a row removed above a placement left every clip past it playing the *next* track's words. The probe that found it: three rows, the middle one placed, remove the first -- the caption on the lane silently became another language. Now it follows that rule whole. Refused, naming the lane and the frame up to three of them, while anything on a subtitle lane plays *this* row; allowed otherwise, walking every placement past it down one; and the undo history is cleared, because its snapshots hold the indexes as they were before the walk. The refusal reaches a person already -- the x on a subtitle row shows the engine's words verbatim. Five smaller things the same read turned up, each its own hunk: - a drag that changes nothing is `Ok` and no step, not a refusal: a caption picked up and put back, and an edge pulled past a wall it already stands against, are both a hand that did nothing wrong, and a front-end shows every `Err` as a notice. - `remove_lane` names the captions it still holds and the way out -- three names, a count, "or drag them to another track" -- instead of "1 subtitle(s), the first at frame 0". - its "only track" sentence gets its own arm for a subtitle lane, so the word stays true if the guard that makes it unreachable is relaxed. - `place_sub` says in words that `at` is where it lands and `sub.start` is ignored, which is `place`'s own contract for a clip. - `track_name` is the one place a refusal turns an index into the name a panel shows.
✨ 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
Merge branch 'worktree-agent-acff1c2ce8e5711d3' into worktree-agent-a6b6dbdb311480b83Ahmet Kaan Gümüş · 79d449cBrowse files
✨ feat(engine): subtitles become a third lane kind, placed like everything elseAhmet Kaan Gümüş · ec66e07
✨ feat(engine): subtitles become a third lane kind, placed like everything else `LaneKind::Subtitle` joins the lane list, holding `SubClip`s -- a `[in_us, out_us)` window of one of the project's subtitle tracks (the flat `subtitles` list stays the palette) placed at a timeline frame. A caption is therefore added, ordered, labelled `S1`, snapshotted, rippled, razored and undone by the machinery every clip already goes through: an undo step is the lane list, so subtitles joined the history without one of their own. It carries no `Clip` at all, and that is what keeps the media paths free of it: `Project::lane` hands back an empty slice, so trim/set_eq/set_color/set_fit/ set_speed/lift/delete_in refuse it by the bounds check they already had, the composite and the mix never look at it, and the three doors that could still put a picture on one -- `from_parts`, `place`, `append_clip` -- say so by name. Ops: `place_sub` (refuses an overlap rather than overwriting -- words that lost are simply gone), `move_sub`, `trim_sub`/`trim_sub_room` (clamped like a media trim; the window follows the edge), `lift_sub`, and `sub_lane_cues`, which maps a lane to cues clipped to each window and shifted onto the timeline -- the twin of `export::timeline_cues` for a track that is placed rather than carried. Ripple, paste-room, split and regroup cut the windows by *proportion*, so none of that arithmetic needs a frame rate; only a trim and the mapping take one. Not here, on purpose: persistence (`Parts` has no line for a `SubClip`, so a save leaves the lanes out -- named at the filter) and any UI.
✨ 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.
🐛 fix(app): the cue steps over the bar hanging off the pictureAhmet Kaan Gümüş · 0c26d06
🐛 fix(app): the cue steps over the bar hanging off the picture A notice, the import line and the seek line hang off the bottom edge of the picture region, and the cue plate sat at a fixed 8 px off that same edge -- so every message was drawn across the line being read, and cost the reader both of them. The plate now sits above whatever those bars measured (`height_probe` -> `sub_bottom`) and comes straight back down the frame they leave: the no-notice position is unchanged to the pixel, which is the position people are used to. A picture cue (PGS) is slid up by the same measurement with cancelling top/bottom insets, so the disc's canvas keeps the height -- and so the fit -- it had with nothing hanging there, rather than being refitted into a shorter box. Measured and not counted: a notice wraps to as many lines as the window is narrow (31 px on one line, 43 on two), and any constant here would be right at exactly one width. The probe asks for one more frame when that height changes, because the window a notice arrives on may be paused and never draw again by itself.
🐛 fix(engine): the seat line finishes the sentence about the soundAhmet Kaan Gümüş · aa6d699
🐛 fix(engine): the seat line finishes the sentence about the sound An mp4 mixes its sound on a thread beside the picture, so the encoders line is published half-written -- "HW encode (VA-API) · working out the sound…" -- and completed once the pass is collected. The frame loop does that where the sound lands under the picture; where the *picture* finishes first the pass is collected under the muxer instead, and that path never published again: a card left saying it was still working out a track it had already written. The tests read the line the same way now. They took the first one published, which since hardware encode got fast enough to beat the mix was the half-line, and `a_mixed_timeline_says_it_re_encodes_and_then_does` and `the_planned_encoders_are_the_ones_the_job_opens` failed on it every run; `published_encoders` waits for the line a card settles on instead, and the mixed timeline runs to the end to read that settled line twice.
🐛 fix(engine-hw): the hardware HEVC seat says what its samples meanAhmet Kaan Gümüş · 9fdee6f
🐛 fix(engine-hw): the hardware HEVC seat says what its samples mean The plugin's HEVC encoder wrote no VUI at all, so libavcodec read the stream's colour as "unspecified" and rendered a 709 export through the 601 matrix -- the HEVC decoder takes the bitstream's answer and overwrites the container's with it, which is why the mp4's `colr` box and the Matroska's Colour element could not cover for it (`export_color::every_format_signals_its_space_in_the_bitstream`, both HEVC containers, whenever the plugin is on the path). The three H.273 code points and the range flag now go in at the open, from the same `ColorDescription::output` rule the software intra seat's VUI and both muxers' tags come from, through the vendored `SpsBuilder`'s own `video_signal_type`/`colour_description`. A symbol of its own, `vh_enc_hevc_open_colour`, rather than four more arguments under the old name: a plugin that predates it is then simply missing the seat and the export falls back to the software encoder, which has always written the VUI, instead of being called with a signature it does not have.
🧪 test(engine): the hardware proxy is decoded, not just countedAhmet Kaan Gümüş · 79f2bac
🧪 test(engine): the hardware proxy is decoded, not just counted `a_hardware_proxy_is_every_frame_a_starting_point_too` counted `demux::sync_points` and never read a picture, so it stayed green through 150 of 150 access units no decoder would accept. It now decodes every picture back through the engine, refuses an empty one, and lets ffmpeg read the file with `-v error` and say nothing.
🐛 fix(engine-hw): a group of one picture writes a header a decoder can readAhmet Kaan Gümüş · 9a188c5
🐛 fix(engine-hw): a group of one picture writes a header a decoder can read Every intra-only hardware file was undecodable. The intra seat asks for a group of one picture, the predictor hands that limit to `SpsBuilder::max_frame_num`, and `1.ilog2()` is 0 -- so `0u8 - 4u8` wrapped to 252 in release and every SPS shipped `log2_max_frame_num_minus4 = 252`, outside the spec's 0..=12. Decoders answered "out of range (0-12): got 252". Saturate instead, in both builders that do the arithmetic (the `max_pic_order_cnt_lsb` twin asks for 2 and wrapped to 253) and in the H.265 parser's copy of the same line. Zero is not merely legal for an all-IDR stream, it is right: `frame_num` never leaves 0 there. The limit itself stays 1 -- that is the IDR-per-access-unit mechanism, and only the header field was garbage.
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.
🔀 merge(engine-hw): the encoder that skips the CPU keeps the two it holdsAhmet Kaan Gümüş · 9717151
🔀 merge(engine-hw): the encoder that skips the CPU keeps the two it holds Lane E4's zero-copy encode path meets lane E's two-picture encoder. Both touched the same file at the same place and neither knew of the other. * `vh_seek` and `vh_next_frame_dma` were the textual conflict and nothing more: two different symbols added at one spot. Both kept. * `EncSession::encode_dma` submits a picture like `encode` does, so it counts one in `in_flight` -- one session takes both kinds of picture (an untouched clip hands buffers over while a graded one or a gap goes through the pixel path), and a submission missing from that count is an input buffer the pixel path would believe free one picture too early. * No deferred poll on the dma path, said in a comment where it would go: the depth exists to overlap the *next* picture's CPU interleave with this one's encode, and a picture arriving on the GPU has no interleave to overlap. Draining every call is also what keeps the decoder's own hold on the buffer short. * Per-codec `enc_depth` therefore governs both kinds: the pixel gate is the only one there is, and the dma path leaves `in_flight` at its floor. `nm -D libengine_hw.so` lists both lanes' optional symbols: vh_seek, vh_next_frame_dma, vh_enc_dma_geometry, vh_enc_frame_dma. The refusal fallback is untouched -- a buffer the plugin cannot hand over comes back as pixels, never as a failure. The dma path itself is read, not run: every test that would exercise it is hardware-gated and the GPU is wedged.
Merge branch 'worktree-agent-a1dbd9ef7cdaec697'Ahmet Kaan Gümüş · 1cb74a4
Merge branch 'worktree-agent-a1dbd9ef7cdaec697' # Conflicts: # scripts/bench.sh
🐛 fix(engine-hw): two pictures in flight only on the seat it was measured onAhmet Kaan Gümüş · fa1ce8e
🐛 fix(engine-hw): two pictures in flight only on the seat it was measured on Depth 2 makes a promise about the driver: a picture submitted must hand its access unit back on the very next poll, and `encode` treats a seat that does not as an error, because it cannot write into a buffer the GPU may still be reading. That was measured on the H.264 seat and nowhere else, and it was applied to all three. HEVC and AV1 on this plugin are intra-only through the same driver and very probably behave the same way -- "very probably" is not what a hard error should rest on, and the GPU has been unavailable since the measurement was possible. They take depth 1, which is the one-buffer behaviour every seat had before this lane: the picture coded before the next is written. `enc_depth` says so in one place, and the number is per session rather than a constant, so raising it is a measurement away. Also in the vendored flush: a plane of zero length at a non-zero offset would have flushed the byte one past the mapping, where upstream's byte loop flushed nothing at all for `0..0`. Guarded. No such plane exists on this path -- both NV12 planes are non-empty -- so this is the edge kept closed rather than a bug seen.
🐛 fix(export): one bar, two threads, and it may only ever go forwardsAhmet Kaan Gümüş · e5b7da5
🐛 fix(export): one bar, two threads, and it may only ever go forwards Moving the audio pass onto a thread of its own put two stages on one progress number, and `encode_audio` still wrote its share of the band with `store`: every chunk of the mix pulled the bar back to the sound's small figure while the picture was publishing a large one. Measured on the film's AC-3 track, 12,000 frames: 4,489 backward steps, the worst of them from 5% to 0%. `fetch_max`, and 0 backward steps over the same run. The rule is written on `Shared::progress` rather than only at the call site, because it is the class and not the instance: any stage that can run beside another writes that field with `fetch_max`, never `store`. A `store` is left only where nothing else can be publishing at all -- the terminal `PROGRESS_SCALE`, and the audio-only export that has no second thread. `encode_audio` also had no cancellation checkpoint anywhere in it, which nobody could see while it ran in front of the picture: cancelling an export then left a detached thread mixing the whole timeline behind a job whose outcome was already settled, still writing into its `Shared`. Measured before the fix, cancelling a 12,000-frame export one second in: the mixer went on to finish all 500 s of sound and the process was still busy 1.45 s after the export reported itself finished -- minutes, on a feature film. With the poll in the mix loop, and two more before the encoders that have no checkpoint of their own, the same cancel leaves no thread behind at all (quiet in 0.00 s, and the "mixed ... s of sound" line the mixer prints on completion never appears). And the mp4 muxer's fps on a capped bench run is derived from the highest progress the poll loop saw rather than from one read at the end, which is the same fragility one layer up.
✅ test(playback): the worker still answers after it parks its decoderAhmet Kaan Gümüş · fc53f37
✅ test(playback): the worker still answers after it parks its decoder The burst check already sits paused for four and a half seconds, which is well past the idle mark where a parked worker closes its hardware session, so the seek that follows is exactly the one that has to reopen one lazily. Without it nothing here would notice a worker that came back from an idle park holding a decoder it could no longer use.
🐛 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.
🐛 fix(engine): "no picture in it" is a header's answer, not an extension's guessAhmet Kaan Gümüş · 627d623
🐛 fix(engine): "no picture in it" is a header's answer, not an extension's guess Two residuals of the proxy round, and the doc line that makes a hardware run measure the code it was meant to. The quiet answer for a file that is not a film was name-shaped: an audio-only `.mp4`, `.mkv` or `.mov` is a video container with no video track in it, so no extension can tell and every one of them still opened, failed and said "NO PROXY" about a song. Only the header knows, and the demuxer already knew -- it just said so in prose, which is the one thing in this engine free to be reworded. `NoVideoTrack` makes it a type: the two doors that mean *this file carries no picture at all* return it, a front-end still shows the sentence it always showed, and the proxy takes it as the same silent `None` a 1080p film gets. A picture in a codec nothing here decodes is not that class and stays loud. ...and the cap was soft by exactly what it was capping: the sweep aimed at 20 GB and then two encodes wrote gigabytes on top of it, so the disk held the cap plus a film per encode (~43 GB worst case). It now sweeps to `CACHE_CAP - reserve`, where the reserve is what those encodes will really take -- the file's own bits-per-pixel arithmetic times the 1.25 the hardware seat overshoots its asked-for rate by -- held to half the cap so a single 4K feature cannot empty the cache to make room for itself. `AT_ONCE` moves into the engine beside that arithmetic: how many encodes run at once *is* how much room the sweep must leave, and two places holding that number is one place for them to disagree. The ignored hardware tests now say to build `-p engine-hw --release` as its own step: `--tests` does not rebuild the cdylib, so the plugin beside the test binary is whatever was there last time -- and a hardware claim measured against a stale one is a claim about code nobody edited. One commit rather than two: both fixes are in `proxy.rs`, in regions a hunk split cannot separate cleanly (it was tried once and produced a corrupt intermediate), so each is named here instead.
🐛 fix(engine): a song is not a film to stand in for, and the cache stops at 20 GBAhmet Kaan Gümüş · 2c0dabd
🐛 fix(engine): a song is not a film to stand in for, and the cache stops at 20 GB Two faults of the same shape -- a proxy written or refused where nobody asked for one -- in the one file both callers route through. A song and a still were run through the same door a film is: a demuxer opened on a `.wav` fails, so importing one said "NO PROXY for tone.wav -- the film itself is what plays" and left "no proxy" on its library row. Neither has a picture to stand in for; the true answer is the one a 1080p H.264 film already gets, and it is given before anything is read. ...and nothing ever deleted a stand-in. They are written without being asked for, two at a time, at ~1.37 MB of disk per second of 4K film -- about 11.5 GB for one 2h20 film -- so the honest answer to "how much of my disk is this" was "all of it, eventually". A sweep before every new one brings the directory under 20 GB by deleting the least recently used, which costs a re-encode of a thing that is derived and nothing else. A `.part` is never taken (it is being written now) but its bytes count towards what has to go. Least recently *used* is the access time, which on a relatime mount -- this machine's `/home` -- moves at most once a day: a daily-granularity LRU, which is the right accuracy for an eviction that costs a re-encode.
Merge branch 'main' into worktree-agent-ab6fdf12423ce2e46Ahmet Kaan Gümüş · dd2001c
Merge branch 'main' into worktree-agent-ab6fdf12423ce2e46 # Conflicts: # crates/engine/src/playback.rs
🐛 fix(engine): the GPU's stand-in was one starting point long, not every frameAhmet Kaan Gümüş · 60ae56c
🐛 fix(engine): the GPU's stand-in was one starting point long, not every frame A proxy asked the ordinary hardware seat for a key frame on every picture, which is not the same thing as an intra-only file and does not make one: cros-codecs' low-delay predictor takes the keyframe branch with `idr` false for a forced key frame, writes no SPS or PPS with it, and `fix_slice_nal_headers` -- which reads the parameter sets to know what a slice is -- then marks it a plain I slice. A 60-picture hardware proxy came back with **one** frame a decoder could start on, so its seeks were the film's own seeks and the whole point of it was gone. Software was right all along (150 of 150), which is what hid it. The thing that decides this is the predictor's group limit, and a group of one picture is what an intra seat is: the counter is then pinned at zero, every picture takes the keyframe branch as an IDR, and every access unit carries its own parameter sets. That is the HEVC seat's own mechanism, now the H.264 one's as well. Its own plugin symbol (`vh_enc_open_intra`) rather than a flag on the existing one, matching the AV1 and HEVC seats: a plugin built before it exists has no intra seat, and the caller then takes the software encoder -- which codes one frame a GOP and writes what was asked for -- instead of being handed a long-GOP file under a name that promises otherwise. `intra_only` on anything but the mp4 pair is now refused by name. Checked without a GPU: the group limit and the IDR-marking rule are both unit tests in the plugin. The hardware end-to-end twin (`sync_points` == frame count) is written and `#[ignore]`d, for a machine whose GPU is not wedged.
✅ test(playback): the reused decoder is held to the pixels a fresh one givesAhmet Kaan Gümüş · 86e9455
✅ test(playback): the reused decoder is held to the pixels a fresh one gives The one thing a kept decoder can get wrong is the picture: a session repositioned rather than reopened could carry one span's references into the next and hand back a smear that still arrives at the right index and the right time. One session takes three seeks -- forwards, backwards, forwards -- and every landing is compared byte for byte against the file-level API, which opens a decoder of its own for each of them. Targets are small on purpose: the fixture's only sync sample is frame 0, so each of these decodes from the start of the file under the debug-build software decoder the suite runs on.
🐛 fix(mix): a setting nobody can hear stops rebuilding the soundAhmet Kaan Gümüş · 0689e40
🐛 fix(mix): a setting nobody can hear stops rebuilding the sound Two ways the mix handle lied about who was listening. A ceiling dragged while the limiter is **off** was a full audio rebuild per nudge on the flat single-lane timeline -- a flush, a re-open and a hole in the sound for a number that changes not one sample, because there was no mixer to hand it to and rebuilding was the only thing `push_mix` knew. It now rebuilds only for a setting that actually needs a mixer (`AudioSession::is_mixed`), and hands everything else nowhere, which is where it belongs. And the handle left over from an open that found nothing -- a silent timeline, a source that would not open -- read as a live mixer forever after, so a fader moved later was written into a `MixControls` no thread was reading and never retried. The feeder marks it detached when its open comes back without a mixer (`MixControls::detach`/`is_reachable`), and a mix that cannot be reached rebuilds instead. Guard: 20 ceiling nudges with the limiter off leave the device queue full and start no worker, beside the existing fader/limiter test.
⚡ perf(export): the sound is worked out under the picture, not in front of itAhmet Kaan Gümüş · cd31ad1
⚡ perf(export): the sound is worked out under the picture, not in front of it An export mixed, encoded and held its whole audio track before a single frame was decoded, because the muxer was handed the track when it was created. On a feature film that is minutes of nothing visible happening, and it was pure waiting: an mp4 writes its audio samples after the last picture anyway. So the mp4 muxer declares its audio track where it writes it. `mp4 0.14` builds the movie box at the end from the tracks in the order they were added, and the samples go into `mdat` in the order the caller writes them, so a track added before the first picture and a track added after the last one produce the same file -- which is checked and not argued: a ten-second span of the film exported before and after this is byte-identical, md5 73f1a9ca9b2eb1c4a7a8f8d467e7635e either way. With that gone, the audio pass runs on a thread from the top of `run` and the picture starts immediately. Where it is *waited* for is the whole design: a Matroska file interleaves audio into its clusters from the header on, so that path still collects the pass before the first coded picture (nothing there to overlap, and the copied-picture path is the same muxer); an mp4 collects it at the frame where the thread happens to have finished, and failing that after the last one. Collecting inside the loop is not tidiness -- a mix this engine cannot decode used to refuse in seconds, and an overlapped pass that reported only at the end would spend the whole encode first. Measured on the film, 600 s span, AC-3 5.1 re-encoded to AAC: the audio pass now completes 4.5 s and 7.0 s into the picture on two runs (`export audio: done N s into the picture`), where before it stood in front of it. The wall clock says 214-229 fps against 199-268 for the serial build -- this box was running four other agents' benchmarks and its noise (±30%) is wider than the 10% this is worth on that path, so the stage lines are the evidence and the fps numbers are not. Two smaller things fall out. The progress bar advances with `fetch_max`, so the audio's share of the band cannot pull it backwards while the picture pushes it forwards. And the encoder line says "working out the sound…" until the pass is collected -- the half-line the copied-picture path already used -- so what it publishes is still never a codec that did not run.
✨ feat(app): a Proxies switch in the panel, and the stand-ins made without being askedAhmet Kaan Gümüş · 892f813
✨ feat(app): a Proxies switch in the panel, and the stand-ins made without being asked A film this machine cannot cut at speed -- bigger than 1080p, or HEVC or AV1 at any size -- gets its stand-in started the moment it lands in the library, two at a time so ten dropped files cannot start ten encodes over one hardware seat. The library row says how far it has got and then that there is one; the PROJECT panel's Proxies button says which way the switch is set and carries the least-finished percentage beside it, so a switch thrown before anything is ready says so rather than doing nothing. The switch is an action like every other: ctrl+p, on the actions card, and a button that is both the state and the door -- the two tests that already hold every action to that pass it unchanged. A stand-in that cannot be made is a line and no more: the film itself is what plays, which is what plays until one is ready anyway.
⚡ 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.
⚡ perf(export): the picture the GPU decoded is the picture it encodesAhmet Kaan Gümüş · 366171b
⚡ perf(export): the picture the GPU decoded is the picture it encodes An untouched clip's frames never leave the card: the decode session hands its DRM-PRIME buffer over and the encoder imports it, so an export of a clip with no grade, no tone map, no matrix remap and no canvas to place on costs neither the `vaGetImage` read-back nor the NV12 interleave back up -- both of which used to run once per frame, per side. Three optional plugin symbols carry it (`vh_next_frame_dma`, `vh_enc_dma_geometry`, `vh_enc_frame_dma`), so an older `libengine_hw.so` reads back exactly as it did, and any refusal at all -- another coded size, another fourcc, a driver whose export the plugin will not take, a software decoder on the other end -- hands the pixels over instead of failing. The decode session keeps six pictures out of its pool while they are outstanding, and reserves six extra buffers the moment a caller asks, so a decoder is never robbed of its own. Measured on the film, 60s span, hardware H.264 both ways: 94.58 -> 276.46 fps median, 46.9s -> 15.6s wall, and 37.6s -> 0.5s of user CPU. SSIM against the source frames is 0.964490 where the read-back path scores 0.964506 -- the same picture, coded by the same encoder.
✨ 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.
🔧 chore(bench): an export measurement may carry the sound it is judged byAhmet Kaan Gümüş · 56e406a
🔧 chore(bench): an export measurement may carry the sound it is judged by The export metric covered picture only, and a floor phrased as "twice real time end to end" cannot be read off it: the audio pass is inside that wall clock. BENCH_EXPORT_AUDIO puts the same clip on an audio lane and names the row `_av`, so the two numbers can never be mistaken for each other; BENCH_EXPORT_ASTREAM picks which of the file's tracks it is, a film's second one being the one no sample table can copy (this film's AC-3 5.1 re-encodes at 43x real time, its AAC stereo copies) and therefore the one that measures the re-encode; BENCH_EXPORT_SPAN sets how much timeline a measurement covers, since sixty seconds of a two-hour film says nothing about the pass that runs once per export. And scripts/bench.sh built the plugin it depends on with a target filter that excluded it: `--example bench` selects no target in engine-hw, so a fresh target directory produced no libengine_hw.so and every "hardware" row was software with nothing on it saying so -- the exact silent fallback the LD_LIBRARY_PATH comment three lines below it warns about (11.55 fps against 94.58 for the same span, measured 2026-08-13). Two builds now, and the script refuses to run at all if the plugin is not where the loader will look.
🐛 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(cros-codecs): a cache line is flushed once, not sixty-four timesAhmet Kaan Gümüş · 522e89f
⚡ perf(cros-codecs): a cache line is flushed once, not sixty-four times Unmapping a DMA buffer flushed the CPU's caches back to it a *byte* at a time -- one CLFLUSH per byte, where a CLFLUSH covers a whole 64-byte line. That is 3.1 million instructions per 1080p picture, and it was 6.2 ms of the 8.4 ms a hardware export was spending per frame: the encoder maps its input buffer to write the picture into, and every unmap paid it. The stride is the cache line now. Upstream's own TODO on those lines asks for this and reports a race when it was tried; what orders the flushes is the mfence either side, which is still there, and the sixty-three redundant flushes per line never were. The same `drop` also wrote its munmap as `let _ = zip(..).map(..)` -- a lazy iterator nobody consumes, so no mapping was ever released. An encode session leaked its 3 MB input mapping every frame, 2.2 GB of address space over a 719-frame export. It unmaps in a `for` loop now, and it unmaps what `mmap` actually returned: the plane addresses it used to pass are those bases plus an offset that is not required to be page aligned, which munmap refuses. Export throughput on the 1080p film, hardware H.264 seat, same 30 s span: 89.9 fps before, 239.6 fps after -- 10x realtime, and the file is the same file (a ten-second span exported through both builds is byte-identical, 6,379,699 bytes, ffmpeg -v error empty). tests/hw_decode.rs (10), tests/hw_encode.rs (3) and tests/decode_baseline.rs pass, the pixel oracle `hardware_matches_software_on_frame_30` among them.
✨ feat(engine): a big film gets a small stand-in to cut withAhmet Kaan Gümüş · 83e561d
✨ feat(engine): a big film gets a small stand-in to cut with A proxy is the film at 1280 on its long edge, every frame an IDR, no sound in it at all: a seek lands on the frame asked for instead of on the nearest one a decoder can start from, and the mix stays the original's. Generation is the export walk given a one-clip project and a smaller canvas, so the hardware seat, the progress and the cancel are the ones a file export already had. Two switches were wanted for it: `intra_only` (one frame a GOP on the H.264 pair) and `keep_source_colour`, which carries the film's own space into the stand-in instead of converting it -- that conversion ran on the source's full 4K, cost 48 ms a frame and was the whole of a proxy's price, and leaving it to the screen means the tone-map preset can still be changed after the stand-in was made. The cache is keyed on the source's path, length and modification time, so a re-encoded original misses rather than reading a stale stand-in. A 4K HDR film: 2.35x realtime on the VA-API seat, against 0.59x before the colour switch; a cancel leaves neither the file nor its .part.
⚡ 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).
⚡ perf(engine-hw): the picture is written where the last one is already codedAhmet Kaan Gümüş · 01fb8ce
⚡ perf(engine-hw): the picture is written where the last one is already coded A hardware export spent four fifths of its per-frame time putting the picture *into* the encoder, not encoding it. Two things were paying for that, and both are gone: The NV12 rows were interleaved a byte at a time straight into the mapped buffer object, which is write-combining memory -- every pair of stores flushed a partial buffer. The row is built in ordinary memory now and copied across in one piece: 8.2 ms a picture became 6.7 ms at 1080p (measured on radeonsi by alternating the two paths frame by frame inside one export, so the machine's load weighed on both). And there was one input buffer, so the GPU had to finish coding a picture before the next could be written into it -- the CPU's interleave and the GPU's encode ran end to end. There are two now, and the access unit collected after a submit is the *previous* picture's: the GPU codes while the caller interleaves. Per-frame encode cost, minimum over 719 frames of the same film span, three interleaved runs each: 9.4/9.4/10.2 ms before, 6.9/7.3/7.4 ms after -- 27% off the only stage that was costing anything. The file is the same file: a ten-second span of the same source exported through both plugins is byte-identical (6,379,699 bytes, cmp clean), ffmpeg -v error empty, and tests/hw_encode.rs round trips all three ways.
🧪 test(subtitles): the cue decode is held to the frame it appears onAhmet Kaan Gümüş · 536c87c
🧪 test(subtitles): the cue decode is held to the frame it appears on The picture is decoded once per cue *change* and kept while the line is up (`Player::sub_picture`), so the number that matters is the one frame a new line costs. Measured on a real BluRay remux's PGS track: 371 µs for a 1920x1080 display set, against a 16.7 ms frame. Written down as an assert, since a cache that quietly stopped catching would show up here as nothing at all.
🐛 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.
⚡ perf(engine): the Opus decoder gets the transform it was written aroundAhmet Kaan Gümüş · edbb3e3
⚡ perf(engine): the Opus decoder gets the transform it was written around `ruopus` was asked for `std` alone, and its default `spectrograms` feature -- read here as "its own analysis tools" -- is the FFT backend of the CELT synthesis MDCT. Without it the crate evaluates an O(n²) DFT in f64 per block, and a 5.1 soundtrack decoded at 0.95x realtime: slower than playing it. Measured on the project's own fixtures, release: test_tone.opus 10.44x -> 135.01x realtime test_opus_51.mka 0.95x -> 103.80x test_opus_71.mka 0.93x -> 112.04x Not bit-identical -- FFT summation order differs -- but the two builds agree to 144 dB SNR (max |Δ| 3.7e-8) while both sit 93 dB from ffmpeg's libopus decode of the same file, so the change is 40 dB below the decoder's existing distance to the reference.
✨ 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.
🧹 test(scratch): a run that never unwound has its directory taken by the next oneAhmet Kaan Gümüş · 267d45b
🧹 test(scratch): a run that never unwound has its directory taken by the next one `Drop` cleans up after a passing test and after a panicking one, but not after an aborted one -- the AV1 hardware encoder aborts whenever the driver's ring hangs, and five directories from this morning's runs were still in /tmp. The name already carries the process id that made it, so the first scratch directory of a run reaps every `ve_*` one whose owner is no longer in /proc, and leaves a live sibling suite's alone.