Commits
Commits on
7f487c10e98d32efa4e4b554b778d2eea5d16efdFiltered to crates/engine/tests/audio_decode.rsClear filter2026-08-13
🧪 test(audio): the two real-file cases come off the manifestAhmet Kaan Gümüş · 455e3a6
🧪 test(audio): the two real-file cases come off the manifest Both had a literal path baked into the source, and a placeholder is what they were left with -- so each opened with a `!exists()` return and every run skipped the only case it exists for: the 8-channel Opus import and the seek that lands on its own second. They now ask `engine::real_library::film` for `av1_opus_71` and `av1_opus_51`, the same one-line gate the colour, PGS and dual-audio cases use: the local manifest names the file, is gitignored, and its absence is a skip line rather than a failure. `real_library.toml.example` grows the two keys, described by shape.
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.
🔊 feat(audio): an Opus film is heard, not refusedAhmet Kaan Gümüş · 699950a
🔊 feat(audio): an Opus film is heard, not refused The refusal was the bug again. `is_audio` said "no opus, ac3 or dts, for which no pure-Rust decoder exists" while symphonia's own mkv and ogg readers have always mapped `A_OPUS` and `OpusHead` to `CODEC_ID_OPUS`: the containers read the format, only the decoder was missing. Symphonia genuinely has none at any version -- its feature list stops at vorbis and there is no `symphonia-codec-opus` crate -- so the decoder is `ruopus`, pure Rust, MIT, no dependencies of its own, and the film plays. Which crate is not a coin toss. A 5.1 track is four elementary Opus streams in one packet, all but the last self-delimited (RFC 6716 App. B). `rusty-opus 0.9.1` -- the sibling of `rusty_aac`/`rusty_mp3` already here -- hands each self-delimited slice to a decoder that parses it as an ordinary packet, so every stream but the last reads the length prefix as payload: it was measured on a 5.1 Opus remux as full-scale noise at -13 dBFS over a passage where the film is silent, which is exactly the failure that "the decoder returns samples" would have shipped. `ruopus` matches ffmpeg's decode of the same file to a correlation of 1.00000 on all six channels. Two things that are Opus's alone: it is stored in Vorbis channel order (FL, FC, FR, BL, BR, LFE) and the 5.1 fold reads the film order every other decoder here hands back, so the frame is permuted before it folds; and its encoder delay lives in the stream (`OpusHead`'s pre-skip, 312 samples) where neither reader drops it, so that is this track's priming -- sample-exact against ffmpeg afterwards, 6.5 ms late before. `.opus` and `.mka` join `is_audio`, `unsupported` asks the other reader before naming a codec (a refusal that fires on a track which decodes is the same defect wearing the other face), and `capability_matrix` covers Opus per container with DTS left as the one live refusal row.
2026-08-11
🧹 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.
🐛 fix(audio): a broken Matroska track is an error, not silenceAhmet Kaan Gümüş · 941e882
🐛 fix(audio): a broken Matroska track is an error, not silence Two verifier findings, both in the same class as A5's silent-take work: a hole nobody asked for must not be indistinguishable from a hole the timeline means. Track::open's mkv arm turned every symphonia failure into Ok(None) -- silence -- with an eprintln as the only trace, so a file whose audio is broken played and exported as a quiet stretch and said nothing. Now SymTrack::open returns Ok(None) for the one honest case (the container opened and holds no audio track) and Err for the rest; a codec nothing here decodes is still silent, since that is what the decoder, not the open, reports. probe_streams follows the same split, and a standalone audio file keeps its old answer through open_required. lanes.rs: three_lane_file() handed both of its tests one pid-keyed path, so whichever finished first deleted the file the other was still using. The name is the caller's now.
Merge remote-tracking branch 'origin/main' into worktree-agent-ab6959260e5ee211cAhmet Kaan Gümüş · 1e8c454
Merge remote-tracking branch 'origin/main' into worktree-agent-ab6959260e5ee211c # Conflicts: # crates/engine/src/audio.rs # crates/engine/src/demux.rs # crates/engine/tests/audio_decode.rs # scripts/gen_fixtures.sh
✨ feat(audio): AC-3 and E-AC-3 sound out of a Matroska fileAhmet Kaan Gümüş · a71f015
✨ feat(audio): AC-3 and E-AC-3 sound out of a Matroska file The "(AAC only)" refusal fired on every A_AC3/A_EAC3 track in an mkv because a Matroska file's sound reached no reader at all. The blocks of its first audio track are now indexed beside the picture's and handed to the oxideav-ac3 decoder the mp4 path already uses, downmix and all.
✨ feat(export): every video format carries sound, AV1 picks its box, MP3 is a rowAhmet Kaan Gümüş · 5ebd3ac
✨ feat(export): every video format carries sound, AV1 picks its box, MP3 is a row Three asks, one seam — the export's audio path was a packet copy, and everything it could not copy was a refusal. - MkvMuxer gains an A_AAC track (CodecPrivate = AudioSpecificConfig, CodecDelay one packet) and interleaves it into the clusters: an AV1 export carries the timeline's sound instead of naming it as left out. - Mp4Muxer::create_av1 writes AV1 into an mp4 — the `av01` + `av1C` sample entry `mp4 0.14` cannot spell is patched into the finished moov (layout cribbed from OxideAV's oxideav-mp4, MIT); Mp4Demuxer reads that entry back. - Format::Mp3 through `rusty_mp3` at 256 kbps CBR, and Format::Av1Mp4 beside Format::Av1: the export card has a row and a key for each. - copy_audio lifts every "cannot copy" refusal into a route to encode_audio — a second audio lane, a speeded clip, a Matroska source, an mp3 or a png timeline. A copy nothing forces stays a bit-exact copy. Round trips per container, through this project's own readers: mkv + mp4 AV1 with a tone (mux unit tests), an AV1 export in either box (tests/av1.rs), a still under a song as an mp4 with sound and an MP3 of the timeline (tests/audio_export.rs), two lanes summed into an mp4 (tests/lanes.rs), a speeded lane resampled into one (tests/speed.rs).
2026-08-10
✨ feat(audio): AC3 tracks decode with a built-in stereo downmixAhmet Kaan Gümüş · 8c7bf80Browse files
🐛 fix(engine): NTSC frame rates survive the sample tableAhmet Kaan Gümüş · 3f81ef8
🐛 fix(engine): NTSC frame rates survive the sample table `mp4 0.14`'s `Mp4Track::frame_rate` divides the sample count by whole milliseconds before the float cast, so 24000/1001 read back as a flat 23.0: the picture the audio-sample master clock asked for was 4 % out and the drift grew with the film — five minutes of it by the end of a two-hour one. The frame rate now comes off the stts totals in f64, which is exactly `timescale / delta` for a constant table and an average for a spread one. The same truncation lived at the writing end (a 90 kHz clock cannot count 23.976 fps in whole ticks), so the muxer picks a timescale that can: 90 kHz wherever it divides exactly — every integer rate, so those exports are byte for byte what they were — and `round(fps * 1001)` over 1001 ticks otherwise, which is exact for the whole NTSC family. The hardware encoder gets that same rational instead of a rounded `fps * 1000`. The video edit list is honoured now too, the way the audio one always was — but only what it really trims: a `media_time` equal to the first `ctts` offset is the B-frame composition delay, not a cut, and reading it as one throws two real frames away. A file whose audio we cannot decode at all (an AC-3 remux) played silent with the reason on stderr; the session carries it now and the window says NO AUDIO in its notice bar.
2026-08-09
✨ feat(engine): seek primitives — video open_at, ao_flush, audio open_atAhmet Kaan Gümüş · 96ae365
✨ feat(engine): seek primitives — video open_at, ao_flush, audio open_at Lane 1 of the seek slice; PlaybackSession orchestration comes next. - demux/decode: stss sync lookup, DecodeSession::open_at decodes from the keyframe and discards to the target; Frame.index stays absolute. HW plugin ABI: vh_open renamed vh_open_at(path, target) — discards skip the vaGetImage readback; measured seek cost 65ms HW / 222ms SW - engine-audio: ao_flush drains the ring consumer-side in the RT callback (one-shot atomic), stale PCM unplayable even when paused; played-position atomics untouched so clock math survives - audio: open_at walks stts, 2-packet AAC pre-roll (MDCT overlap reconstructed exactly — verified 0-diff before the first PNS band), sample-exact trim; priming skip and seek discard unified. AAC seek is deliberately not bit-exact: symphonia's PNS noise LCG state depends on packet history; bounded <1e-3 by test instead
✨ feat(engine): audio decode, PipeWire output plugin, playback clockAhmet Kaan Gümüş · 229a569
✨ feat(engine): audio decode, PipeWire output plugin, playback clock Wave 1 of the audio slice — three independent modules, app wiring comes next: - audio.rs: AAC-LC via standalone symphonia AacDecoder over the existing mp4 demuxer; priming trim read from the container elst (verified against ffprobe); channel identity pinned by zero-crossing tests on the 440/880 Hz fixture - engine-audio: dlopen'd PipeWire cdylib (ao_* C ABI). App binary keeps zero libpipewire linkage; daemon absent fails open() in ~1ms. Fill capped at 1024 frames/callback: uncapped, PipeWire hands the sink-sized buffer and the position clock steps 256ms at a time. Stream time rate is 1/48000 regardless of stream rate — position is rescaled or the clock runs 8.8% fast on 44.1k content - clock.rs: PlaybackClock, audio-driven with wall fallback; audio positions relative to last re-anchor so restarted streams re-sync; paused == frozen exactly, all re-anchoring through one path