Skip to content

obs-webrtc: OS name for the WHIP User-Agent behind whip-host.h (#861) - #1257

Merged
zackees merged 2 commits into
masterfrom
facade/861-whip-host
Oct 17, 2026
Merged

zackees merged 2 commits into
masterfrom
facade/861-whip-host

Conversation

@zackees

@zackees zackees commented Oct 17, 2026

Copy link
Copy Markdown
Member

Closes #861.

What moved

generate_user_agent() in plugins/obs-webrtc/whip-utils.h had an #ifdef _WIN64 / __APPLE__ / __OpenBSD__ / __FreeBSD__ / __linux__ && __LP64__ chain that defined OS_NAME. Now it calls whip_host_os_name(), which is declared in the new conditional-free whip-host.h. The pattern is the same as #1248:

  • whip-host-windows.cpp.hpp: sizeof(void *) == 8 ? "Windows x86_64" : "Linux". 32-bit Windows keeps today's fallthrough to "Linux", and a comment says so.
  • whip-host-macos.cpp.hpp: "Mac OS X".
  • whip-host-posix.cpp.hpp: reads uname() sysname. It returns "OpenBSD" or "FreeBSD" for those systems, and otherwise sizeof(void *) == 8 ? "Linux x86_64" : "Linux", which matches the old __linux__ && __LP64__.
  • Each host has its own C++ unity group and PCH (build/obs-webrtc.{windows,macos,posix}+.hpp.cpp, build/obs-webrtc-<os>.pch.hpp). CMakeLists.txt picks the group with $<PLATFORM_ID:...>. The host files are C++ so that every group in the plugin uses the same language.

Baseline delta

I regenerated it with ci/platform_ifdef_ratchet.py --update. One entry is removed: plugins/obs-webrtc/whip-utils.h: 5. No entries were added.

Tests

There is a new cmocka test, test/cmocka/test_whip_host_os_name.cpp, registered in tests.d. It builds the posix host on its own. It asserts that on Linux the host returns exactly "Linux x86_64" (64-bit), and that the string matches the uname family.

  • RED (ed32504, posix stub returns ""): rust/tools/linux-validate/run.sh --repeat 1 --tests test_whip_host_os_name shows test_whip_host_os_name ***Failed (both cases), 1 failure out of 280.
  • GREEN (85543d6): the same command passes 280/280, and the repeat run passes in both builds.
  • ./lint passes (rc=0).

The Windows and macOS hosts have not been compiled locally; PR CI is the first build of them. ci/ci_scope.py origin/master on this branch gives macos=true windows=true tier2=true linux_targets=obs-webrtc.

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.

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

1 participant