Repository navigation
obs-output: Port the encoder size and info choices - #2148
Merged
Merged
Conversation
Behaviour-neutral extraction before the Rust port. The choices of get_audio_info(), get_video_info(), obs_encoder_set_scaled_size(), obs_encoder_scaling_enabled(), obs_encoder_get_width() / _height() and obs_encoder_get_sample_rate() move to libobs/obs-encoder-size.c.h, as seven functions on plain values declared in the new libobs/obs-encoder-size.h without EXPORT (hidden, as -fvisibility=hidden keeps them): - obs_encoder_size_audio_defaults(info, mix): get_audio_info()'s default fill, an unknown format, a 0 sample rate and unknown speakers each from the mix, over struct obs_encoder_audio_fill (the three fields, the enums as int); - obs_encoder_size_cap_override(caps, w, h, voi_w, voi_h): the video's size for an encoder with OBS_ENCODER_CAP_SCALING, else the size the plugin left; - obs_encoder_size_scaled_gate(type, active, initialized): the three refusals of obs_encoder_set_scaled_size() in their order (not a video encoder, active, initialized), or check; - obs_encoder_size_scaled_match(has_voi, voi_w, voi_h, w, h): disable when the size equals the video's, else set; - obs_encoder_size_scaling(w, h): either scaled axis set; - obs_encoder_size_video_route(type, has_media, scaled): where one axis of obs_encoder_get_width() / _height() comes from: the wrong-type warning, 0 without a video, the scaled size, or the video's; - obs_encoder_size_rate_route(type, has_media, samplerate): the same for obs_encoder_get_sample_rate() (an audio encoder, the stored rate or the mix's). obs-encoder.c.h keeps obs_encoder_valid(), every warning with the encoder's name, video_output_get_info() and audio_output_get_info(), video_output_get_width() / _height() and audio_output_get_sample_rate() (called only on the media route, so they run exactly when they ran before), the load of the active flag and every write to the encoder. The plugin callbacks stay in C in the same order: the default fill, then the plugin's get_audio_info / get_video_info, then the cap override. No lock is taken or dropped. What changes in what the C reads, not in what it does: - obs_encoder_set_scaled_size() loads the active flag and reads initialized before the type is known (an atomic load and a plain read, no side effect); - obs_encoder_get_width() / _height() / _sample_rate() read media and the scaled size or rate before the type check; - get_video_info() reads voi->width / height without the cap (voi is already dereferenced for the format) and stores the size back; - get_audio_info() reads the three mix fields up front. Both callers pass a zeroed info, so the original read all three too; - obs_encoder_scaling_enabled() reads scaled_height when scaled_width is set. Checked in a scratch harness (not committed) that compiles origin/master's functions verbatim against the moved ones on a stand-in encoder, with plugin callbacks that record what they see and change the info: 20,000,000 random calls (types 0, 1 and outside the enum, caps with and without the scaling bit, with and without media, a root size that differs from the video info, scaled sizes and rates biased to 0 and to the video's, the active and initialized flags, a NULL encoder) give the same results, the same warnings, the same media getter calls in the same order, the same plugin inputs, the same info and the same encoder afterwards. Four planted mutants were each caught within 300 calls. The constants are copied into the header, so it needs no core header; obs-encoder.c.h checks them against obs-encoder.h and audio-io.h with _Static_assert. The new file joins libobs.core-output, just before obs-encoder.c.h, with libobs.pch.h, which includes the new header; source-sets.json lists it. docs/rust-port/naming.md maps it to rust/obs-output. The exported symbol sets are unchanged (1766). git log -L on each moved function shows only upstream history. The fork's changes to this file (obs-rust#1109, obs-rust#1964, obs-rust#2111 and the earlier ones) are all in code that stays C. Refs obs-rust#2134
test_encoder_size_steps compiles libobs/obs-encoder-size.c.h (ASan and UBSan) and calls only its seven functions through obs-encoder-size.h, so it runs on every platform without a display. 28 cases: - obs_encoder_size_audio_defaults(): a zeroed info (what both callers pass) takes every field from the mix; the format, the rate and the speakers each unknown on its own; none unknown; an unknown mix field copied as unknown; every combination of known and unknown fields against a model; values outside the enums (-1, INT_MAX, INT_MIN) counting as known, and the rate at the u32 edges; - obs_encoder_size_cap_override(): without the cap (0 and every other bit) the plugin's size is kept; with it the video's size wins, the plugin's size equal, different or 0; each of the 32 cap bits alone; every pair of eleven edge sizes (0, 1, 2, 720, 1080, 1280, 1920, 2^31 - 1, 2^31, UINT32_MAX - 1, UINT32_MAX) with and without the cap; - obs_encoder_size_scaled_gate(): every refusal. Not a video encoder (audio, 2, 3, -1, INT_MAX, INT_MIN) first, active or initialized or not; an active video encoder, initialized or not; an initialized one; else check; - obs_encoder_size_scaled_match(): equal sizes disable; one axis or both differing, swapped axes and one axis 0 set; no voi sets, the voi's size ignored, 0 x 0 included; every pair of edge sizes, equal, swapped and on one axis; - obs_encoder_size_scaling(): 0 x 0 off, either axis on, the u32 edges; - obs_encoder_size_video_route() and _rate_route(): the wrong type refused before the media is looked at, with and without media and at every edge size; no media reads 0, scaled or not; with media the scaled size (rate) when set, else the video's (mix's); and the width and height end to end, with and without a scaled size, a video or one scaled axis. Characterized, not endorsed: - obs_encoder_set_scaled_size() with one axis 0, or equal to the video's on one axis only, stores it as it is: obs_encoder_scaling_enabled() is then true, and the 0 axis reads the video's; - with OBS_ENCODER_CAP_SCALING, a 0 x 0 video gives 0 x 0, whatever the plugin set; - 0 x 0 asked of a 0 x 0 video goes through the "matches the output" warning. It is in the native test graph, in the core suite (the partition test in rust/obs-build pins no suite size), and links libm off MSVC. No assert_in_range or fail_msg, so it builds with cmocka 1.x and 2.x. The real-libobs tests test_encoder_video_reset (obs-rust#1109), test_encoding_lag_rescale, test_multitrack_encoder_override, test_encoder_fallback and test_encoder_roi (obs-rust#1964) cover the callers. Refs obs-rust#2134
RED for the port of libobs/obs-encoder-size.c.h to the encoder_size module of rust/obs-output, next to encoder_roi (obs-rust#1974). The safe core is a stub (todo!()): audio_defaults(AudioFill, AudioFill) -> AudioFill, cap_override(caps, Size, Size) -> Size, scaled_gate(type, active, initialized) -> ScaledGate { NotVideo, Active, Initialized, Check }, scaled_match(Option<Size>, Size) -> ScaledMatch { Disable, Set }, scaling_enabled(Size) -> bool, and video_size_route() / sample_rate_route(type, has_media, stored) -> SizeRoute { WrongType, NoMedia, Stored, Media }, with the types, the cap and the unknown audio values as constants. tests/output/encoder_size.rs ports test_encoder_size_steps 1:1: its 28 cases under the same names (steps_*), in the same order, with the same values and expectations, the characterized-not-endorsed cases included. Edge cases (edge_*) check the core against models of the original C: every pattern of 0 and non-0 audio fields (small, outside the enums, at the edges) against four mixes; every cap word over the low 8 bits, with and without every high bit, and each high bit alone; every type from -8 to 8 and the i32 extremes against both flags; every voi and size over 0, 1, 2^31 and u32::MAX with and without a voi; scaling over the edge sizes; both routes over every type, media and edge size; and the constants. soldr cargo test -p obs-data --test obs-tests-core -- output::encoder_size:: fails 34 of 35 with "not yet implemented"; edge_constants, which reads only the constants, passes. Refs obs-rust#2134
Ports libobs/obs-encoder-size.c.h, the encoder size and info choices of obs-encoder.c, to the encoder_size module of rust/obs-output. obs-encoder.c.h stays C around it: obs_encoder_valid(), every warning with the encoder's name, video_output_get_info(), audio_output_get_info(), video_output_get_width() / _height(), audio_output_get_sample_rate(), the plugin's get_audio_info and get_video_info between the default fill and the cap override, the load of the active flag and every write to the encoder and the infos. No lock is involved. The hybrid libobs drops the C file and links the Rust shims in its place. Safe core (src/encoder_size.rs): - audio_defaults(): an unknown format, a 0 rate and unknown speakers each from the mix, any other value kept; - cap_override(): the video's size with OBS_ENCODER_CAP_SCALING, else the plugin's; - scaled_gate(): NotVideo, else Active, else Initialized, else Check, in the C's order; - scaled_match(): Disable when a voi is there and equals the size on both axes, else Set; - scaling_enabled(): either axis not 0; - video_size_route() / sample_rate_route(): WrongType for any type but OBS_ENCODER_VIDEO (OBS_ENCODER_AUDIO), else NoMedia, else Stored when the scaled size (rate) is not 0, else Media. The module denies clippy's arithmetic, indexing, unwrap, expect, panic, todo, unimplemented and unreachable lints, keeps no state and takes no lock. Shims (src/ffi/encoder_size.rs): the seven functions keep the C signatures. struct obs_encoder_audio_fill and struct obs_encoder_size are mirrored #[repr(C)]; the shims read the input fills by value, return the structs by value and the enum values as u32 (the C's enums). The type is a c_int, as the C passes it. No intentional differences. Kept, characterized, not endorsed (test_encoder_size_steps): a scaled size with one axis 0, or equal to the video's on one axis only, is stored as it is; with the cap a 0 x 0 video gives 0 x 0; 0 x 0 asked of a 0 x 0 video takes the "matches the output" path. C side: the file leaves libobs.core-output for its own group, libobs.ported-encoder-size (LIBOBS_PORTED_SOURCES), whose PCH is only obs-encoder-size.h; libobs.pch.h keeps the header for obs-encoder.c. The functions are not EXPORT, so the shims are hidden: rust-hidden.txt, the local: list of rust-exports.map and rust-unexports-macos.txt. libobs-rust already links the crate's ffi. The exported symbol sets are unchanged and equal: 1766 on the C backend, the hybrid and libobs-c-reference; the seven functions are local in all three, and the hybrid's come from the Rust archive (no C object of the group in the hybrid libobs). ci/test_ported_sources.py checks the group on every host. test_encoder_size_steps still compiles the C file into itself, unchanged. It has no _rust variant: linking it against libobs_rust-static was tried and fails with 506 undefined references, because the shims' archive member (obs_output cgu.1) also holds the service lifecycle, the delay and the interleaver, which need libobs's hidden seams and obs-util (GIO, libuuid), as for test_output_video_checks_steps (obs-rust#2117). Its tests.d file says so. soldr cargo test -p obs-data --test obs-tests-core -- output::encoder_size:: passes 35 of 35. Refs obs-rust#2134
Oracle (oracle/encoder_size.c): the original obs-encoder-size.c.h, unmodified, with its seven functions renamed to oracle_obs_encoder_size_*, plus the 15 constants of the header (the types, the cap, the unknown audio values and the enum values) and the layout of struct obs_encoder_audio_fill and struct obs_encoder_size (sizes, alignments and every offset) and the size of the two enums. Tier 3 (tests/output/encoder_size_parity.rs, 15 tests). Every call runs the shim, the C and the safe core and compares the results exactly: the audio fill and the size field by field, the gate, match and routes as values, the scaling check as a bool. Runs: - the constants and the layouts against the C; - the audio defaults over every combination of seven formats, five rates and seven speaker values on the info and on the mix (60,025 calls); - the cap override over every cap word of the low 16 bits, alone and with every high bit, and each high bit alone, against three size sets; and every size over six edge values (0, 1, 2, 2^31, UINT32_MAX - 1, UINT32_MAX) on all four, with no cap, the cap and every cap; - the gate exhaustively over both flags and every type from -65,536 to 65,536, the int extremes and every 65,521st int; - the match over every combination of the six edge values on the voi and the size, with and without a voi; - the scaling check over every pair of edge values; - both routes over a seventh of those types and -8 to 8, media or not, and the edge values, each route reached; - proptests (8192 cases each) over full-range int types (biased to -2..3), u32 caps (biased to the scaling bit set and clear), u32 sizes and sample rates (biased to 0 and the top of the range, and the asked size to the voi's on one axis or both). The parity module passed 10 runs in a row with fresh seeds. The regression file holds the seeds proptest saved while the mutants below failed; all pass on the port. Mutation check (done once, not committed), with Tier 1 (35 tests) and Tier 3 (15) in one run: 35 mutants, 24 in the core, 9 in the shims and 2 planted equivalents. All 33 non-equivalent mutants fail. | Mutant | Tier 1 | Tier 3 | |---|---|---| | audio_defaults: format filled when known | 9 | 2 | | audio_defaults: rate never filled | 5 | 2 | | audio_defaults: speakers from the mix format | 5 | 2 | | audio_defaults: rate filled from the mix only when the format is unknown | 3 | 2 | | AUDIO_FORMAT_UNKNOWN 1 | 5 | 3 | | cap_override: OBS_ENCODER_CAP_SCALING 1 << 4 | 3 | 4 | | cap_override: inverted | 5 | 3 | | cap_override: any cap overrides | 3 | 2 | | cap_override: only the width overridden | 4 | 3 | | scaled_gate: initialized before active | 2 | 2 | | scaled_gate: only audio refused | 2 | 2 | | scaled_gate: no initialized check | 2 | 2 | | scaled_gate: active ignored | 2 | 2 | | scaled_match: width only | 3 | 2 | | scaled_match: no voi compares 0 x 0 | 3 | 2 | | scaled_match: inverted | 5 | 2 | | scaling_enabled: both axes needed | 2 | 2 | | scaling_enabled: width only | 2 | 2 | | route: media checked before the type | 3 | 2 | | route: stored when 0 | 4 | 2 | | route: no media check | 4 | 2 | | video route: audio type | 5 | 2 | | video route: any type above 0 is video | 2 | 2 | | rate route: any type up to 0 is audio | 2 | 2 | | shim: STORED and MEDIA swapped | 0 | 2 | | shim: ACTIVE and INITIALIZED swapped | 0 | 2 | | shim: DISABLE and SET swapped | 0 | 2 | | shim: format and speakers swapped | 0 | 2 | | shim: voi width and height swapped | 0 | 3 | | shim: has_voi always true | 0 | 2 | | shim: scaling of the width twice | 0 | 2 | | shim: rate route through the video route | 0 | 2 | | shim: OBS_ENCODER_SIZE_NO_MEDIA 0 | 0 | 3 | | equivalent: scaled_match as the C (has_voi && w == && h ==) | 0 | 0 | | equivalent: route with the stored check first under the media check | 0 | 0 | Tier 1 does not reach the shims; Tier 3 kills every shim mutant. Refs obs-rust#2134
The rust/README.md crate table now lists libobs/obs-encoder-size.c.h among the units rust/obs-output holds, and its port table has a row for it: the seven functions and their rules, what stays C in obs-encoder.c.h (the validity checks, the warnings, the media getters, the plugin callbacks between the default fill and the cap override, the active flag load and the writes to the encoder), the two mirrored structs, the "characterized, not endorsed" behaviours kept, why test_encoder_size_steps has no _rust variant, the real-libobs tests that see the swap, and what Tier 3 compares. No intentional differences. The crate's description and lib.rs say what it holds. docs/rust-port/naming.md got its entry in the move commit. port_comparison gets its own bench file, benches/port_comparison/encoder_size.rs: 1024 audio default fills (a zeroed or partly set info against a 48 kHz or 44.1 kHz mix); 1024 rounds of the cap override, the gate, the match, the scaling check and the video route over 1080p, 720p and 1440p videos scaled to 720p, to their own size or not; and 1024 rate routes, each folded into a checksum both sides must match. On x86_64 Linux (GCC, not pinned, a loaded host; median per 1024 calls): audio_defaults 7.59 us Rust and 10.28 us C (0.74x), video_override_gate_match_route 8.54 us Rust and 8.54 us C (1.00x), rate_route 1.63 us Rust and 1.60 us C (1.02x). Each runs once per encoder start, setting change or getter call, so neither side is on a hot path. These numbers come from a run of this file's benches alone: a full port_comparison run currently stops at the pre-existing bmem/count fixture check, before it reaches them. Fixes obs-rust#2134
This was referenced Oct 24, 2026
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 #2134
What and why
Ports the encoder size and info choices of
libobs/obs-encoder.c.htorust/obs-output, as a new moduleencoder_sizenext toencoder_roi(#1974). These choices decide:get_audio_info()'s default fill from the mix);get_video_info(), with theOBS_ENCODER_CAP_SCALINGoverride after the plugin'sget_video_info);obs_encoder_set_scaled_size()refuses, disables scaling or stores the size, and whatobs_encoder_scaling_enabled()reports;obs_encoder_get_width()/_height()and the rateobs_encoder_get_sample_rate()report to outputs, the frontend, obs-websocketGetOutputListand plugins.A wrong answer makes the encoder and the GPU rescale mix disagree on the size (the #1109 class), or connects an encoder at the wrong rate. So every rule is pinned in the characterization and checked by a mutant.
git log -Lon each moved function shows only upstream history. The fork's changes in this file (#1109, #1964, #2111 and the earlier ones) are all in code that stays C.Six commits:
Move (behaviour-neutral): the choices go to
libobs/obs-encoder-size.c.has seven functions on plain values. They are declared in the newobs-encoder-size.hwithoutEXPORT, so they are hidden:obs_encoder_size_audio_defaults(&info, &mix): an unknown format, a 0 rate and unknown speakers each from the mix, overstruct obs_encoder_audio_fill(the three fields, the enums asint);obs_encoder_size_cap_override(caps, w, h, voi_w, voi_h): the video's size withOBS_ENCODER_CAP_SCALING, else the size the plugin left;obs_encoder_size_scaled_gate(type, active, initialized): the three refusals ofobs_encoder_set_scaled_size()in their order (not a video encoder, active, initialized), or check;obs_encoder_size_scaled_match(has_voi, voi_w, voi_h, w, h): disable when the size equals the video's, else set (also without a video);obs_encoder_size_scaling(w, h): either scaled axis set;obs_encoder_size_video_route(type, has_media, scaled)andobs_encoder_size_rate_route(type, has_media, samplerate): whereobs_encoder_get_width()/_height()andobs_encoder_get_sample_rate()take their value from: the wrong-type warning, 0 without media, the stored value when set, else the media's.obs-encoder.c.hkeeps:obs_encoder_valid()and every warning with the encoder's name;video_output_get_info()andaudio_output_get_info();video_output_get_width()/_height()andaudio_output_get_sample_rate(), called only on the media route, so they run exactly when they ran before;get_audio_info/get_video_info, then the cap override;The header copies the types, the cap and the two "unknown" values, and
obs-encoder.c.hchecks them with_Static_assert. The new file joinslibobs.core-outputwithlibobs.pch.h, anddocs/rust-port/naming.mdmaps it torust/obs-output.What the C now reads that it did not read before. None of these reads changes a result:
obs_encoder_set_scaled_size()loads the active flag and readsinitializedbefore the type is known. These are an atomic load and a plain read, with no side effect.obs_encoder_get_width()/_height()/_sample_rate()readmediaand the scaled size or rate before the type check.get_video_info()readsvoi->width/heightwithout the cap (voiis already dereferenced for the format) and stores the size back.get_audio_info()reads the three mix fields up front. Both callers pass a zeroed info, so the original read all three too.obs_encoder_scaling_enabled()readsscaled_heightwhenscaled_widthis set.This was checked against the original code. A scratch harness (not committed) compiles origin/master's functions verbatim against the moved ones on a stand-in encoder. Its plugin callbacks record what they see and change the info. It ran 20,000,000 random calls, varying the type (0, 1 and outside the enum), the caps with and without the scaling bit, media or none, a root size that differs from the video info, scaled sizes and rates biased to 0 and to the video's, the active and initialized flags, and a NULL encoder. Both sides give the same results, the same warnings, the same media getter calls in the same order, the same plugin inputs, the same info and the same encoder afterwards. The only difference it counts is the extra active-flag load above (2,099,611 of the 20,000,000 calls). Four planted mutants were each caught within 300 calls.
Characterization:
test_encoder_size_steps, 28 cases. It compiles the moved file (ASan and UBSan) and calls only the seven functions through their header. It pins:INT_MAXandINT_MIN; the wrong type of both routes before the media is looked at;voi(set, the voi's size ignored);u32edges: every pair of 0, 1, 2, 720, 1080, 1280, 1920, 2^31 - 1, 2^31,UINT32_MAX - 1andUINT32_MAXfor the override and the match, and the edges for scaling and both routes.The test is in the core suite of the test graph (the partition test in
rust/obs-build/tests/native.rspins no suite size, so nothing there changes). It links libm except on MSVC, and uses noassert_in_rangeorfail_msg.RED: Tier 1 in the crate against
todo!(). 34 of 35 tests fail.GREEN: the safe core and seven
#[no_mangle]shims, in a newlibobs.ported-encoder-sizegroup whose PCH is only the new header. This commit updates the three export lists,source-sets.json, the unity lists andci/test_ported_sources.py, each in sorted place.Tier 3: a C oracle of the unchanged file, parity, the regression file, and the mutation check.
Docs: the README rows, the crate's description and
lib.rs, and aport_comparisonbench file.The core denies clippy's arithmetic, indexing, unwrap, expect, panic, todo, unimplemented and unreachable lints. It keeps no state and takes no lock. The type crosses as a C
int, so a plugin's out-of-rangeinfo.typebehaves as in C: it is neither audio nor video.Kept, characterized, not endorsed:
obs_encoder_set_scaled_size()with one axis 0, or with a size equal to the video's on one axis only, stores it as it is.obs_encoder_scaling_enabled()is then true, and the 0 axis reads the video's.OBS_ENCODER_CAP_SCALING, a 0 x 0 video gives 0 x 0, whatever the plugin set.Intentional differences: none.
No
_rustvariant. The steps test calls the hidden functions directly, sotest_encoder_size_steps_rustwas wired againstlibobs_rust-staticand built. It fails to link with 506 undefined references. The shims' archive member (obs_outputcgu.1) also holds the service lifecycle, the delay and the interleaver, which need libobs's hidden output and service seams and obs-util (GIO, libuuid).test_output_video_checks_steps(obs-output: Port the output video size, conversion and capture checks #2117) has no_rustvariant for the same reason. The target was removed, and itstests.dfile says why. Tier 3 compares the shims with the C instead, and the real-libobs tests see the swap through the hybrid.Exported symbols: 1766 on the C backend, the hybrid and
libobs-c-reference, with identical sets. The seven functions are local (t) in all three. In the hybrid they come from the Rust archive: there is no C object of the group in the hybrid libobs, and the group's C is compiled only intolibobs-c-referenceand the C backend.Performance (
port_comparison, x86_64 Linux, GCC, not pinned, a loaded host; median per 1024 calls):audio_defaultsvideo_override_gate_match_routerate_routeThese run once per encoder start, setting change or getter call, so neither side is on a hot path. The numbers come from a run of this file's benches alone. A full
port_comparisonrun currently stops at the pre-existingbmem/countfixture check, before it reaches them.No user-visible change, so no
docs/features.mdline.Observed, not changed (upstream behaviour; nothing here is fixed):
obs_encoder_set_scaled_size(enc, 0, 720)stores 0 x 720.obs_encoder_scaling_enabled()then says true,obs_encoder_get_width()returns the video's width and_height()720, so the encoder is scaled on one axis only. The frontend always sets both axes, and nothing comes from outside OBS. A plugin could do it. A check belongs in a separate fix.get_audio_info()andget_video_info()dereference the mix's and the video's info without a NULL check. Both callers run only when the encoder has media (obs_encoder_initialize_internal()refuses without it), so this is not reachable today. The port keeps the C's order, so the C still makes those reads.obs_encoder_set_scaled_size()readsinitializedwithoutinit_mutex, as before. The move keeps the same unlocked read, and now also makes it for an encoder that is not a video encoder.RED → GREEN
90dca0a80(b2df6ec44before the last rebase).soldr cargo test -p obs-data --test obs-tests-core -- output::encoder_size::fails 34 of 35, every failure "not yet implemented": the 28 portedsteps_*cases and 6 of the 7edge_*cases.edge_constants, which reads only the constants, passes. The run was ona650afaff, the same commit before the rebases (they took in obs-scene: Port the scene item names and coordinate keys #2129, libobs: graphics exports and imports per OS in graphics-{exports,imports}-<os>.h (#872) #2131, obs-core: Port the output frame copy plan and scale effect #2133, libobs: Keep an async rotation in 0-359 #2136, libobs: Ignore an out-of-range output mixer index and a conversion without video #2142, decklink: Output crashes on a saved mode the device lacks, and on an HDR start with no conversion #2144 and ci: run the macOS and Windows Tier 2 ctest suites in parallel (#2138) #2145, which change none of the code these tests build).c6024874e(6e50f9bc3before the last rebase). Tier 1 passes 35/35. Tier 2 ran under a privateXvfb -noresetwithdbus-run-session, a fresh HOME,ulimit -c 0and no TMPDIR, through ctest. Before each c-ref run,ninja libobs-c-referencewas run explicitly and the mtime of itslibobs.so.30was checked to be after the hybrid build. The loader was checked to load the lane'slibobs.so.30.Final head
c02bced80(onaf31b65c9), rebased from650d0a5dfover #2139 (graphics entry points) and #2140 (win-dshow); the focused set below passed again on all three lanes onc02bced80. Before that,650d0a5df(oncf4de891b). Its code is the same asa6eb642e6(onb4df4ae93): the last rebase took in only #2145 (CI scripts) and #2146 (the DeckLink plugin). The focused set and the export counts below ran ona6eb642e6. The full ctest ran onc4ef2fb4d(on57ad29656), which differs from it only by master's next three commits. #2133 adds its own entries to the shared lists, and #2142 changesobs-output.c.h, not the encoder. Both rebases applied without conflicts.test_encoder_video_reset(#1109)test_encoding_lag_rescaletest_multitrack_encoder_overridetest_encoder_fallbacktest_encoder_roi(#1964)test_encoder_size_stepsc4ef2fb4d)No ctest test was skipped, and no case inside the focused tests skipped. The same focused set passed on all three lanes on the GREEN commit before the rebase (
2edbee714), and the full ctest passed there too, on2fcea6397(C 441/441, hybrid 454/454, no skips).Real app (UI, protocol output or logging changes): not applicable. The warnings keep their text and their conditions, and nothing else is logged or shown.
Tier 3,
ca6b5f71e(5cec1bea5before the last rebase) (output::encoder_size_parity, 15 tests). Every call runs the shim, the C and the safe core and compares the results exactly: the audio fill and the size field by field, the gate, match and routes as values, and the scaling check as a bool. Runs:UINT32_MAX - 1,UINT32_MAX) on all four, with no cap, the cap and every cap;intextremes and every 65,521stint;inttypes,u32caps (biased to the scaling bit set and clear),u32sizes and sample rates (biased to 0 and the top of the range, and the asked size to the voi's on one axis or both).The parity module passed 10 runs in a row with fresh seeds. The committed regression file holds the seeds proptest saved while mutants failed; all of them pass on the port.
Mutation check (once, not committed; Tier 1 with 35 tests and Tier 3 with 15 in one run): 35 mutants, 24 in the core, 9 in the shims and 2 planted equivalents. All 33 non-equivalent mutants fail.
audio_defaults: format filled when known / rate never filledaudio_defaults: speakers from the mix's formataudio_defaults: rate filled only when the format is also unknownAUDIO_FORMAT_UNKNOWN1cap_override:OBS_ENCODER_CAP_SCALINGas1 << 4/ invertedcap_override: any cap overrides / only the width overriddenscaled_gate: initialized before active / only audio refusedscaled_gate: no initialized check / active ignoredscaled_match: width only / no voi compares 0 x 0 / invertedscaling_enabled: both axes needed / width onlyhas_voialways trueOBS_ENCODER_SIZE_NO_MEDIA0has_voi && w == && h ==Tier 1 does not reach the shims; Tier 3 kills every shim mutant.
Other runs:
uv run ci/local_gate.py --test-diff origin/masteron650d0a5df(the same code before the last rebase): 3412/3412 passed, 4 skipped (the existing#[ignore]tests). Onc4ef2fb4d: 3369/3369, 4 skipped. On2fcea6397, before the rebases: 3340/3340, 4 skipped. All 50output::encoder_size*tests are among them.uv run ci/local_gate.py --lane lintand--lane cross: ok onc4ef2fb4d. The first lint run asked foris_multiple_ofin the bench; that fix is folded into the docs commit.ci/test_build_groups.py,ci/test_ported_sources.py,ci/test_oracle_standins.py,ci/test_sorted_shared_lists.py,ci/test_test_graph_sorted.py,ci/test_cmocka_rust_static_guard.py,ci/test_cmocka_windows_diagnostics.py,ci/test_cmocka_includes.pyandci/test_naming.py: OK on650d0a5df.ci/test_naming.pychecks only crate names, so thenaming.mdentry follows the file-to-crate table convention rather than a check..cmakefiles formatted with gersemi 0.25.0; C with clang-format 22.1.3.obs-encoder.c.h. mp4-mux: Add HLG-compatible HDR signaling to MP4 recordings (experimental, incomplete) #742 (draft, conflicting) adds an unrelated function to the oldobs-encoder.c. libobs: GS_FLIP_U mirrors a sprite instead of drawing it upside down (#2124) #2135 and win-dshow: Undo the device's roll when Autorotation is turned off #2140 meet this PR only in the export lists andtest-graph.json. obs-scene: Port the scene item names and coordinate keys #2129 and obs-core: Port the output frame copy plan and scale effect #2133 did too until they merged; this branch was rebased over them three times. One conflict came up, in therust/README.mdcrate table row next to obs-scene: Port the scene item names and coordinate keys #2129's, and was resolved by hand. After each rebase,source-sets.json,test-graph.json, the unity lists,libobs.pch.hand the three export lists were compared by hand against master: only this PR's lines differ.Windows/macOS: not built there. The core and the shims have no host conditional, the new PCH includes only the new header, and the macOS unexport list has the seven names. The
--lane crosschecks pass.Checklist
master(or the description starts with a Stacked: note)docs/features.mdis added or updated (not applicable: no user-visible change)--test-diffpassed locally; nothing is stamped)-W..., ratchets): built with scripting ON (PR CI builds no OBS app: rungh workflow run ci.yml --ref <branch>for the full builds) and cross-checked with clang and MSVC (not applicable: no warning or flag change)