forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 7f487c10e98d32efa4e4b554b778d2eea5d16efdFiltered to crates/engine/tests/playback.rsClear filter

2026-08-15

🐛 fix(playback): a silence cut's boundary decodes forward, not flushAhmet Kaan Gümüş · e045b5e
🐛 fix(playback): a silence cut's boundary decodes forward, not flush

Cutting silences leaves a timeline of same-file micro-clips, and every
boundary reseeked the worker the expensive way: decoder FLUSH, demuxer
seek to the RAP, skip-decode RAP->clip-start (up to a GOP of VCN work,
the GPU spikes), then a re-prime whose ~178ms ttff at 4K outlasts the
0.15-0.65s clips -- so the picture starved while the continuous audio
feeder played on (the freeze), and LATE_RESYNC answered the starved
picture with another flush storm every RESYNC_GAP.

- engine-hw: seek_to reaches a target ahead of the decoder, within
  FORWARD_SECS (0.5s) of it, by decoding forward and dropping through
  the existing skip path -- no flush, no RAP seek, no re-prime; behind,
  past the reach, and past EOF keep the flush. Decision extracted as
  the pure reposition() + tests; position tracked per popped handle.
- playback: the session reports picture_priming() -- owed from span
  start until its first frame -- and the player's resync waits out a
  prime instead of restarting into it (resync_due, constants kept).
- bench cutloop: the freeze metric -- an N-region cut timeline played
  end to end, displayed/dropped per second, restarts and resyncs.

2026-08-13

