Skip to content

build(obs-outputs): state the rtmp-hevc record conversions (#2928) - #2929

Closed
zackees wants to merge 1 commit into
masterfrom
fix/2928-rtmp-hevc-conversions
Closed

zackees wants to merge 1 commit into
masterfrom
fix/2928-rtmp-hevc-conversions

Conversation

@zackees

@zackees zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member

Refs #2928.

plugins/obs-outputs/rtmp-hevc.c.h — the three remaining conversions in the HEVC configuration-record writer, stated at their call sites; no flag, pin or target change:

Line Before After
827 s_w8(&s, hvcc.general_profile_space << 6 | hvcc.general_tier_flag << 5 | hvcc.general_profile_idc) the whole expression cast to uint8_t
843 s_w8(&s, hvcc.constantFrameRate << 6 | hvcc.numTemporalLayers << 3 | hvcc.temporalIdNested << 2 | hvcc.lengthSizeMinusOne) same
853 s_w8(&s, (array->array_completeness << 7) | (array->NAL_unit_type & 0x3f)) same

RED (how it fails)

workflow_dispatch of scheduled.yaml on branch fix/2921-mp4-mux-conversions (run 40890899955) fails all three macOS jobs in this file, which that branch does not touch:

Build 🧱 / macOS 🍏 (arm64)           job 123507367938  failure
Build 🧱 / macOS 🍏 (x86_64)          failure
Analyze 🔬 / macOS 🍏 (clang-analyze) failure

[obs-outputs] Compiling obs-outputs.mp4-mux+.h.c
[obs-outputs] Compiling obs-outputs.hevc+.h.c
##[error]implicit conversion loses integer precision: 'int' to 'uint8_t' (aka 'unsigned char') [-Werror,-Wimplicit-int-conversion]
  827 |         s_w8(&s, hvcc.general_profile_space << 6 | hvcc.general_tier_flag << 5 | hvcc.general_profile_idc);
  843 |         s_w8(&s, hvcc.constantFrameRate << 6 | hvcc.numTemporalLayers << 3 | hvcc.temporalIdNested << 2 |
  853 |                 s_w8(&s, (array->array_completeness << 7) | (array->NAL_unit_type & 0x3f));

Local RED, clang 21.1.8 -Wconversion -Wsign-conversion -Wimplicit-int-conversion -Werror, with the old expressions passed to a void s_w8(uint8_t):

oldform2.c:3:53: error: implicit conversion loses integer precision: 'int' to 'uint8_t' [-Werror,-Wimplicit-int-conversion]
oldform2.c:4:82: error: implicit conversion loses integer precision: 'int' to 'uint8_t' [-Werror,-Wimplicit-int-conversion]
oldform2.c:5:40: error: implicit conversion loses integer precision: 'int' to 'uint8_t' [-Werror,-Wimplicit-int-conversion]
3 errors generated.

GREEN (evidence)

The new expressions compile clean under the same flags, and a probe over every reachable input combination of the three fields — 4*2*32, 4*8*2*4 and 2*64 = 640 cases — emits identical bytes:

$ clang -std=c11 -Wall -Wextra -Wconversion -Wsign-conversion -Wimplicit-int-conversion -Werror -o hevc-probe hevc-probe.c && ./hevc-probe
checked=640 mismatches=0 sample: a(3,1,31)=255 b(3,7,1,3)=255 c(1,33)=161

Field widths fit the byte — general_profile_space(2)+general_tier_flag(1)+general_profile_idc(5), constantFrameRate(2)+numTemporalLayers(3)+temporalIdNested(1)+lengthSizeMinusOne(2), array_completeness(1)+NAL_unit_type & 0x3f(6) — so s_w8 was already truncating exactly this.

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

macOS evidence: workflow_dispatch of scheduled.yaml on this branch, run — the three jobs above must be green there, and this stays a draft until they are.

Tiers that do not apply: no Rust unit, C-test or protocol change; test/cmocka/ and the record layout are untouched.

AppleClang with the obs-outputs conversion ratchet (#2872 for #2625)
reports the three `s_w8` byte expressions in the HEVC configuration
record: the uint8_t bitfields promote to int and the store truncates.

Cast each expression to uint8_t at its call site, the same shape #2922
uses for mp4-mux. The field widths fit the byte (2+1+5, 2+3+1+2, 1+6
bits), and a probe over all 640 reachable input combinations emits the
same bytes as the old expressions, so behaviour is unchanged.
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Partial macOS evidence, and why it is partial: workflow_dispatch of scheduled.yaml on this branch, run 40896292520, still fails all three macOS jobs — but on the four mp4-mux.c.h sites that #2922 fixes, because this branch is cut from master before #2922 landed. obs-outputs.hevc+.h.c compiles in that same run with no diagnostics of its own:

[obs-outputs] Compiling obs-outputs.mp4-mux+.h.c
##[error] 4 mp4-mux diagnostics (#2922's four sites)
[obs-outputs] Compiling obs-outputs.hevc+.h.c     # no diagnostics

So the three casts here are not reported by AppleClang any more, but the lane itself cannot be green until #2922 is on master. Once it merges I will rebase onto master, re-dispatch scheduled.yaml and post the full green run before marking this ready.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Closing as superseded, not as a change of mind: the branch is now a subset of what master already carries.

So the three sites #2928 lists are covered by #2925 + #2922 with no duplicate PR in the queue. If #2922 is ejected, reopen this branch rather than re-deriving the change; the two commits here are still valid and CI-green.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Superseded — closing.

origin/master already carries two of the three casts when this PR was cut: 827 and 843 landed in 6c5fd45 (#2925, from #2923's sanitizer follow-up). Only line 853 remained, and #2922 already carries that identical cast ((uint8_t)((array->array_completeness << 7) | (array->NAL_unit_type & 0x3f))) along with the mp4-mux and mp4-output conversions, so there is nothing unique left here.

Evidence that only 853 was outstanding: a branch cut from current origin/master with #2922's three commits plus this PR's commit (cherry-pick applied exactly one line). On it, macOS x86_64 compiles obs-outputs.hevc+.h.c and obs-outputs.mp4-mux+.h.c with no diagnostics (run with #2938's frontend obsModifiers error as the only remaining failure). Details are on #2922.

Closing this and leaving #2928 open until #2922 lands the last cast.

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.

1 participant