Skip to content

Fix macOS RTP endian macro mapping - #269

Open
idy wants to merge 1 commit into
sepfy:mainfrom
h2vivi:codex/fix-macos-rtp-endian
Open

Fix macOS RTP endian macro mapping#269
idy wants to merge 1 commit into
sepfy:mainfrom
h2vivi:codex/fix-macos-rtp-endian

Conversation

@idy

@idy idy commented Aug 2, 2026

Copy link
Copy Markdown

Summary

  • map the endian macros exported by <machine/endian.h> to the underscored identifiers used by libpeer's RTP bit-field selector
  • keep the current RTP layout and all non-Apple preprocessing unchanged
  • provide a minimal alternative to the broader explicit serialization change in Fix RTP header wire serialization #267

Root cause

On macOS, BYTE_ORDER, BIG_ENDIAN, and LITTLE_ENDIAN are defined, but __BYTE_ORDER, __BIG_ENDIAN, and __LITTLE_ENDIAN are not. Undefined identifiers in the RTP #if expression evaluate as zero, so the big-endian bit-field layout is selected and an Opus RTP v2/PT111 header starts with 02 de instead of 80 6f.

Validation

  • compiled src/rtp.c with a strict (-Wall -Wextra -Werror) RTP wire regression on AppleClang
  • confirmed the regression fails on upstream main at the expected first-byte assertion and passes with this change
  • attempted the full CMake build; local dependency builds are blocked independently by obsolete cJSON/usrsctp CMake policies and existing mbedTLS documentation warnings promoted to errors by the current AppleClang

Fixes #268

The Apple endian header exposes non-underscored macro names while the RTP
bit-field selector reads underscored names, selecting the wrong layout.

- Map the Apple byte-order macro to the identifier used by RTP
- Map both endian constants so the existing comparisons remain valid
- Leave non-Apple preprocessing and RTP layout unchanged

Fixes sepfy#268

Generated with [Codex](https://github.com/openai)
@Pie8851 Pie8851 mentioned this pull request Aug 2, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RTP header selects the wrong bit-field layout on macOS

1 participant