✅ 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.
✅ 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.
🔀 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(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.
🐛 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.
🐛 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.

2026-08-12

✨ feat(audio): convert wide layouts and off-rate sources at import instead of refusingAhmet Kaan Gümüş · c94ba8b
✨ feat(audio): convert wide layouts and off-rate sources at import instead of refusing

An 8-channel Opus track came back "IMPORT FAILED: unsupported channel
layout: 8 channels (max stereo)" and took the picture with it, and a
48 kHz file "audio 48000 Hz 2 ch does not match the timeline's 44100 Hz
2 ch". Both strings are gone: an import converts.

Width: `fold_5_1` becomes `downmix`, a coefficient table per layout from
2.1 to 7.1 (ITU-R BS.775 — front channels keep their side, centre and
surrounds join at -3 dB, LFE dropped, both sides normalised by their own
coefficient sum so a full-scale source cannot clip). 5.1 comes out of the
table bit-identical to what it was. `vorbis_to_film_order` gains the RFC
7845 permutations for 3, 5, 7 and 8 channels beside the 6 it had, so
surround Opus at any width reaches the fold in the order the fold reads.
The AC-3 decoder's own 2.1 passthrough, which it leaves at 3, folds here
too, and a multichannel AAC track in an *mp4* now takes the `rusty_aac`
route the Matroska side already had (`aac_decoder`, one call for both).

Rate: the segment resampler a speeded clip already goes through takes the
source rate over the timeline's into its step, so the two compose into one
interpolation and 48 kHz onto a 44.1 kHz timeline keeps its pitch. All of
it is convert-on-read — per packet in the decoder, per buffer in `emit`,
after the window trim — so there is no upfront pass to show progress for
and nothing to cancel.

What is still refused is the layout alone: a mono track cannot join a
stereo timeline, in the words "audio 1 ch does not match the timeline's
2 ch". The picker's grey-out rule follows the gate rather than leading it.

Measured on a 12.9 GB 2160p AV1 remux with a real-library 7.1 Opus
track: imports, opens as a timeline, and a ten-second WAV export comes
back at RMS 0.0091 left / 0.0085 right.
⚡ perf(playback): a seek opens the sound on the feeder, not on the hand that seekedAhmet Kaan Gümüş · 46e8379
⚡ perf(playback): a seek opens the sound on the feeder, not on the hand that seeked

The picture's open moved onto its worker last week; the sound's stayed on the
caller. `AudioSession::open_mixed_streams_live` opens every track a segment
names -- one `pread` per track, seconds off a cold cache on a 25 GB film -- and
`PlaybackSession::seek` ran it on whoever called it, which in the editor is the
thread that paints. Measured at the seat, cold: one ruler click froze the window
13.5 s, a 300-step scrub burst froze it 22 s. The line written for exactly that
wait (`seek_line`, "the window is not frozen") was unreachable, because the
thread that would have painted it was inside the open.

`Audio::spawn_feeder_deferred` gives the feeder the open as well as the drain,
mirroring `DecodeSession::open_worker_deferred`: the caller pays a thread spawn
(2.09 ms cold on the film, was 9.27 s) and the sound arrives when it arrives.
The epoch is captured at the seek rather than when the open returns, so a scrub
that abandons twenty opens leaves twenty *stale* feeders, every one of them
refused at the same lock the flush is taken under.

The clock is untouched by the wait, which is what makes the wait safe: it holds
where the seek put it until the first real sample is queued (`content_at`), so
8.7 s of cold open put the timeline 22 ms past its target rather than 8.7 s past
it. `fed` is now re-based at that same first sample instead of at the seek --
the open's seconds are device time nobody fed, and counting them handed the
timeline to wall time that far before the sound really ran out.

There is no synchronous answer to "will anything play" any more, so `start_audio`
returns whether a feeder took the job and the callers hand the clock to audio on
it; a timeline with nothing to play ends its feeder at once, and `fed_all` hands
the clock straight back, continuously. Whether there is a *mixer* to talk to is
decided from the lists the open is about to be handed (`AudioSession::is_mixed`,
the one definition, shared with the opener) rather than read off the handle
afterwards -- a fader on the single-lane flat path still rebuilds the stream.

Cold, playing, the device now runs through the open with an empty ring: audibly
the same silence, counted as 1721 underruns where it was 5. Named at `resume`
with its upgrade path. A warm session is unchanged (46 -> 53 across the suite).

2026-08-11

⚡ perf(playback): a seek costs the UI thread a thread spawn, not a demuxAhmet Kaan Gümüş · 74a068e
⚡ perf(playback): a seek costs the UI thread a thread spawn, not a demux

Playback opened every span's file on the caller's thread: 300 ms warm on a
25 GB film (measured), seconds off a cold cache, and a scrub paid it per
seek. `DecodeSession::open_worker_deferred` moves the demux onto the worker
-- there is no metadata to hand back on that path anyway, `start_span`
discarded it -- so the caller pays a `thread::spawn` and the picture arrives
when it arrives, which is what `try_frame`'s `None` has always meant.

The four callers that need the refusal at the door (the public `open`, a
session open, a project load, an import) keep the sync opener, so a file
this machine cannot decode is still named to the user where it is chosen.
A file that fails to open *at a span* drops its sender, and the
disconnected receiver walks the session on to the next span exactly as the
dead receiver installed here did.

Both openers now share one worker body (`decode_span`), so hardware
fallback, the codec refusal, the tone map's declared peak and the range
clamp cannot drift apart between them.

Measured on the film: seek returns in 52-68 us (was ~300 ms), first frame
380-620 ms later. The remaining wait is the container walk on the worker;
a per-source parsed-index cache is the follow-up, not this diff.
🧹 test(scratch): a fixture directory is deleted by the test that made itAhmet Kaan Gümüş · 5c39124
🧹 test(scratch): a fixture directory is deleted by the test that made it

Every suite here made its own directory under /tmp with a name and a
process id and then walked away from it: 2907 `ve_*` directories, 6.4G of
a 16G tmpfs, none of them reclaimable by anything but a person with `rm`.

`engine::scratch::Scratch` is the one place a throwaway path comes from
now -- a directory, or the single file inside one -- and `Drop` is what
takes it back. That is the whole reason it is a guard rather than a
cleanup call at the end of a test: unwinding runs `Drop`, so the *failing*
tests, which are exactly the ones that used to leave the most behind,
clean up like the passing ones.

It derefs to a `Path`, so the call sites did not have to change: the
helpers that handed back a `PathBuf` hand back one of these. The prefixes
stay what they were, so a directory is still recognisable while a test is
stopped in it.

Nothing about what a test *does* moved -- only where its fixtures live and
when they die. Driven: the whole engine suite and the app's own tests run
with the count of `/tmp/ve_*` before equal to the count after.
🧪 test(playback): the clock counts the sound that played while the picture reopenedAhmet Kaan Gümüş · db1affe
🧪 test(playback): the clock counts the sound that played while the picture reopened

seek_keeps_the_audio_clock measured the clock across a window that
included next_index -- the wait for the first picture after the seek --
and assumed that wait cost the timeline nothing. It did, before: the
clock re-anchored onto an empty ring, so the audio that played during
the video decoder's reopen was thrown away and the picture stayed that
far behind the sound. Now it is counted, so the assertion is made
against the wall clock the window really took (measured: 3.917 s after
0.969 s of real time).

The mix card's doc says what a fader now costs, which is nothing.
🔀 merge(A5): main (de15818) into the import-policy branchAhmet Kaan Gümüş · d17f345
🔀 merge(A5): main (de15818) into the import-policy branch

The rate gate main landed (`Rate`) and this branch's codec gate removal
are the same function: `matches_timeline` keeps main's `Rate` return and
loses the codec equality, with the decoder probe in its place. The
refusal tests that named a rate or a silence now name the one thing
left -- one output device, one rate and one layout.
✨ feat(import): mixed codecs and silent takes join the timelineAhmet Kaan Gümüş · 9bc3bd4
✨ feat(import): mixed codecs and silent takes join the timeline

The two refusals a user hits for no reason are gone: a file coded
differently opens its own decoder like every clip already does, and a
file with no audio track contributes silence over its span like a gap
already does.

What the codec gate was really protecting against stays, moved to the
one place that can answer it: import asks the file for a decoder, so a
machine without the VA-API plugin refuses an HEVC take by the decoder's
own name rather than playing black frames with the complaint on stderr.
Rate and layout stay refused -- there is no resampler.

Both audio paths now read a source with no track as the silence they
already synthesise for a hole: the worker plays it, the packet copy
writes it, so an mp4 export of a timeline with a silent take is as long
as the timeline and quiet where the take is.

2026-08-10

✨ feat(timeline): a clip shot at another rate plays at the speed it was shot atAhmet Kaan Gümüş · 26af1e4
✨ feat(timeline): a clip shot at another rate plays at the speed it was shot at

A frame rate of its own is no longer a refusal at import. Every frame
number in the edit list counts the *timeline's* frames -- a clip's
in/out included -- and a file shot at another rate is converted once, at
the decoder's door: `Rate` (milli-fps rational, `Speed`'s floor/ceil
pair) says which frame of the file a timeline-rate frame is. Playback
opens its worker through it and stamps the pictures coming back through
its inverse; the export walks its span through it after the speed, so a
2x 24 fps clip on a 30 fps timeline is exactly both.

