Repository navigation
obs-media-io: Port media-io/media-remux.c.h - #1928
Merged
Merged
Conversation
Refs #1927. Refused jobs, progress, channel layouts and a muxer that rejects the stream, with WAV inputs written by hand. Pins the C as it is: a callback that stops the remux still reports success.
Refs #1927. Tier 1 for media-io/media-remux.c.h over a scripted Host: the cases of test_media_remux.c and test_remux_audio_timestamps.c, and the error paths FFmpeg rarely takes. Job::create, process and destroy are todo!(): 35 of 36 cases fail.
Fixes #1927. media_remux_job_create, _process and _destroy now live in obs-media-io. The safe core decides every FFmpeg call in the C's order over a Host trait; FFmpeg's struct layouts stay in C, in the private adapter media-io/media-remux-ffmpeg.c.h (hidden obs_media_remux_*, in the FFmpeg group libobs.media), so no Rust crate links FFmpeg. media-remux.c.h moves to its own ported group, libobs.ported-media-remux. The input size comes from os_get_file_size, which drops the file's _MSC_VER stat/_stat64 conditional (#870). Intentional differences: a failed create sets *job to NULL (the C leaves it pointing at the freed job); a NULL output name fails (C: strcmp(NULL)); a packet of a stream index with no stream is written unchanged (C: out of bounds); on Windows the size is read through a UTF-8 path. Tier 3 builds the original C over a recording FFmpeg stand-in in the oracle crate (oracle/ffmpeg-shim, oracle/media_remux_ffmpeg.c) and the adapter over the same stand-in, and compares results, progress reports and the log of every FFmpeg call and blog line over chosen and 256 random scripts. Mutation checks: the progress throttle (> 9 instead of > 10) and the rounding of the input tick (NEAR_INF instead of UP) both fail it. Layout test for the two adapter structs. port_comparison: one 60-frame AAC job, Rust 77.6 us, C 70.2 us (same stand-in work on both sides).
zackees
marked this pull request as ready for review
October 23, 2026 11:34
MSVC /W4 /WX rejects an uninitialized const object (C4132).
This was referenced Oct 23, 2026
This was referenced Oct 23, 2026
MCPVOT
pushed a commit
to MCPVOT/obs-studio
that referenced
this pull request
Oct 30, 2026
…-rust#1997) (obs-rust#2554) * test: require the port_comparison units to be discovered, not listed (obs-rust#1997) RED: the ci test demanded the hand-kept `#[path] mod` lines and the `modules![...]` call in `port_comparison.rs` stay sorted. It now fails if either list exists and requires the two generated includes instead. `uv run -m unittest discover -s ci -p test_sorted_shared_lists.py`: test_port_comparison_units_are_discovered FAILs, assertNotRegex matched `#[path = "port_comparison/audio.rs"]`. * build: Generate the port_comparison unit list from the directory (obs-rust#1997) GREEN: build.rs enumerates benches/port_comparison/*.rs and writes the #[path] module lines and the run_units() call list into OUT_DIR, so a port adds its own file and edits nothing shared. That was the last hand-kept list every port appended to; two ports on one file collided in the merge queue (obs-rust#1922 vs obs-rust#1928, obs-rust#1929 vs obs-rust#1922). The file stem is the module name, so core.rs becomes core_units.rs (a `mod core` at the crate root would make the units' `use core::ffi` paths ambiguous). Absolute #[path] rather than `mod x { include!() }` because the units open with //! inner docs, which include! cannot carry. Verified: `soldr cargo check -p obs-c-oracle --benches` is clean, and a throwaway zzz_probe.rs appeared in the generated run_units() and compiled with no edit to a shared file. ci/test_sorted_shared_lists.py passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1927 (unit 7 of #1846).
libobs/media-io/media-remux.c.h(Tools > Remux Recordings) now lives inobs-media-io:media_remux_job_create,_process,_destroy.Commits
test: Characterize media_remux_job_* before its port:test/cmocka/test_media_remux.c, 13 cases with WAV inputs written by hand (refused jobs, NULL job, every sample kept, 5 channels written as 4.1 and 6 as 5.1(back), progress 0..100, a callback that stops the remux, a muxer that rejects the stream). Passes against the C (local Tier 2, mode OFF).obs-media-io: Test the remux job against stubs: Tier 1 over a scriptedHost;Job::create/process/destroyweretodo!(), 35 of 36 cases failed.obs-media-io: Port media-io/media-remux.c.h.Design
Hosttrait. FFmpeg's struct layouts differ between versions, so they stay in C: the private adapterlibobs/media-io/media-remux-ffmpeg.c.h(hiddenobs_media_remux_*, in the FFmpeg-backedlibobs.mediagroup) makes one libavformat call or reads/writes one field per function. No Rust crate links FFmpeg.media-remux.c.hmoves to its own ported grouplibobs.ported-media-remux(own PCH). Windows exports:rust-exports.d/obs-media-io-media_remux.txt.os_get_file_size, which drops the file's_MSC_VERstat/_stat64conditional (facade: libobs top-level files (obs-module, obs-display, obs-hotkey, obs-source, obs-internal, gpu-encode, audio-controls, media-remux): move 14 platform conditionals #870).Tiers
tests/remux/media_remux.rs), the cmocka cases plus the error paths and the libobs: Keep audio frames sample accurate when remuxing #360 audio timestamps.test_media_remux(new) andtest_remux_audio_timestamps, unchanged, against real FFmpeg; layout test for the two adapter structs.tests/remux/media_remux_parity.rs): the original C is built in the oracle crate against a recording FFmpeg stand-in (oracle/ffmpeg-shim/,oracle/media_remux_ffmpeg.c; the Rust test runners have no FFmpeg), and the real adapter over the same stand-in; results, progress reports and the log of every FFmpeg call andblogline must match over chosen cases and 256 random scripts. Mutation checks: the progress throttle (> 9for> 10) and the input tick's rounding (NEAR_INFforUP) both fail it.port_comparisonmedia_remux/job_60_aac_frames: Rust 77.6 µs, C 70.2 µs (both over the same stand-in, which dominates).Intentional differences
*jobto NULL; the C leaves it pointing at the job it just freed (characterized in the cmocka test's comments, not asserted; the frontend only destroys a created job).strcmp(NULL))._stat64in the ANSI code page, so progress was infinite for other names).bzalloc.Kept, characterized, not endorsed: a callback that returns false stops the remux and the job still succeeds;
AVERROR_INVALIDDATA/EINVALwrites drop the packet and continue.