Skip to content

build(libobs): state the source frame-copy seam conversions (#2879) - #2900

Merged
zackees merged 12 commits into
masterfrom
fix/2879-macos-frame-copy-seams
Oct 29, 2026
Merged

zackees merged 12 commits into
masterfrom
fix/2879-macos-frame-copy-seams

Conversation

@zackees

@zackees zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member

Refs #2879. Stacked on #2886 (which is stacked on #2897 -> #2892).

Wave 4 of the macOS conversion burn-down. #2892, #2897 and #2886 clear the
libobs-opengl / libobs Cocoa conversions, the enum -> int seams in
obs-scene.c.h / obs-source-deinterlace.c.h and the frontend
-Wsign-conversion opt-in; the nightly dispatched on that whole stack
(run 40850486279, job 123368785769) then stopped on this wave.

RED — the nightly job log

scheduled.yaml on the #2886 head, Build 🧱 / macOS 🍏 (x86_64):

libobs/obs-source.c.h:3167:32: error: implicit conversion changes signedness:
  'const enum video_format' to 'int' [-Werror,-Wsign-conversion]
      new_frame.full_range = obs_source_frame_copy_full_range(frame->format, new_frame.full_range);
libobs/obs-source.c.h:3192:50: error: 'const enum video_range_type' to 'int'
libobs/obs-source.c.h:3263:12: error: 'const enum video_format' to 'int'   (.format = frame->format)
libobs/obs-source.c.h:3308:32: error: 'const enum video_format' to 'int'
libobs/obs-source.c.h:3333:50: error: 'const enum video_range_type' to 'int'
libobs/obs-source.c.h:3407:32: error: 'const enum video_format' to 'int'
libobs/obs-source.c.h:3432:50: error: 'const enum video_range_type' to 'int'

Seven sites, both architectures (arm64 job 123368785586 reports the same
set). The unity build repeats each diagnostic, hence 19 ##[error] lines for
7 distinct call sites. No local RED is possible: this is AppleClang-only and
the Linux replay does not reproduce it, so the CI log above is the RED
evidence and the GREEN is the next nightly on this branch.

GREEN — the change

obs_source_frame_copy_full_range() / _full_range2() take int format /
int range in libobs/obs-source-frame-copy.h, which is public API and stays
int; the same is true of struct obs_source_frame_copy_shape.format.
So the conversion is stated at each of the seven call sites in
libobs/obs-source.c.h ((int)frame->format, (int)frame->range) rather than
changing a public header. No -Wno-*, no pragma, no behaviour change: every
value converted is one of the enum's non-negative constants.

./lint is clean (111 s). This is a warning/flag change, so no
docs/features.md ledger line.

Landing order for the lane: #2892 -> #2897 -> #2886 -> this.

@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.

Review: coordinator tick 2026-10-29

Verdict: the change itself is correct and ready once its lane lands. I cannot queue it yet (see the last section).

What I checked

  • Diff scope. The PR's own commit (e4ac8e5f5) touches one file, libobs/obs-source.c.h, and only the seven call sites named in the description (3167, 3192, 3263, 3308, 3333, 3407, 3432). Each is a stated (int) conversion of frame->format / frame->range, nothing else on the line changed.
  • Public API untouched. libobs/obs-source-frame-copy.h already takes int format / int range (obs_source_frame_copy_full_range, _full_range2) and struct obs_source_frame_copy_shape.format is already int, so casting at the call site is the right seam rather than widening a public header.
  • No behaviour change. Every enum video_format constant is non-negative (VIDEO_FORMAT_NONE = 0 onward) and enum video_range_type is {0,1,2}, so the conversions cannot change a value.
  • No suppression added. No -Wno-*, no pragma, no widening type in the diff — the class stays visible, which is the point of the burn-down.
  • RED → GREEN. RED is the AppleClang-only nightly (scheduled.yaml on the #2886 head, job 123368785769 (x86_64) / 123368785586 (arm64)): seven distinct call sites, repeated by the unity build. It is not reproducible on Linux, so a CI log as RED evidence is the right call here; GREEN is the next nightly on this branch. ./lint clean is claimed and matches the diff shape.
  • Ledger. Warning/flag only, no user-visible change, so no docs/features.md line is correct (coordination.md §4).
  • Stack. Content-wise it is exactly pr2886..pr2900, so once #2886 lands a rebase drops the five carried commits and leaves this one — the stated landing order (#2892 → #2897 → #2886 → this) is right.

Two nits (not blocking, both mechanical)

  1. coordination.md §4 wants the description to start with the stacked form: > **Stacked:** builds on #2886; the new commits are …. Right now it is the second sentence (Refs #2879. Stacked on #2886 …), which a future reader skimming for the base may miss while #2892 and #2897 are still drafts.
  2. #2886 is stacked on #2897, which is stacked on #2892, and #2892/#2897 are still drafts. Four PRs deep, one red nightly re-runs the whole lane; the description already names the order, so this only needs the drafts to be marked ready when their nightly is green.

Why it is not queued

mergeStateStatus is BLOCKED and the PR CI run started at 09:32Z still has Fast Gate, Rust Tier 2 Linux, Qt Frontend Linux and Cross Compile (mac-arm64) pending, so checks is not green yet. It also cannot enter the queue ahead of #2892/#2897/#2886. The coordinator will queue it in the tick after its lane lands and CI is green.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Wave 5 — the macOS lane's next diagnostics, now stated explicitly

Build 🧱 / Rust Tier 2 (macos-26) on e4ac8e5f5 (run 40852111044, job 123382869777) cleared the obs-source.c.h frame-copy seams and stopped on the next wave:

libobs/obs-output.c.h:1084:51 / 1092:58 / 1131:63 / 1189:63
  implicit conversion changes signedness: 'enum obs_encoder_type' to 'int'
libobs/obs-output.c.h:1606:30
  implicit conversion loses integer precision: 'int' to 'uint16_t'
libobs/obs-video-gpu-encode.c.h:254:40
  implicit conversion changes signedness: 'const enum video_format' to 'int'
libobs/obs-video.c.h:122:24
  implicit conversion changes signedness: 'const enum gs_color_space' to 'int'
libobs/obs-video.c.h:267:26
  implicit conversion changes signedness: 'enum obs_scale_type' to 'int'

d62206cd2 states each conversion with an explicit cast at the argument / initializer the compiler already converted implicitly (no value changes, no header edits): the four obs_output_slots_*_type_ok() calls, captionData << 8 back to uint16_t, the render_space / scale_type copy-plan keys, and obs_encoder_gpu_gates_p010((int)info->format).

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Coordinator note for head e4ac8e5f — macOS Tier 2 still stops, but on the next wave of files, not the ones this PR touches.

Build 🧱 / Rust Tier 2 (macos-26), job 123383372128 (run 40852111044), 10:16Z, ** BUILD FAILED **:

libobs/obs-output.c.h:1084:51   enum obs_encoder_type -> int      [-Wsign-conversion]
libobs/obs-output.c.h:1092:58   enum obs_encoder_type -> int
libobs/obs-output.c.h:1131:63   enum obs_encoder_type -> int
libobs/obs-output.c.h:1189:63   enum obs_encoder_type -> int
libobs/obs-output.c.h:1606:30   int -> uint16_t                   [-Wimplicit-int-conversion]
libobs/obs-video-gpu-encode.c.h:254:40  const enum video_format -> int
libobs/obs-video.c.h:122:24    const enum gs_color_space -> int
libobs/obs-video.c.h:267:26    enum obs_scale_type -> int

Eight sites in three headers this PR does not modify, so obs-source.c.h is clear and the burn-down has moved on one wave. Nothing here is a defect in the frame-copy commits; the stack just needs this set stated as well (the obs_encoder_type cluster in obs-output.c.h is the bulk of it).

Not touching the branch — you are mid-series on the stack. No action from this tick beyond recording the list.

The first green attempt still failed: the same #ifdef-only blind spot hides
four more -Wsign-conversion diagnostics (CGLTexImageIOSurface2D takes GLsizei
widths from uint32_t texture fields) and two -Wfloat-conversion ones (CGSize
CGFloat dimensions into device_texture_create's uint32_t). State them at the
call; values unchanged.
The libobs ratchet (#2877) had the same Linux-only replay blind spot: the
macOS Tier 2 lane then reported CFIndex -> size_t (dstr_reserve), obs_key_t ->
int (mouse button index), int -> UInt16 (UCKeyTranslate key code) and
UniCharCount -> CFIndex (CFStringCreateWithCharactersNoCopy). State each at
the call; values unchanged.
-Wsign-conversion on the macOS Tier 2 lane rejects strlen()'s size_t as the
CFIndex byte count; cast at the boundary.
-RED: `Rust Tier 2 (macos-26)` on `07340d52e` + #2887's cocoa fix
(job 123343547757) reports 19 `-Werror,-Wsign-conversion` /
`-Wimplicit-int-conversion` diagnostics in the four Rust seam call
sites below: `enum video_format`, `obs_bounds_type`, `obs_scale_type`,
`obs_blending_method`, `obs_blending_type`, `gs_color_space` and
`obs_deinterlace_mode` passed to a helper the port declares with an
`int` parameter. AppleClang gives an all-non-negative enum an unsigned
underlying type; GCC and Linux clang keep `int`, so #2877's replay of
the same TUs could not see them.

-GREEN: state the conversion at each call site, leaving the seam
signatures and the Rust `c_int` ABI unchanged. Two further sites of the
same class (obs_canvas_draw_technique()/reads_white_level() in
obs.c.h, the deinterlace mode-change call) are cast with them so the
next macOS wave does not re-report the group.

No Rust or cmocka change: no signature moved, and the casts are
behaviour-neutral (the values are enum members, not sentinels).
The next macOS Tier 2 wave after b43279b reports 19 more
'enum -> int' conversions, all in libobs/obs-source.c.h: the monitoring
type fed to obs_source_audio_place_outputs(), the async and sync render
plans' gs_color_space arguments, and src->format into
obs_source_frame_copy_plan().

AppleClang gives all-positive enums an unsigned underlying type; the
seam helpers take int (the Rust c_int ABI carries -1 sentinels), so each
call site is an implicit conversion visible only on Apple platforms.
Cast at each call site; signatures, Rust ABI and tests do not move.
-Wsign-conversion on the macOS lane rejects enum video_format and
enum video_range_type as the int parameters of the frame-copy helpers,
whose signatures are public API (obs-source-frame-copy.h) and stay int.
State the conversion at each of the seven call sites in obs-source.c.h.
…reports (#2879)

The macOS Tier 2 lane on this branch stopped on the next wave after the
obs-source frame-copy seams: encoder-type slots, the CoreAudio caption
shift, the video copy-plan keys and the GPU encode format gate. Explicit
casts only; same values the compiler converted implicitly.
@zackees
zackees force-pushed the fix/2879-macos-frame-copy-seams branch from d62206c to 7bb440c Compare October 29, 2026 10:47
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Wave 6: obs-hotkey-name-map.c.h:110 — return v; from the int lookup into obs_key_t. Now return (obs_key_t)v;, same value. (job 123397093985 on d62206cd2)

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Wave 7: libobs/util/platform-cocoa.m.h — slash - path.array, and the two CFIndex → size_t sizes (bmalloc, dstr_ensure_capacity, dstr_resize). Explicit casts only; the kCFNotFound guard already proves the size positive. (job 123408382271 on 47784e16d)

@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

All 19 required checks are green on 40fec7000 (CI Gate ✅ passing, macOS Rust Tier 2 (macos-26) and Rust Tests 🦀 (macos-26) both green) and the PR is queued (AWAITING_CHECKS).

Summary of this tick's waves, each proven by the macOS lane log then cleared on the next run:

  • d62206cd2 — output/video/gpu-encode seams (obs-output.c.h encoder-type slots + caption shift, obs-video.c.h copy-plan keys, obs-video-gpu-encode.c.h format gate).
  • 47784e16d — obs-hotkey-name-map.c.h int lookup into obs_key_t.
  • 03faee708 — libobs/util/platform-cocoa.m.h: slash - path.array and the CFIndex → size_t sizes.
  • 40fec7000 — the repo's clang-format spacing on those platform-cocoa casts (Fast Gate).

No local-gate stamp on the final commit; Linux Tier 2 (build, tests ON, tests OFF) ran in PR CI on 40fec7000.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator. Full CI is green (CI Gate ✅), PR is rebased on current master, marked ready, and auto-merge is enabled.

MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…t#2946) (obs-rust#2947)

`qt_platform::translate_modifiers()` accumulates `INTERACT_*` flags in an
`int` and returns them as `uint32_t`. AppleClang's `-Wsign-conversion`
(part of the conversion ratchet obs-rust#2872 added for obs-rust#2625) rejects the return
on both macOS app builds and the clang-analyze lane:

    qt-host-macos.cpp.hpp:43:9: error: implicit conversion changes
    signedness: 'int' to 'uint32_t' (aka 'unsigned int')
    [-Werror,-Wsign-conversion]

    return obsModifiers;

The statement is the one the POSIX sibling already carries
(`qt-host-posix.cpp.hpp:47`, `5298ad7ec` for obs-rust#2900): the local stays
`int`, the return states the widening. Every `INTERACT_*` flag is a
non-negative constant, so the returned value is unchanged - all 16
modifier combinations return the same value with and without the cast.

RED: a reduced translation unit with this function's return compiled
under `-Wconversion -Wsign-conversion -Werror` stops on the diagnostic
above. GREEN: the same unit with `static_cast<uint32_t>` compiles, and
the run agrees on all 16 combinations.

Refs obs-rust#2946
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…bs-rust#2923) (obs-rust#2955)

* test(ci): the sanitizer lane a ratchet PR must pay for (obs-rust#2923)

RED: the scope has no sanitizer selection, so a PR that changes a compile
input of a target already in the conversion ratchet runs no asan build and the
diagnostic only that configuration reports reaches master (three times: obs-rust#2869,
obs-rust#2900, obs-rust#2923).

    uv run python -m unittest ci/test_ci_scope.py ci/test_conversion_ratchet.py
    -> TypeError: scope() got an unexpected keyword argument 'ratchet_dirs'
    -> ModuleNotFoundError: No module named 'conversion_ratchet'

The ratchet itself has no reader either: ci/test_conversion_ratchet.py asks for
the directories of the CMakeLists files that name a conversion group.

* ci: a ratchet PR runs the sanitizer lane that would have caught it (obs-rust#2923)

GREEN: ci/conversion_ratchet.py reads the conversion ratchet from the tree it
builds: the directories of the CMakeLists whose own target_compile_options
names a conversion group (the positive spelling; -Wno- keeps the pin and is not
a ratchet entry). ci_scope.py selects a new 'asan' lane for a pull request that
changes a compile input below one of them, and build-project.yaml runs the
existing sanitizers.yaml 'asan' pass for it (workflow_call, allowlisted in
ci.toml).

Pull requests only: the merge queue reruns CI on the merge result (obs-rust#692) and a
sanitizer build there would grow its critical path for every ratcheted change
(obs-rust#2072, obs-rust#2593); a master push and the schedule run the full lane anyway.

The list is read from the PR's own tree, so the PR that adds a target to the
ratchet selects the lane too -- the mechanism the maintainer chose in obs-rust#2923
(option 2, narrowed) over a reviewer checklist that has now failed three times.

---------

Co-authored-by: zackees <[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