Nothing in `project.rs` changed: placement, trim, split, paste and speed
are the same arithmetic on one clock, and a single-rate project takes
the identity map everywhere it used to take nothing.

A library row now names the *file's* rate rather than the timeline's,
which was true only while every source shared it.
✨ feat(import): imported files land in the library, never on the timelineAhmet Kaan Gümüş · 5cb33d8
✨ feat(import): imported files land in the library, never on the timeline

An import is not a decision about where a file plays. It registers a source,
notes its native length and stops there; the timeline changes when the user
drags the row onto a lane.

- `PlaybackSession::import`/`import_audio` probe, check and register only,
  returning the source index. No clip, no reseek, and no undo step -- a
  library row changes nothing playable, so there is nothing for `z` to take
  back, and the notice no longer pretends otherwise.
- `PlaybackSession::file_frames` is the native length of a file this session
  has taken in, so a row that has never been placed is placeable at its full
  length. `place_stream_at` takes it from there instead of a `frames`
  argument, and the app drops the clips-derived guesser that returned 0 for a
  source with no clips.
- `PlaybackSession::open_library` is the first import into an empty window:
  the file's canvas, rate and clock over an empty timeline.
- Doors: the Import button, a file dropped on the window and every argv
  argument after the first fill the library. A file *named first* at launch is
  an open, not an import, and still becomes the timeline.
