Skip to content

build(obs-ffmpeg): drop the conversion pins from the target (#2625) - #2865

Merged
zackees merged 2 commits into
masterfrom
infra/2625-conversion-obs-ffmpeg
Oct 29, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/2625-conversion-obs-ffmpeg

Conversation

@zackees

@zackees zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member

Slice of #2625: the conversion groups on obs-ffmpeg, with every conversion in the target's own translation units fixed at the call site.

RED 07c1a9555 adds the three -W*conversion enablers to the obs-ffmpeg target only. Replaying the target's 14 Tier 2 translation units (its 8 unity TUs plus the two shared/media-playback unity TUs it compiles in) from the build tree's compile database, with the global -Wno-conversion / -Wno-sign-conversion / -Wno-float-conversion pins dropped, reports 109 diagnostics in 12 files:

file findings
obs-ffmpeg-srt.h 23
obs-ffmpeg-mpegts.c.h 18
obs-ffmpeg-output.c.h 17
obs-ffmpeg-vaapi.c.h 14
obs-ffmpeg-mux.c.h 10
obs-ffmpeg-video-encoders.c.h 10
obs-ffmpeg-audio-encoders.c.h 7
obs-ffmpeg-rist.h 3
obs-ffmpeg-source.c.h 2
obs-ffmpeg-av1.c.h 2
obs-ffmpeg-openh264.c.h 2
obs-ffmpeg-host-linux.c.h 1

84 were -Wsign-conversion, 25 -Wconversion.

GREEN 92c494ef7 states each one at its boundary:

  • srt.h: the 18 strtol option reads are int fields, the address length libsrt takes is an int, and the session-summary percentages are computed in double.
  • mpegts/output/vaapi/video-encoders: the AVRational fields and the encoder width/height, and the gop expression is int arithmetic now (keyint_sec * (int)voi->fps_num / (int)voi->fps_den) so the unsigned fps fields no longer promote it; the sizes handed to av_malloc/calloc/memcpy/av_memdup/da_copy_array/obs_extract_*_headers.
  • vaapi: the exported surface handle is a VASurfaceID, and the DRM fourcc passed to drm_to_gs_color_format (an int parameter) is explicit.
  • rist/source/mux/audio-encoders/av1/openh264: payload sizes, the pointer difference into dstr_resize, and the packet/hdr sizes.
  • shared/media-playback (compiled into this target, so it inherits the flags): the cache and frame timestamps keep int64 arithmetic and convert once at the assignment, and the uint32/uint64 frame fields, next_ns accumulations and line sizes are explicit.

Every cast keeps the value the code already computed; there is no pragma and no per-file -Wno-*.

Evidence

  • Replay after the fix: 0 findings in the same 14 translation units (ci/warning_findings.py --language all, compdb of the configured tree, three pins dropped; the only residue is -Wpedantic: ISO C forbids an empty translation unit on the generated cmake_pch.h.c stub, which the real build compiles as -x c-header).
  • From-scratch target build in obs-rust-linux-validate:e756cdba69646bd5 at this tip (all obs-ffmpeg objects deleted first): ninja obs-ffmpeg → RC=0, 0 warning: lines, 0 error: lines, obs-ffmpeg.so linked.
  • ./lint clean (clang-format, gersemi, the repo Dylints).

PCH note for the next slice: enabling the groups on obs-ffmpeg also exposes the two shared/media-playback unity TUs, because this target compiles that shared code in; a replay that selects files by the plugin's own path misses 24 of the 109.

The global pins stay until every target is ratcheted; this slice only removes them from this target's flag list. Windows uses MSVC, which the generator expression does not match, so this target's MSVC ratchet is unchanged.

Refs #2625. No docs/features.md line: build tooling only.

RED: the target now compiles with -Wconversion, -Wsign-conversion and
-Wfloat-conversion instead of inheriting the global -Wno-* pins. The
Tier 2 replay of the target's 8 unity TUs reports 109 diagnostics
(-Wsign-conversion 84, -Wconversion 25) across 12 files.
GREEN: the 109 diagnostics the RED commit exposed are stated at their
boundaries, and the target's 12 translation units replay clean with the
three groups on.

- srt.h: the 18 strtol option reads are int fields; the sockaddr length
  libsrt takes as int; the session-summary percentages are double.
- mpegts/output/vaapi/video-encoders: the AVRational fields, the
  encoder dimensions, the gop expression (int arithmetic now, so the
  unsigned fps fields no longer promote it) and the size arguments.
- vaapi: the surface handle is a VASurfaceID, and the DRM fourcc the
  colour-format helper takes as int.
- rist/source/mux/audio-encoders/av1/openh264: payload sizes, pointer
  differences, timestamps and the H.264/AV1 header sizes.
- shared/media-playback (compiled into this target): the cache and
  frame timestamps keep int64 arithmetic and convert once at the
  assignment; the size and line-size fields are explicit.

No behaviour change: every cast keeps the value the code already
computed. The global -Wno-conversion / -Wno-sign-conversion /
-Wno-float-conversion stay until every target is ratcheted.
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

#2865 is green: Fast Gate ⚡, Format 🔍 / checks, CI Gate ✅, every Rust Tier 2 Linux job, Validate Data 🕵️ and CI Mode 🛂 passed, and the PR is queued in master's merge queue. Local evidence in the PR body: the zero-finding replay of the target's 14 translation units with the three groups on, a from-scratch ninja obs-ffmpeg in obs-rust-linux-validate:e756cdba69646bd5 at the exact tip (RC=0, 0 warning/error lines, obs-ffmpeg.so linked), and ./lint.

One coverage gap, stated rather than hidden: this target's plugin TUs are not built by PR CI, so the macOS AppleClang side of the same sources was not exercised by a lane in this tick. The two macOS/Windows-only host files in the target are 11 and 14 lines and the Windows/MSVC path is untouched by the generator expression (it matches GNU/Clang/AppleClang only), so the release lane is the first place a AppleClang-only diagnostic could appear — the same standing gap the previous slices recorded.

Claim continues; the next target is obs-outputs proper (the rtmp/mp4 muxers).

Merged via the queue into master with commit 5c3a91b Oct 29, 2026
39 checks passed
@zackees
zackees deleted the infra/2625-conversion-obs-ffmpeg branch October 29, 2026 05:45
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…ed (obs-rust#2870)

obs-rust#2865 turned on -Wconversion/-Wsign-conversion/-Wfloat-conversion for the
obs-ffmpeg target and fixed the 109 diagnostics its Linux replay reported, but
that replay cannot see two macOS-only diagnostics: the plugin target is not
built in the Linux Tier 2 tree, and clang (with the Xcode warning set and
CMAKE_COMPILE_WARNING_AS_ERROR) reports both as errors. The nightly Scheduled
run 40825610950 at 5c3a91b is red in `Build macOS (x86_64)` and
`Analyze macOS (clang-analyze)` because of them:

- obs-ffmpeg-rist.h:175 passes RISTContext::profile (an int field holding
  RIST_PROFILE_MAIN) to rist_sender_create(), which takes enum rist_profile.
- obs-ffmpeg-source.c.h:437 assigns obs_data_get_int() (a long long) to
  `enum video_range_type range`.

Both keep the value the code already computed; no -Wno-* pin returns.

Fixes obs-rust#2869

Co-authored-by: Hermes Agent <[email protected]>
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