Commits
Commits on
7985bd573d2b4cce4c8f79e6cf1bd5ead91597bb2026-08-13
🐛 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
✅ 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.
⚡ 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.
⚡ 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).
🧪 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.
⚡ 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.
🐛 fix(tests): a card's body ends where the card doesAhmet Kaan Gümüş · f6f8156
🐛 fix(tests): a card's body ends where the card does `every_card_closes_without_the_keyboard` read a card's source "up to the next `\n fn `" out of every source file joined end to end -- and these methods are `pub(crate) fn`, which that cut matches none of. So each body ran tens of thousands of characters past its own end, through the rest of its file and into the next one: `mix_card`'s scrim could stop closing the card and the guard still passed, on five other cards' `close_card` calls downstream of it. Two helpers in the tests' own module now, because a slice that starts at `ui_source()` spills by construction and there are 42 seams to spill at: `source_from` cuts inside the one file its needle is in, and `fn_body` ends a method at the ` }` at the impl's own indent. The inspector's occlusion rule reuses the first; the concatenation keeps its old job of answering whether a line is written anywhere, and says so.
🚚 refactor(app): the window's look moves out beside its doingAhmet Kaan Gümüş · b593558
🚚 refactor(app): the window's look moves out beside its doing `impl Render for Player` -- the one render the whole interface hangs off -- leaves main.rs for render.rs, next to the modules its methods went to last stage. main.rs is now the state (`struct Player`), the wiring and `fn main`: 1,343 lines down to 716. Pure motion: the impl is verbatim, gate and all (`view().following(position)` at render.rs:84), and the layout guard that slices the root render finds it by search rather than by name, so it follows the move untouched.
🔧 chore(app): the window's doing moves out from under its beingAhmet Kaan Gümüş · 47b29ea
🔧 chore(app): the window's doing moves out from under its being
`impl Player` was 4,330 lines of it -- the pump, the dispatch, the
selection, every card, the whole timeline edit, the library door and the
export -- in one block under the struct it acts on. Each of those is a
kind of doing, so each is a module: `player/{transport,actions,view,
cards,timeline_edit,library,export}.rs`, seven detached `impl Player`
blocks beside the state rather than inside it.
`struct Player` and `impl Render for Player` stay in `main.rs`, which is
what keeps this invisible: the state and the paint are still one file,
and nothing that reads them had to move or be renamed.
Pure motion: 164 methods, each exactly once, every line the line it was,
with pub(crate) added because a module boundary now stands between them
and their callers. Player::enable still delegates to the one oracle.🔧 chore(app): the window's file lets sixteen neighbourhoods keep their ownAhmet Kaan Gümüş · 963252a
🔧 chore(app): the window's file lets sixteen neighbourhoods keep their own main.rs was 10,529 lines with every constant, every helper and the window itself in one place. The geometry, the transport, the import state, the menus, the export card, the oracle, the library rows, the subtitles, the equalizer, the colour card, the viewport and the timeline's arithmetic each move out to the module they belong to; the Player and its two impls stay, which is what the file is for. Pure motion: every line is the line it was, with pub(crate) added only where a module boundary now stands between it and its caller. Player::enable still delegates to the one oracle.
🔧 chore(tests): the window's tests move out of the file they were testingAhmet Kaan Gümüş · e87ada1
🔧 chore(tests): the window's tests move out of the file they were testing Two thirds of `main.rs` was its own test module: sixteen thousand lines, of which six thousand were the tests. They are `src/tests/` now -- shared imports and fixtures in `mod.rs`, the tests themselves under the five headings they already fell into: editing, view, cards, media, layout. Pure motion, except for the scans. Several guards read the window's own source to hold a structural rule, and they read it with `include_str!` over a list of file names -- a list that goes quietly wrong the moment a region moves house, which is exactly what this commit does to six thousand lines and the next one will do to more. They walk `src/` at run time now: every `.rs` under it, found rather than named, so a rule cannot be passed by moving the code out from under it. A stray colour in a file nobody declared as a module is caught; under the old list it was not.
✨ feat(export): the GPU takes the HEVC export againAhmet Kaan Gümüş · e6624f3
✨ feat(export): the GPU takes the HEVC export again The seat goes back to being the default, with the reason it was safe to make one restored rather than assumed: both HEVC seats code intra-only, so preferring the GPU changes how long an export takes and not what comes out of it -- and there is now a test that says so about the *pixels* (`a_1080p_hardware_export_leaves_a_decoder_with_nothing_to_say`) rather than about the frame count. Measured on this box's radeonsi/VCN before the flip, every export decoded by ffmpeg with an empty error channel: a 60 s span of a 1080p source at SSIM 0.976/0.965/0.983/0.971 over four spread frames, a 3840x1600 HDR film at 0.947 against the H.264 hardware export of the same span, a 2560x1440 capture -- whose height is not a coding tree multiple -- at 0.873/0.880/0.881, and the sub-384 picture still falling to `oxideav-h265`.
✅ test(hevc): a decoder with nothing to say about the GPU's 1080pAhmet Kaan Gümüş · 85641e4
✅ test(hevc): a decoder with nothing to say about the GPU's 1080p The twin the seat shipped without. It asserts the three things a frame count cannot see: ffmpeg's error channel *empty*, the coded size still cropping to 1920x1080, and SSIM against the frames that went in (a desynced stream scores about 0.22, this one 0.98). `testsrc2` at 1080p is what makes it bite -- it splits transform trees deep enough and pushes the rate controller hard enough to need the syntax the parameter sets have to declare, where the two-frame fixtures beside it are flat and pass either way. Checked against each of the three defects in turn: depth 0 fails on the error channel, `cu_qp_delta` off and the min-CB size both fail on SSIM.
🐛 fix(hevc): the parameter sets say what the GPU actually codesAhmet Kaan Gümüş · a082e61
🐛 fix(hevc): the parameter sets say what the GPU actually codes The hardware seat's pictures were a band of noise over flat green while the frame count decoded clean, on every real 1080p and 4K source and on none of the synthetic ones. Three promises the synthesized parameter sets made that the driver never kept, each of which desyncs CABAC and turns the rest of the picture into coefficient garbage: `max_transform_hierarchy_depth_intra`/`_inter` were the builder's default 0, which says `split_transform_flag` is never coded and a decoder must infer no split. The encoder splits transform trees wherever the residual asks for it, so from the first coding tree unit on its split flags were read as residual. Measured alone: SSIM 0.17 against the source, 371 decoder complaints. `cu_qp_delta_enabled_flag` was off, so `cu_qp_delta_abs` had nowhere to be written -- but the driver's rate controller moves the quantizer between coding tree blocks and codes the delta regardless. Measured alone: SSIM 0.17. And the picture was declared at `MinCbSizeY`, so 1080 lines claimed a 56 line bottom coding tree row where the encoder had coded a full 64. The sets now declare the coding-tree-aligned size and crop back with the conformance window, which is what the working reference encoders on this driver do, and the surface is allocated to match. Flat gradients and a screen capture pass either way -- they split no transforms and give the rate controller nothing to do -- which is exactly how this reached a default-on seat.
🔧 chore(export): the GPU's HEVC seat waits behind a flagAhmet Kaan Gümüş · c67649f
🔧 chore(export): the GPU's HEVC seat waits behind a flag Its pictures are wrong on real material -- a garbled band over flat green, one `CABAC_MAX_BIN` notice per frame -- while the frame count decodes clean, so nothing that only counts frames ever saw it. The software intra encoder takes HEVC again until that is found and proven gone; `VE_HW_HEVC=1` asks for the GPU, exactly as `VE_HW_AV1=1` does for the other opt-in seat.
Merge remote-tracking branch 'origin/main' into worktree-agent-a01b6420b0fc19427Ahmet Kaan Gümüş · d113599Browse files
💄 fix(timeline): the line goes with the hand that left the rowAhmet Kaan Gümüş · 318f1fd
💄 fix(timeline): the line goes with the hand that left the row A header carried off a row left its drop line painted there, promising a slot the release out in the open never commits to. The row takes its own line back down now -- its own, because gpui runs a drag-move listener on every painted row and not only on the one under the pointer, so a row clearing the cue outright would rub out the line the hovered row had just drawn.
✅ test(export): the card's seat is the export's seat at every size and pinAhmet Kaan Gümüş · 81510b3
✅ test(export): the card's seat is the export's seat at every size and pin The plugin took the HEVC seat as of the GPU HEVC landing, and the sweep that pinned card against job still asserted the software intra encoder by name -- so the one test guarding "what the card says is what the job opens" failed on a machine where the card was telling the truth. The claim it was making is kept; the seat it hardcoded is not. Beside it, the same pin swept over the two things that move the seat under a user's hand: the project size (320x180, 720p, 1080p -- the plugin refuses HEVC under the driver's 384x384 floor, and both containers fall to the software intra encoder there) and the software pin, over every picture format. Thirty jobs, each started and cancelled at the encoder line it published, each compared against what `planned_video` promised the card. The hardware AV1 seat stays out of it: opening that one hung this box's GPU, which is `av1.rs`'s ignored test and not a sweep's business.
🔧 chore(bench): a seat for hardware HEVC, and a run that may keep its fileAhmet Kaan Gümüş · 57f6721
🔧 chore(bench): a seat for hardware HEVC, and a run that may keep its file `bench export <file> hevchw` measures the GPU seat; plain `hevc` still means the software one so a row keeps comparing with the baselines already recorded against it, and `scripts/bench.sh` sweeps both. `BENCH_KEEP=1` leaves the exported file where a run would have deleted it, which is how a seat is checked for decodability -- `ffprobe -count_frames` on what it actually wrote -- rather than for speed.
✨ feat(export): the GPU takes the HEVC export, and it is the same fileAhmet Kaan Gümüş · bacbe9f
✨ feat(export): the GPU takes the HEVC export, and it is the same file `HwEncoder::open_hevc` on the plugin's new symbol, and `hw_seat`'s HEVC arm goes from a flat `None` -- "the plugin has no HEVC encoder" was true and is not any more -- to a real probe. Unlike the AV1 seat it is **not** behind an opt-in, and what makes that safe is that both HEVC seats code intra-only: preferring the GPU changes how long an export takes and not what comes out of it, which is the whole reason AV1's `VE_HW_AV1` exists and does not apply here. `Enc::HevcHw` beside `Enc::Hevc`, and every unit it hands back is marked a sync point, because that is this encoder's configuration rather than a driver's choice. Falling back is silent and covers all of it: no entrypoint, a plugin too old to carry the symbol, a picture under the driver's 384x384 floor, `VE_SW_ENC=1`, or the export card's own "software only" -- `hw_seat` answers `None` before it probes for the last two, as it always has. The caps line stops saying HEVC is decode-only on this GPU. Measured on this box, both against the software seat's 4.30 fps at 1080p: 1440p at 74 fps, 1080p at 117 fps, output decoding frame for frame.
✨ feat(engine-hw): a third encode seat, and it writes HEVCAhmet Kaan Gümüş · 76787eb
✨ feat(engine-hw): a third encode seat, and it writes HEVC
`vh_enc_hevc_open` beside `vh_enc_open` and `vh_enc_av1_open`: the same
signature, the same session fed through the same `vh_enc_frame` /
`vh_enc_drain` / `vh_enc_close`, so the codec is decided once at the open
and nothing after it is a third path. `EncSession`'s `av1: bool` becomes
an `EncCodec` of three, which is what a two-codec boolean could no longer
say.
Two things the H.264 seat's numbers do not carry over:
* **Intra-only, every picture an IDR.** With a GOP, the P slices this
driver writes are undecodable: the slice segment headers are the
driver's to write and radeonsi writes a constant picture order count
into all of them, so a decoder sees frame after frame claiming to be
the same output picture (measured 2026-08-13 -- only each group's
leading IDR decoded). Intra is therefore not a preference here, and
it happens to be the file the software HEVC seat already writes.
* **384x384 floor.** The same driver that takes a 128x128 H.264
context answers VaError(19) to an HEVC one below that, so the open
says no and the caller falls back rather than reading a driver
refusal mid-export.
`CAP_TABLE`'s HEVC row gains the encode profile it now really opens
(Main, 8-bit -- the Main 10 entry beside it stays a decode claim), and
the caps test that pinned encode to H.264|AV1 pins it to the three.🔧 chore(vendor): cros-codecs learns to write HEVC, from its own branchAhmet Kaan Gümüş · 75da480
🔧 chore(vendor): cros-codecs learns to write HEVC, from its own branch
The vendored 0.0.6 decodes HEVC and encodes H.264 and AV1; the seven
commits behind cros-codecs' `hevc-vaapi-encoder` branch are what give it
the third encoder, and they are carried here verbatim rather than
rewritten:
* `codec/h264/nalu_writer` - emulation prevention after an escaped byte
(the same >=5-zero-run bug the vendored H.264 writer had)
* `codec/h265/nalu_writer` - the H.265 writer that fix belongs to
* `codec/h265/parser` - VPS, SPS and PPS builders, the SPS deriving its
own conformance window from the resolution it is given
* `codec/h265/synthesizer` - the parameter sets written back out as
NALUs, which is what a driver emitting no packed headers needs
* `encoder/h265` + `encoder.rs` - initial tunings on the config
* `encoder/stateless/h265` - the codec and its low-delay predictor
* `encoder/stateless/h265/vaapi` - the VA-API backend
Applied with `git apply -3`; every hunk landed clean against the local
patches already here, the only file with drift being `parser.rs`, whose
entry-point-offset and sub-layer fixes sit far from the new builders.
The c2_wrapper commit is left out (nothing here uses it) and so is the
Cargo uprev (this tree is path-patched).
Upstream's own tests for the new code pass in the source checkout: 22 in
`codec::h265`, 4 in `codec::h264::nalu_writer`. They cannot run in
`vendor/` because the published crate ships no `src/**/test_data`.✨ feat(timeline): a track is carried to its place in the stackAhmet Kaan Gümüş · 9ddffc8
✨ feat(timeline): a track is carried to its place in the stack A header is a handle now: drag V1 or A1 onto another header and the whole track takes its slot -- clips, gain and kind travelling with it, a ghost under the pointer and a line along the edge it comes in at, one undo step. Order lives in one place, the lane list, so the stack the preview composites, the stack an export composites and the order a save writes are the same list read three times. Display order is that stack: moving a video track past another changes which picture wins, in the preview and in an export alike, while audio is summed and does not care -- which is what makes an audio track above a video one a rearrangement of the screen alone. A label stays a position among the tracks of its kind, so a track that crosses one of its own kind swaps names with it, and everything holding a (lane, idx) is dropped exactly then.
🐛 fix(playback): a session counts its own workers, not the whole houseAhmet Kaan Gümüş · f490585
🐛 fix(playback): a session counts its own workers, not the whole house The seek tests judged a scrub by `/proc/self/status`, which counts every thread in the process: twenty other tests decoding files of their own moved the number under a session that had done nothing, and the budget assertions flaked at roughly one run in ten -- twice today. `PlaybackSession::live_workers` counts what the session in hand actually owns: its decode worker, the retired ones that have not returned yet, and the audio feeders still in the air (detached, so they are counted rather than joined). Same tight budget, same thing caught -- a storm of forty seeks reads twelve the instant it ends and two again fifty milliseconds later, so a worker that stopped exiting would still be seen.
Merge remote-tracking branch 'origin/main' into worktree-agent-a687c64e216de5a66Ahmet Kaan Gümüş · 07f2cffBrowse files
🐛 fix(timeline): a layer takes the sound down with itAhmet Kaan Gümüş · cd0df09
🐛 fix(timeline): a layer takes the sound down with it A file with audio let go over a further video track landed silent: the placement door put the picture on that lane alone, although its own words said 'its picture on V2, its sound on A2'. Both halves go down now, on the same frames and in one group, with the audio row added when the + V button left the project without one -- one snapshot, so one undo takes the pair and the row back together.
🐛 fix(timeline): the wheel wins over the follow while it playsAhmet Kaan Gümüş · 9bb0b82
🐛 fix(timeline): the wheel wins over the follow while it plays A notch of the wheel during playback was undone before it was seen. The follow centres a playhead that has run off the bed, and scrolling away from a playing head is exactly a playhead running off the bed -- so the very next frame yanked the view back. Which notch survived depended on where the head happened to be, so the wheel looked like it worked sometimes: with a second, longer media making the timeline scrollable at all, five notches moved the view by nothing at all (measured: the seam between the two clips stayed at the same pixel), while the same five notches paused moved it by half a bed. The arbitration has one decision point now. A hand that moves the view itself -- a wheel scroll, a zoom about the pointer -- takes it, and the follow keeps off until the head runs back into what the hand chose to look at, where the pan ends by itself with nothing to press and no timer. A seek and a play/pause hand it back outright: those are a person saying where to look. View::shows is the one question both halves ask, so the follow and the pan can never disagree about where the edge of the bed is. Paused scrolling, the zoom-vs-scroll mapping and the playback path are untouched.
chore: rename ponytail: comment marker to corner-cut:Ahmet Kaan Gümüş · 9ba8e0a
chore: rename ponytail: comment marker to corner-cut: Marker convention renamed after uninstalling the ponytail plugin; semantics unchanged (deliberate corner-cut, known ceiling + upgrade path). Token-only rename, 81 comment lines, no code change.
✨ feat(export): the custom bitrate reaches fifty, and the wheel takes it thereAhmet Kaan Gümüş · dadd2f4
✨ feat(export): the custom bitrate reaches fifty, and the wheel takes it there The ceiling was twenty, which was never an encoder's limit: it was the top of the range the exporter *derives* an automatic bitrate in, borrowed as the cap on a number a person typed. An asked-for rate has its own ceiling now (MAX_EXPLICIT_BITRATE), and the card offers all of it. And a range fifty wide is not a range a stepper walks: the wheel over the custom row moves it, one step a notch, up for more -- the gesture the timeline already zooms and scrolls with. It moves the field while one is open, exactly as the arrows do, so the two ways in never disagree about which number is being changed. Hold-to-run stays the keyboard's, as it is on every other card here.
🐛 fix(export): the decode thread says how it ended, and is waited forAhmet Kaan Gümüş · ba88e8f
🐛 fix(export): the decode thread says how it ended, and is waited for Two hazards the thread brought in, neither of which the serial decoder had. A panicked decode thread dropped its sender saying nothing, and a shut channel read as end of stream: the span ended "because the source ran out", the export wrote what it had and reported success. A truncated file that says it finished is the one outcome an export must never have, and before the decode moved onto a thread the same panic took the whole export down. So the thread now states every ending down the channel -- a picture, an error, or the `Ok(None)` that is end of stream -- and a channel that shuts without one of them is the failure it is. A source genuinely shorter than the clip that names it still ends its span gracefully, and asking again after that stays end of stream rather than turning into a disconnect. And the thread was never joined. `decode::Worker` states why it must be: one abandoned inside `vaInitialize` outlives the process, and Mesa's `atexit` handlers free the state it is still reading -- a SIGSEGV at exit, long after the export succeeded. The handle is kept and joined on drop, after the receiver beside it, which is the field order `decode::FrameStream` is written in: the disconnect is the only thing that wakes a decoder parked in a full send, so joining first would wait for a consumer that is never coming. Throughput is where it was (93.3 fps on a 1080p minute, hardware encode) and the round-trips hold on both seats.
⚡ perf(export): the decoder stops waiting for the encoderAhmet Kaan Gümüş · b728a45
⚡ perf(export): the decoder stops waiting for the encoder An export decoded a picture, encoded it, decoded the next: two engines taking turns, each idle while the other worked. The decode now runs on a thread of its own and hands pictures over a channel two deep, so the encode of picture n overlaps the decode of picture n + 1 -- and the bound is what keeps it honest, since a decoder that ran ahead without one would hold a film's worth of 3 MB pictures. The thread is also where the plugin is opened: a VA-API session is not ours to pass between threads, so the open happens there and its failure comes back down the channel, which is why a vanished source and a codec with no decoder still fail the export rather than looking like a clip that ran out. A 1080p h264 minute exports at 93.3 fps against 73.4 (hardware encode) and 18.3 against 17.5 (software, where the encoder is the wall). The written file is the same one: 1438 frames for the 60 s span, 59.977 s at 24000/1001, zero errors decoding it back, and the round-trip tests hold on both seats.
⚡ perf(waveform): a film's envelope is read by several handsAhmet Kaan Gümüş · 50e3988
⚡ perf(waveform): a film's envelope is read by several hands Importing a source decodes its whole audio track for the lane's waveform, and on a film that is the longest thing an import waits for: 22.7 s of one core for a 2 h 39 m 5.1 E-AC-3 mkv, 3.8 s for a 2 h stereo AAC mp4. It is linear in length and nothing about it was parallel, though `open_multi_streams` has always taken a window per call and seeked to it. So a source long enough to pay for the extra opens is cut into windows -- one per minute, capped at the machine's cores and at eight -- decoded side by side and stitched. The first window is the session that was opened to learn the length, so a split costs `jobs - 1` opens and not `jobs`. Joining is safe because the fold is min/max into absolutely-numbered buckets: the chunk that straddles a joint is folded into both windows and cannot be double-counted. The 2 h 39 m mkv's 22.7 s becomes 4.6 s and the 2 h mp4's 3.8 s becomes 1.2 s, bucket count identical either way. A clip under two minutes is read exactly as it was, on the calling thread. `bench waveform <file>` is the metric.
🐛 fix(decode): a seek into an open GOP is hardware's to finishAhmet Kaan Gümüş · 7652ada
🐛 fix(decode): a seek into an open GOP is hardware's to finish A Blu-ray remux codes its GOPs open: the I picture that opens one is stored ahead of the leading pictures that are *shown* before it, and those reference the GOP before. Restart decoding at that random access point -- which is what every seek, scrub and clip boundary does -- and the leading pictures have references nobody decoded, so the plugin failed its first frame, playback fell back to `rusty_h264`, and that decoder died on the file's I_PCM macroblocks. Seventeen of twenty scrub steps on a 5.27 GB AVC remux ended with no picture at all, and the three that survived cost 482 ms each in software. The pictures are not ours to show, so they are dropped and the decode walks on (bounded by `LEADING_LIMIT`, and only for a session that was positioned somewhere other than the file's own start). The refusal that the tolerance would otherwise swallow is kept at both ends: a stream read from frame 0 is still refused the moment its first picture will not decode, and the plugin probe now counts an immediate end of stream as a refusal rather than a pass -- a session that hands back no picture is the black-frame-and-instant-eof the probe exists to catch. The vendored H.264 decoder's own refusal goes with it: it failed a `frame_num` gap outright unless the stream declared gaps allowed, which is exactly the wrong reading here -- the gap is the editor's, made by starting in the middle of a film, and §8.2.5.2's non-existing frames are what stands in for it. The loop that builds them was already there, behind that flag. Twenty of twenty scrub steps on the remux now decode in hardware, 77 ms median against 482 ms; `seek_matches_linear_every_container` holds for every container, and `dump_frame <file> <n> <out> seek` is what a picture reached by a seek can be compared with the same picture reached by decoding from the start.
🐛 fix(playback): a paused picture holds still, and a late one catches upAhmet Kaan Gümüş · 084f02d
🐛 fix(playback): a paused picture holds still, and a late one catches up Two halves of the same seam: the picture was paced by "the newest frame not later than the clock", and nothing said what to do when the decoder was behind that clock. Paused, the clock is frozen but the decoder is still handing over the backlog it was behind by, and `pump` ran on every repaint -- so a pointer moved over the timeline walked the picture on, one frame per redraw, after the sound had already stopped. Frames are now taken only while the clock runs, or when a seek owes the screen its landing (a scrub is paused by definition); a repaint re-presents what is already there. Gated at the one place a frame reaches the screen, not in the handlers that repaint: a hover, a notice, a resize and a vsync are the same event to it. Playing, a decoder that cannot keep up never got back on its own -- it hands over every frame in order, whether or not its moment has passed, so the gap only grew and the picture drifted seconds behind what was heard. Past 0.4 s late the backlog is abandoned and the picture restarted at the clock (`PlaybackSession::resync_picture`), which touches neither the sound nor the clock, no more than once every 2 s. Measured, 2560x1440 H.264 with software decode forced: paused and wiggling the pointer over the timeline for 3.6 s, the picture was four different frames before and one pixel-identical frame after. Playing the same file, the offset stayed inside 3.3 s with a restart every 2 s instead of growing without bound; with the hardware decoder, which keeps up, no restart fires at all.
✨ feat(silence): the scan reads the clip that was asked about, not the film it came fromAhmet Kaan Gümüş · dec2ced
✨ feat(silence): the scan reads the clip that was asked about, not the film it came from A take cut in half was still decoding the whole source and then throwing most of the answer away: the levels were read from media time 0 to the end of the file, and only `timeline_regions` remembered the clip had a range at all. Now the range *is* the read. `silence::levels` takes the half-open source seconds to scan and hands back windows counted from its own start; `timeline_regions` lands those at `in_frame` plus that and trims to `out_frame`. The card names a scan by source, stream **and** the clip's frames (`ScanKey`), so a trimmed clip is a read of its own and a re-trim is not answered from the cache. Half a take is half a wait, and what it finds is what is still on the timeline.
✨ feat(timeline): the subtitle strip answers the wheel like the lanesAhmet Kaan Gümüş · 0e324ec
✨ feat(timeline): the subtitle strip answers the wheel like the lanes The strip under the tracks is drawn on the same bed, through the same Scale, and a cue is exactly what a hand aims at when it wants to see a line closer -- so it took the same wheel the ruler and the beds already take: ctrl magnifies about the pointer, a bare notch slides the view along. It ignored both until now, a dead surface in the middle of a live panel. Nothing occludes inside it -- the cue boxes and the playhead are plain paint -- so the bed's own listener is the whole of it.
✨ feat(ui): six more families, three of them ones people already live inAhmet Kaan Gümüş · 8a5f18b
✨ feat(ui): six more families, three of them ones people already live in Ocean, Ice and Orchid are this set's own -- a blue-black ground under azure, a near-black blue with the widest ink range here under a pale ice accent, and a dark plum under orchid, which is the warm end of the purples where `violet` is the cold one. Nord, Gruvbox dark and Dracula are the open palettes (all MIT, credited on their modules) mapped onto the thirty-six roles rather than approximated: surfaces and ink are their own numbers wherever they clear the floors this editor already holds every family to. What is adapted is named in place -- those three are *text* palettes and this one draws a name and a waveform on every clip body, so Aurora's green under white is 2.6:1 and the four kinds are those hues taken down until WCAG 1.4.3 holds. Nord's own picked row carries the dim ink at 2.9:1, Dracula's comment blue at 2.4:1, and gruvbox's selection is a grey that says nothing about which row is picked. Two more forced by the guards rather than by taste: a playhead crosses every clip body it passes, so Nord's obvious orange (2.3:1 on a video clip) gives way to nord13 yellow, and gruvbox's playhead is the bright green -- the one hue of that set clearing 3:1 on all four bodies at once. The picker holds twelve rows whole at the 640x360 floor (300 px of a 360 px window) and has room for fourteen, so its scroll stays a safety net. The test says which: the day a family makes it fail, the card owes the affordance line the inspector and the cards carry, because a row nobody knows is under the fold is a row that is not there.
✨ feat(timeline): the wheel zooms and scrolls where the clips areAhmet Kaan Gümüş · a02176e
✨ feat(timeline): the wheel zooms and scrolls where the clips are Ctrl+wheel anywhere over the timeline -- a lane's bed, a clip's trim strip, the ruler -- magnifies about the pointer, and a bare wheel slides the view along it: the mapping every editor shares, on the surface a hand is already aiming at. Only the 24 px ruler strip answered the wheel before, and only with ctrl. Three things had to be true for it to work at all: - A bare notch is a tenth of what is on the bed (SCROLL_NOTCH_SHARE), so one gesture moves the same share of a five second import and of a film; View::scrolled clamps it against the content's own length. - The follow no longer fires on a playhead nobody moved: a view yanked back every frame is a hand's own scroll undone before it is seen. - gpui stops its hit test at an occluder, so the trim strips at a clip's ends took the wheel off the bed with them -- a dead strip exactly where a hand aims to see a cut closer. They answer with the same call now, and the lane column keeps the track names as its own scroll surface. The keys and the buttons zoom exactly as they did.
✨ feat(subtitles): a file's subtitles come onto the timeline that is openAhmet Kaan Gümüş · e17cd0a
✨ feat(subtitles): a file's subtitles come onto the timeline that is open Importing only the subtitles from a file should not mean reimporting the whole media or breaking the timeline. The engine could already do exactly that -- the walk reads a container's subtitle tracks and pushes them onto the timeline's own list, and subtitles are on no lane -- but the only doors to it were a toolbar glyph and a stroke, while the panel where the tracks are listed offered a media import. So the capability was there and the door was not, which is the same thing as not having it. The Text tab's own button is now that door: "Add subtitles from a file…", the action itself (so the button, the stroke and the actions card cannot drift), oracle-gated like every other action button, and accented while the tab has nothing on it -- the primary action of the tab it is in. The tab's empty line names the button rather than pointing at a toolbar. At the 640x360 floor the column is 128 px and a centred label wider than its button is clipped at both ends, so the button says the short form there and the full name stays in the tooltip, the card and the stroke. Whatever the file is: a release's `.mkv`, an `.mp4`, an `.srt` beside it. The media itself joins nothing -- no library row, no lane, no clip, nothing on the edit list moves -- and the same file twice is the same tracks, not two of each. A file the walk found no subtitle track in is now refused as that, in words, naming the file. It used to answer "0 tracks added", which is the sentence a file whose tracks are already on the timeline gets -- two opposite answers wearing one string. The line is drawn once (`PlaybackSession::no_subtitles_in`) and used by both the engine's own door and the front-end's split walk-then-push, and the claim is only ever made after the walk actually looked. A plain media *open* is untouched: nothing is said there about a file with no subtitles, because nobody asked.
✨ feat(ui): four more palettes, on the same measured floorsAhmet Kaan Gümüş · 3c6b5d9
✨ feat(ui): four more palettes, on the same measured floors The set grows to six: forest (green ground, emerald), violet (indigo ground, lavender), rose (neutral ground, one rose accent and no other hue), amber (graphite ground, gold). Cool and warm are untouched. All six are dark on purpose. Colour work is judged against its surround, and a light ground pushes every clip body and every graded frame the wrong way, which is why no editor of this kind ships one. None of them is picked by eye alone. The contrast guards already ran over `PaletteId::ALL`, and the two tint guards do now as well -- four swatches tuned on one ground are exactly where a pair lands inside the margin on another. Every family clears the same floors the first two did: dim ink at 4.5:1 on its own raised surface and on a picked row, both inks on every clip body, the playhead 3:1 against the bed and against a video clip. Where a family could not clear one, the colour moved rather than the threshold -- forest's audio clip went darker, amber's picked row went to a bronze, and amber's focus ring went sky because gold is that family's accent and the keyboard's ring may never be mistaken for it.
⏪ revert(subtitles): the removal bin goes, the way back is the file's own doorAhmet Kaan Gümüş · bbe4e40
⏪ revert(subtitles): the removal bin goes, the way back is the file's own door The recovery bin was the wrong answer to the right complaint. What a person wants after removing a row is not that row back out of a session cupboard -- it is a way to put *any* file's subtitles on a timeline without importing the file, which is the door the next commit is about and which brings the removed one back as a side effect. So `Project` keeps no bin: a removal removes, as it did before, and the row's × and the notice now name the add-subtitles stroke as the way back rather than "import the file again". That old sentence does not come back: the file itself never has to be imported for its subtitles. The engine and app halves both go (b13bd53 here, and the app half that rode into 4420513 while two lanes shared one worktree).
✨ feat(subtitles): a removed track is one click from being backAhmet Kaan Gümüş · f41b4c6
✨ feat(subtitles): a removed track is one click from being back Removing a subtitle row dropped the whole track -- cues and all -- and the only way back was importing the file again, which on a big remux is a walk of the whole container for something the session had in hand a second ago. "Bringing back the removed subtitle needs reimport is very nonsense", and it is: a removal is the one edit here whose inverse cost more than the edit. The removal is now non-destructive at the model. `Project` keeps what it took off in a bin beside the list (`removed_subtitles`), and `restore_subtitles` puts one back with the cues it left with -- no file is read, so a row comes back even when its file has gone missing since. The bin is the session's, not the project's: a `.edith` still writes what the timeline has, exactly as it did. The door is the row the removal leaves behind, under the list and dimmed, with a `+` where the × was: the way off the timeline and the way back on are one shape in one place. The list is drawn while either half of it has rows, so removing the last track is exactly when the way back is on screen rather than the moment the section disappears. The audio side of the same class was already reversible: a lane removal is a history snapshot and z restores it. A library row is not, by the decision recorded in `Project::remove_source`, and is left alone. The app half of this slice (`Player::restore_subtitle_track`, the notice and its test) is in 4420513: the theme work committed the whole tree while both were in flight.