- Fixture + tests: a 25 fps H.264 file, refused by name at both video doors.
🔒 fix(export): an empty timeline is refused by the engine, in every formatAhmet Kaan Gümüş · dc82aff
🔒 fix(export): an empty timeline is refused by the engine, in every format

Grafted from the rival empty-timeline candidate: the app's `is_empty`
refusal was the only fence, so an export started by anything that is not
that button still wrote a file of no frames. The refusal now lives in
`export::start`, in the rival's exact words.

Placed ahead of the format match rather than inside `run`, so a WAV and a
FLAC refuse in the same words an mp4 does -- `run_audio` would otherwise
have written a zero-sample file or refused as "no audio to export", which
names the wrong thing. The app keeps its own check: two fences, and only
the app's has a keystroke to blame.

The end-to-end test asserts the exact message for all three formats and
that no file is left behind.
✨ feat(timeline): the last clip deletes and the timeline emptiesAhmet Kaan Gümüş · 9a6ef81
✨ feat(timeline): the last clip deletes and the timeline empties

The never-empty-TIMELINE invariant is gone: an emptied timeline is now a
state of the model, not an edge case a refusal kept unreachable. Emptiness
is honest all the way down -- `PlaybackSession::span` is an `Option<Span>`
whose `None` *is* the empty timeline, and `start_span` feeds it one black
frame, so the viewer shows the nothing that is there rather than the last
picture of the clip that was deleted.

* `Project::lift` and `Project::ripple_delete` refuse only what is not an
  edit (a bad index, an empty range, a delete with nothing left to take --
  the last so a no-op still costs no undo step);
* `Project::from_parts` and the `.edith` loader take an all-empty project
  and refuse a *laneless* one instead, which is the invariant that was
  really being defended;
* `without_orphan_sources` keeps source 0 when no clip names anything: it
  carries the frame rate the timeline counts in, and pruning it wrote a
  project that could not be loaded back;
* the app's two "the timeline cannot be emptied" notices are gone, and an
  export of an empty timeline is refused by name instead of writing a file
  of no frames.

The never-empty-CLIP invariant (len >= 1) is untouched.
✨ feat(engine): project resolution stands apart from media resolutionAhmet Kaan Gümüş · 19e294a
✨ feat(engine): project resolution stands apart from media resolution

A timeline had one resolution because its first source did: import refused
anything else by name, and there was nowhere to say otherwise. A project now
carries its own picture size and every clip is composed onto it, so media of
different resolutions share a timeline the way they do in any editor.

* scale::Composer is the one definition of that composition -- fit_rect,
  scale_i420, compose_i420 onto a black canvas -- and both playback and export
  call it, so what is written is what was watched. A canvas of the picture's
  own size is a pass-through that allocates nothing and touches no byte.
* Grade first, place second: a grade belongs to the clip's pixels at the
  resolution they were shot at, and the letterbox bars are not the clip.
* Per-clip fit policy (fit/fill/stretch/centre), one byte inline in Clip -- it
  lands in padding the clip already had.
* .edith v7: a `resolution <w> <h>` line and a fit word per clip line. v6..v1
  still load, defaulting to source 0's picture and Fit, which is what those
  projects always meant.
