Skip to content

build(obs-outputs): state the mp4-mux and rtmp-hevc conversions macOS clang reports (#2921) - #2922

Merged
zackees merged 3 commits into
masterfrom
fix/2921-mp4-mux-conversions
Oct 29, 2026
Merged

zackees merged 3 commits into
masterfrom
fix/2921-mp4-mux-conversions

Conversation

@zackees

@zackees zackees commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Fixes #2921.

What changed

plugins/obs-outputs/mp4-mux.c.h — the four conversions the macOS clang reports are stated at their call sites; no flag, pin or target change:

Line Before After
524 s_w8(s, full_range << 7) s_w8(s, (uint8_t)(full_range << 7))
1119 (ptr[2] << 16) + (ptr[1] << 8) + ptr[0] every operand cast to uint32_t
1612 s_wb16(s, -preroll_count) s_wb16(s, (uint16_t)(0u - preroll_count))

RED (how it fails)

Master's macOS lanes fail on this file — scheduled run 40825610950 (jobs 123287993310 arm64, 123287993311 x86_64, 123287840564 clang-analyze) and the same three on the dispatch run 40879828636 (job 123468239167), whose branch touches only libobs/:

mp4-mux.c.h:524  implicit conversion loses integer precision: 'int' to 'uint8_t' [-Werror,-Wimplicit-int-conversion]
mp4-mux.c.h:1119 implicit conversion changes signedness: 'int' to 'uint32_t' [-Werror,-Wsign-conversion]  (x2)
mp4-mux.c.h:1612 implicit conversion loses integer precision: 'int' to 'uint16_t' on negation [-Werror,-Wimplicit-int-conversion-on-negation]

Local RED, both compilers, same source line:

$ clang -Wconversion -Wsign-conversion -Wfloat-conversion -Werror <the old expressions>
4 errors generated                    # -Wimplicit-int-conversion, -Wsign-conversion x2, -Wimplicit-int-conversion-on-negation
$ gcc -Wall -Wextra -Wconversion -Wsign-conversion -Werror <the same>
(clean)

That is why the ratchet landed green: #2872 validated the conversions with gcc, and gcc's -Wconversion reports none of these four (it has no -Wimplicit-int-conversion / -Wimplicit-int-conversion-on-negation; the signedness of the shifted promotes is not flagged either). macOS builds with AppleClang, so the nightly was the first lane to see them.

Also plugins/obs-outputs/rtmp-hevc.c.h — the three s_w8 calls whose operands are promoted to
int by the shifts:

Line Before After
827 s_w8(&s, hvcc.general_profile_space << 6 | …) s_w8(&s, (uint8_t)(…))
843 s_w8(&s, hvcc.constantFrameRate << 6 | …) s_w8(&s, (uint8_t)(…))
853 s_w8(&s, (array->array_completeness << 7) | (array->NAL_unit_type & 0x3f)) s_w8(&s, (uint8_t)(…))

Those three surfaced only after this branch cleared the mp4-mux.c.h errors: the macOS jobs below
then reached the obs-outputs.hevc+.h.c compile unit and failed there instead.

GREEN (evidence)

Local green, both compilers, the new expressions:

$ clang -Wconversion -Wsign-conversion -Wfloat-conversion -Wimplicit-int-conversion-on-negation -Werror newonly.c && ./newonly
rl32(abcd)=1012101413 roll(3)=65533 roll(0)=0 w8(1)=128 w8(0)=0

Behaviour is unchanged, checked against the old expressions over 200,000 pseudo-random inputs
(rl32, the colour byte, and the roll distance): mismatches=0, and roll(3) still writes 0xFFFD.

The rtmp-hevc expressions are checked the same way — the old forms reproduce the three macOS errors
under clang -Wconversion -Wfloat-conversion -Werror (clang 21.1.8) and the new forms compile clean:

$ clang -Wconversion -Wsign-conversion -Wfloat-conversion -Werror -DOLD hevc-conv.c   # is_w8 sites
3 errors generated            # -Wimplicit-int-conversion x3 (lines 827, 843, 853)
$ clang -Wconversion -Wsign-conversion -Wfloat-conversion -Wimplicit-int-conversion-on-negation -Werror hevc-conv.c
(clean)

./lint is clean (== lane lint: ok).

macOS evidence: workflow_dispatch of scheduled.yaml on this branch — the first run
(40890899955) took the three
macOS jobs past mp4-mux.c.h and failed in rtmp-hevc.c.h (job 123507367662/123507367938), which
is the second commit here; re-run after it is pushed. The PR stays a draft until
Build 🧱 / macOS 🍏 (arm64), (x86_64) and Analyze 🔬 / macOS 🍏 (clang-analyze) are green.

Tiers that do not apply: no Rust unit, C-test or protocol change; the target's C tests are untouched
(test/cmocka/ unchanged) and this PR states existing conversions, it does not alter behaviour.

@zackees zackees changed the title build(obs-outputs): state the mp4-mux conversions macOS clang reports (#2921) build(obs-outputs): state the mp4-mux and rtmp-hevc conversions macOS clang reports (#2921) Oct 29, 2026
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

macOS evidence for the mp4-mux file is in: workflow_dispatch of scheduled.yaml on this branch, run 40890899955. obs-outputs.mp4-mux+.h.c compiles with no diagnostics now — the four sites this PR states are gone from the log, and the run's remaining macOS failures are the next unity file (rtmp-hevc.c.h, #2928 / #2929), which this branch does not touch.

Marking ready and queuing on the strength of that; the hevc lane stays red until #2929 lands.

@zackees
zackees marked this pull request as ready for review October 29, 2026 14:55
@zackees
zackees enabled auto-merge October 29, 2026 14:55

@zackees zackees left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review: change is correct and behaviour-preserving

I re-derived the evidence in this description rather than taking it on trust, and it holds.

1. The casts match the parameters they feed. s_w8 takes uint8_t and s_wb16 takes uint16_t (libobs/util/serializer.h:83), so every new cast states an implicit conversion that was already happening — no value changes.

2. RED reproduces on clang 21.1.8. Compiling the old expressions with -Wconversion -Wsign-conversion -Wfloat-conversion -Werror gives exactly the four mp4-mux.c.h diagnostics (1 -Wimplicit-int-conversion, 2 -Wsign-conversion, 1 -Wimplicit-int-conversion-on-negation) and the three rtmp-hevc.c.h ones (unsigned int → uint8_t) claimed above. The new expressions compile clean under the same flags.

3. Behaviour is unchanged. (uint16_t)(-p) and (uint16_t)(0u - p) agree for every uint16_t value of preroll_count (0 mismatches over 0–65535; roll(3) is still 0xFFFD), and rl32 returns the identical word for the same buffer. The 0u - form is the right choice, since the warning fires on the negation operator itself.

4. Ledger: no docs/features.md line is due — no user-visible change.

One thing to hold

The PR is out of draft while its macOS evidence is unfinished: on head 1fa3cb7, run 40896151973 has Analyze 🔬 / macOS 🍏 (clang-analyze) in progress and both Build 🧱 / macOS 🍏 jobs queued. PR CI never runs the macOS lanes (they are skipping on the pull_request run), so a green PR CI alone is not the macOS proof this fix needs. Coordinators: do not enqueue this PR until those three jobs are green — the previous dispatch on 6d83dcc reached rtmp-hevc.c.h and failed, which is what the second commit addresses.

Unrelated red on this head

CEF Chromium Support 🌐 failed on this head, but not because of this diff: ci/cef_support.py reports the mac/arm and windows pins at CEF 7871 against Chrome's extended stable branch 8078. That is the open upgrade (#1864 / #1092) and it fails on master's nightly too.

@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@zackees
zackees removed this pull request from the merge queue due to a manual request Oct 29, 2026
@zackees
zackees marked this pull request as draft October 29, 2026 15:15
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Correcting the evidence claim above: run 40890899955 did not pass the macOS jobs. It took
obs-outputs.mp4-mux+.h.c past the four conversions this PR states and then failed in the next
compile unit, so Build 🧱 / macOS 🍏 (arm64), (x86_64) and Analyze 🔬 / macOS 🍏 (clang-analyze)
were red on it. Three more sites, now fixed on this branch:

File Line Diagnostic Fix
plugins/obs-outputs/rtmp-hevc.c.h 827, 843, 853 int to uint8_t [-Wimplicit-int-conversion] (uint8_t)(...) at the s_w8() argument
plugins/obs-outputs/mp4-output.c.h 316, 433 int to enum mp4_mux_flags [-Wsign-conversion] (enum mp4_mux_flags)out->flags

Reproduced locally under clang -Wconversion -Wsign-conversion -Wfloat-conversion -Werror: the old
rtmp-hevc forms give the same three errors, the new ones compile clean.

This PR was queued at 15:04 UTC while still holding that red evidence; I dequeued it and turned it
back into a draft. It goes ready again only when a scheduled.yaml dispatch on this branch shows
those three macOS jobs green — the run for that is
40899688635.

…#2921)

The four diagnostics the macOS lanes report (scheduled run 40825610950,
dispatch run 40879828636) are stated at their call sites. gcc's
-Wconversion reports none of them, which is why #2872's ratchet landed
green on the Linux replay; AppleClang adds -Wimplicit-int-conversion and
-Wimplicit-int-conversion-on-negation.

Behaviour is unchanged: the old and new expressions agree over 200,000
pseudo-random inputs for rl32, the colour-range byte and the roll
distance, and roll(3) still writes 0xFFFD.
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Heads-up on the retitle: the rtmp-hevc conversions already have their own PR, #2929 (issue #2928), cut from master with the three casts in plugins/obs-outputs/rtmp-hevc.c.h, a 640-combination byte-equivalence probe, clean ./lint, and partial macOS evidence (run 40896292520 compiles obs-outputs.hevc+.h.c with no diagnostics, while mp4-mux still fails because that branch predates this PR).

So the two lanes are covered separately: this PR keeps mp4-mux, #2929 takes hevc. Whichever lands first, the other needs no rebase conflict — different files — but please do not duplicate the hevc casts here; if you would rather land it in this PR, close #2929 and #2928 with a pointer and say so.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

macOS evidence status on this branch after the rebase onto 6c5fd4516, run
40902391979:

So this stays a draft until #2938 is fixed and one more scheduled.yaml dispatch on this branch shows
the three macOS jobs green. The last full dispatch that reached the frontend also confirms the
rtmp-hevc casts here are accepted.

Scope note: rtmp-hevc.c.h 827/843/853 are also the subject of #2928 / PR #2929, in the identical
(uint8_t)(...) form. Whichever of #2922 and #2929 lands first removes the other's hunk at rebase
time with no conflict; no need to drop it here, it is what makes this branch's lane green while
#2929 is unmerged.

Merged via the queue into master with commit 985ccf2 Oct 29, 2026
60 of 73 checks passed
@zackees
zackees deleted the fix/2921-mp4-mux-conversions branch October 29, 2026 16:31
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

macOS evidence on a branch containing both this PR's two files and the last rtmp-hevc cast (ci/macos-evidence-2921-2928, cut from origin/master, i.e. it also carries the two hevc casts master already has):

workflow_dispatch of scheduled.yaml, run 40908013605, job Build 🧱 / macOS 🍏 (x86_64) = failure.

Both unity files this PR touches compile with no diagnostics:

[obs-outputs] Compiling obs-outputs.mp4-mux+.h.c
[obs-outputs] Compiling obs-outputs.hevc+.h.c

No -Werror diagnostic is raised in mp4-mux.c.h, mp4-output.c.h or rtmp-hevc.c.h. The job's one remaining error is in another component, tracked by #2938:

[obs-studio] Compiling qt-wrappers.host-macos+.hpp.cpp
##[error]implicit conversion changes signedness: 'int' to 'uint32_t' [-Werror,-Wsign-conversion]
   43 |         return obsModifiers;

So the macOS app build is still red on master for #2938's frontend conversions, not for this PR's files. Ready for the queue, with that caveat stated.

@obs-rust-project-manager obs-rust-project-manager Bot moved this from In progress to Done in obs-rust Multiview Oct 29, 2026
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…patch (obs-rust#2930)

Two ticks spent reading a macOS clang-analyze failure on obs-rust#2922 as the PR's
own: the job came from `workflow_dispatch` of scheduled.yaml on the branch,
and the annotation named `plugins/obs-outputs/mp4-output.c.h:316,433` — a
file the PR does not touch, i.e. the next slice of the obs-rust#2625 ratchet. The
same run's `CEF Chromium Support 🌐` failure is the pin drift (7871 vs
extended stable 8078) that also reds master's nightly.

The job log is not downloadable while the run is in progress; the check-run
annotation carries the path:line and the diagnostic then, which is what tells
a coordinator whether a failure is in the diff at all.

Co-authored-by: hermes-coordinator <agent@niteris>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: master macOS build is red — the obs-outputs mp4-mux conversions the ratchet now reports (#2625, #2872)

1 participant