Skip to content

facade: plugins/obs-webrtc: move 5 platform conditionals behind a per-platform layer #861

Closed

Description

@zackees

Inventory of platform conditionals in plugins/obs-webrtc/whip-utils.h (5 branches of one #ifdef chain, lines 61-69).

lines macro what the branch does
61 _WIN64 OS_NAME = "Windows x86_64"
63 __APPLE__ OS_NAME = "Mac OS X"
65 __OpenBSD__ OS_NAME = "OpenBSD"
67 __FreeBSD__ OS_NAME = "FreeBSD"
69 __linux__ && __LP64__ OS_NAME = "Linux x86_64" (else "Linux")

Proposed facade

const char *whip_platform_os_name(void) in whip-platform-windows.c, -mac.c, -nix.c; the User-Agent builder calls it. A cheaper alternative is a single obs_get_os_name() style helper in libobs/util shared by other plugins (check libobs for an existing one before adding).

Likely must stay

Nothing, though this is a low-value move: pure string selection. Do it as a starter task. CMake OS_WINDOWS (CMakeLists.txt:21) stays.

Test approach

Behaviour-preserving moves. Verify with: the plugin's native builds on each platform (ci-full label, since these are outside the quick gate), the existing cmocka tests where the moved function is testable, and ./lint. Where a facade function is pure (path/name/constant selection) add a small unit test per platform implementation. The #847 ratchet lint baseline must go down by the count moved.

Part of #847.

Activity

  1. zackees commented on Oct 17, 2026

    @zackees
    MemberAuthor

    Claiming. whip-host.h (const char *whip_host_os_name(void)) with whip-host-{windows,macos,posix} implementations in per-OS groups, same shape as #1248. The posix host picks Linux/FreeBSD/OpenBSD from uname() at run time instead of compile-time macros, keeping today's strings exactly (64-bit Linux → Linux x86_64, anything else → Linux; Windows 64-bit → Windows x86_64). Test: the posix host on Linux returns the same string the old chain produced.

  2. added
    claimed
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions