Files
VoelinClient/crates
faumarayandClaude Opus 5 b541ec8093 voelin-media: tell the H.264 encoders the level the offer advertises
The signalling computes profile-level-id from the stream's size, frame rate
and bitrate, but nothing told the encoder, so every wrapper picked its own
level. Measured on this GPU: h264_amf writes level 4.2 into the SPS of a
720p30 stream whose offer says 3.1, and 5.0 for a 1440p60 stream offered as
5.1. A viewer that sizes its decoder from our SDP can refuse a stream that
declares more than the offer did, which is what breaks official clients.

Compute the level from ITU-T Table A-1 and set it on both the codec context
and the wrapper's private option. A new test parses the SPS of every usable
H.264 backend at two sizes and both profiles and asserts profile_idc against
the offer and level_idc never above it; with the level set, all three
backends now emit exactly the offered level.

The level table is a second copy of the one in voelin-stream, because
neither crate can depend on the other, so a unit test pins them together
over a spread of sizes, rates, bitrates and profiles.

Remaining difference, only in the constraint-flag byte and left alone: the
offer claims Constrained High (0c) and Constrained Baseline (e0) as WebRTC
implementations conventionally do; the VA-API and AMF encoders emit 0c for
the former, libx264 emits 00, and all three emit 40 or c0 for the latter.
The bits do not change what a decoder can decode.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 13:39:37 +03:00
..