* The fps refusal stays: mixing frame rates is resampling the timeline, a
  different problem, and a refusal is the honest answer until it is solved.
* UI: `p` cycles the fit policy of the clip on screen (and a clip-menu item),
  ctrl+r cycles the project resolution through the usual sizes with the media's
  own among them, and the export card says which size it writes.
✨ feat(timeline): every lane draws and tracks can be addedAhmet Kaan Gümüş · 30e8aae
✨ feat(timeline): every lane draws and tracks can be added

The panel drew V1 and A1 and nothing else, so the N-lane model, the
composite playback and the v6 format had no way into the window. It now
draws a row per project lane, labelled from Lane::label, and grows the
panel per row up to a cap past which the lane column scrolls.

+ V / + A -- and the v / a chords, in the registry so the keys menu lists
them -- add a track; undo takes one back like any other edit.

The V1/A1 pinning the last two slices flagged is gone: delete_clip takes
the lane its index belongs to (Project::delete_in), a drop names the lane
it was let go over (place_stream_at's onto), and whole_take decides
ripple-or-lift per lane -- a clip on an added track is a layer and is
lifted, while the first pair keeps exactly the semantics it had.
Project::paste now inserts into V1/A1 only while still opening room
everywhere, or an Add with three lanes would have played one sound twice.

The export card greys MP4 out with its reason when more than one audio
lane carries sound, on the row and on the m chord both, so the engine's
refusal arrives before a destination is picked.
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..AnAhmet Kaan Gümüş · b474a9b
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..An

Merge of the multi-lane winner (candidate B) onto the S5a main, plus the
three grafts the judge picked out of candidate A and the delete-selected
fix it flagged:

* LaneData::two_lanes(), one place for the pair single() and from_parts()
  both build;
* a_group_may_span_any_lane: hand-built lanes driving links_are_consistent
  directly -- one take on V1 + A2 with the lanes between it empty is legal,
  and both ways to break the rule are asserted by their exact message;
* add_lane doc: an empty new lane is legal even though from_parts refuses
  an all-empty project -- the lanes that were there still hold the timeline;
* delete_selected is exhaustive over lane.kind and explicit about ord: it
  hands V1/A1 indexes to engine calls that mean V1/A1, so a second-lane
  selection would have deleted a different clip under a _ => false wildcard.

Conflicts, all against the S5a Source model: without_orphan_sources keeps
B's crate::Result and its >1-lane-per-kind refusal but returns Vec<Source>,
and Lane::Audio in place_stream_at/import_audio became Lane::A1.
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..AnAhmet Kaan Gümüş · 154fd69
♻️ refactor(engine): the project holds N lanes, V1..Vn and A1..An

The edit list was a fixed pair -- `Lane` {Video, Audio}, `lanes: [Vec<Clip>; 2]`
and seven hundred lines of methods walking that pair by hand. Multi-lane UI,
per-lane compositing and per-clip EQ all want lanes to be a list, so make them
one now, while the model is small enough to change in one sitting.

`Lane` becomes a handle -- a `LaneKind` plus a 0-based `ord`, so `Lane::V1` is
the first video lane and `Lane::new(Audio, 1)` is A2 -- and the project stores
`Vec<LaneData>`, a struct that per-lane state (mute, compositing mode, a name)
can grow into. A handle naming a lane that is not there reads as an empty lane
and refuses every mutation, so a front-end that only ever asks for V1/A1 needs
no bounds check of its own. Every method is a walk over the lane list now
instead of two hand-written cases.

The grouping rule generalises rather than pairing lanes off: a link id names at
most one clip per lane and every clip carrying it covers the same span, on
however many lanes. So a split hands out one id per group of lanes whose halves
line up -- one helper, used by split and regroup alike.

Playback, export and the audio worker still read V1 and A1: compositing is its
own slice. So is the file format, which holds one lane keyword per kind, so a
save of more than two lanes is refused by name instead of silently dropping
one; a two-lane project writes exactly the bytes it always did.
✨ feat(library): every audio stream is a row, and the picked one plays and exportsAhmet Kaan Gümüş · ecb5e06
✨ feat(library): every audio stream is a row, and the picked one plays and exports

A file with one audio track per language is one row per track now, not one row
per file. The engine carries the pick end to end: a source is a (file, audio
stream) pair, .edith v3 writes the stream on the source line, playback opens it
and — the trap this closes — the export copies *that* stream's packets rather
than always stream 0.

Streams that cannot go on the timeline are listed greyed with the reason
instead of hidden: a codec we cannot read, or a rate/layout that cannot share
one output device and one copied AAC track with the rest of the timeline (there
is no resampler here and no AAC encoder to write a join with). place_stream_at
is the one door a row goes through, and it refuses those in the engine's own
words.

- v2 and v1 files still load: no stream field means stream 0, which is all
  those dialects could play; saving either writes v3.
- Waveform peaks are keyed by file *and* stream, so two tracks of one file
  cannot draw each other's envelope.
- Library swatches and clip tints follow the *file*, so a file's streams share
  one colour in the panel and on the lanes.
- assets/test_multilang.mp4: two AAC 44.1k stereo streams (und, fra), the shape
  real multi-language media has and the one where a second stream is placeable.
🔇 test(engine): the lane and gap tests go through the muted open() tooAhmet Kaan Gümüş · 0f5e259
🔇 test(engine): the lane and gap tests go through the muted open() too

Resolves the merge of e1d090d by hand where git resolved it textually:
the two sessions this branch added opened the device at full gain, and
the audio one plays 2.4 s of a real file. Both go through the silent
helper now. Neither loses anything by it -- what they asserts is the
clock, the frame numbering and the picture, none of which the last
multiply before the device can change; the silence of a gap is proved
off the decoder in audio_segments, with no device at all.

The leading-gap copy assertion moves with the priming packet: a hole at
the head is its own length plus the one packet a reader drops.
🔇 test(audio): silence the suites that reach the speakerAhmet Kaan Gümüş · 522149d
🔇 test(audio): silence the suites that reach the speaker

`cargo test` played real files out of the real device: measured 0.37 of
full scale on the sink monitor, 818k nonzero samples, for as long as the
playback suite ran. That is somebody's desk, every run.

Both suites now open through a helper that sets the gain to zero. Nothing
else changes: the stream is still connected and scheduled, the samples are
still decoded, written and handed over, and every assertion here is
measured from the device's own position, which the gain does not touch.
The one test that walks through audible gains does it on a flushed ring,
where there is nothing but the underrun fill to apply them to.

Measured after: peak 0, not one nonzero sample, all three suites green.
✨ feat(engine): video+audio lanes with offset-placed clips, gaps, .edith v2Ahmet Kaan Gümüş · 59eb78e
✨ feat(engine): video+audio lanes with offset-placed clips, gaps, .edith v2

Project gains two lanes; a Clip now carries `start` (its timeline
placement) and `link` (group id), so a gap is simply the absence of a
placement rather than an object anyone has to keep in sync. Moves and
trims become arithmetic on start/in_frame; the lane invariant (sorted,
non-overlapping) is checked in from_parts, at the .edith parser, and
asserted after every mutation.

split cuts every lane and hands the two sides fresh group ids; regroup
is its exact inverse. delete still ripples both lanes (the app keeps its
behaviour), lift removes one placement and leaves a hole, place is the
per-lane overwrite that can make one.

A video gap plays as black frames from a worker that opens no file --
same channel, backpressure, cancel and retire path as a decoder -- and
exports as encoded black. An audio gap is synthesised zero chunks, real
ones, so the master clock keeps counting through it; on the export side
it is spent as stts duration on the packet beside it, since there is no
AAC encoder to make silence with.

.edith v2 writes one line per placement per lane; v1 files still load,
as fully-grouped gapless lanes, and save as v2.

2026-08-09

🎨 style: rustfmt drift in playback testsAhmet Kaan Gümüş · 4c831c1
🎨 style: rustfmt drift in playback tests

Formatting only -- no test changed, `cargo fmt --check -p engine` is clean
again.
✨ feat(engine): multi-source traversal, import validation, cross-source exportAhmet Kaan Gümüş · 68b0ca2
✨ feat(engine): multi-source traversal, import validation, cross-source export

Wave 2 of the import slice, two packages merged at one seam.

Playback traversal (S3): next_clip/seek open each clip against
project.sources()[clip.source]; audio switches to open_multi_segments over
the (source, start, end) triples segments_from now yields. New
PlaybackSession::import validates dimensions, fps and audio params against
the timeline before appending, and reseeks unconditionally so a running
audio worker learns the appended tail. clip_spans_by_source() added for the
app's per-source tint.

Cross-source export (S4): export::start drops its source path argument --
Project::sources() is the only path truth now -- and is pub so a test can
build a multi-source Project without a session. Each clip opens its own
ClipDecoder; the audio pass carries one bresenham accumulator across source
joins.

Seam: PlaybackSession::path is gone. It was kept only to feed export_to,
which no longer takes a path, so the field and its initialiser go with it.
✨ feat: copy/paste clips at playheadAhmet Kaan Gümüş · aae5734
✨ feat: copy/paste clips at playhead

Project::paste splices a clip in at a timeline position, splitting the
clip under it when the position is mid-clip and appending past the end.
One history snapshot, so one undo takes a paste back.

PlaybackSession::clip_at hands a clip out for copying and paste_at goes
through the same edit() reseek as delete/undo. The app keeps an
Option<Clip> clipboard on ctrl+c / ctrl+v.
✨ feat(playback): edit-list traversal — timeline frames, cut/delete/undoAhmet Kaan Gümüş · 7d2251c
✨ feat(playback): edit-list traversal — timeline frames, cut/delete/undo

PlaybackSession owns a Project. try_frame() rewrites every frame index from
source to timeline and reopens the next clip's range when a worker ends, so a
timeline of clips plays as one contiguous sequence; is_eos() is the real end.
seek() maps timeline seconds through the edit list and feeds the audio worker
one segment list for the whole rest of the timeline, so clip joins are gapless.
cut_at is metadata only, delete_clip/undo reseek onto the new mapping.

frames() stays for now: the app switches to try_frame in the UI slice.
✨ feat(playback): seek — rebuild workers, epoch-guarded feeder, clock re-anchorAhmet Kaan Gümüş · e4ca3bd
✨ feat(playback): seek — rebuild workers, epoch-guarded feeder, clock re-anchor

PlaybackSession::seek(secs) replaces both decode workers instead of
steering them: a fresh channel cannot hold a stale frame, and it works
after EOF where the old workers have already exited.

The audio device stays open across a seek. An epoch counter, bumped and
flushed while holding the device lock and re-checked by the feeder inside
that same lock right before every write, is what stops a superseded feeder
from landing stale PCM behind the flush. `fed` is re-based on the device
position, which keeps counting across a flush, so the audio-EOF test stays
exact.
✨ feat(playback): A/V session — audio-master clock, real-speed video, space to pauseAhmet Kaan Gümüş · 63e6964
✨ feat(playback): A/V session — audio-master clock, real-speed video, space to pause

engine::playback::PlaybackSession wires DecodeSession + AudioSession +
AoSession + PlaybackClock together behind open/play/pause/toggle/now/tick.
A feeder thread pours decoded chunks into the device ring; tick() polls the
device position into the clock and switches to wall time at audio EOF.
Every audio failure (no track, no plugin, no daemon) degrades to a
wall-paced silent session.

The app renders against the clock: drain every due frame, show the last
(drop-when-behind), hold one that is early. Space toggles playback.