Offer H.264 in Constrained High, then Constrained Baseline

A streamer offered H.264 only in Constrained High, which peers whose
decoders list no High profile (headless Chromium's libwebrtc, many other
WebRTC stacks) cannot answer, so an H.264 stream had no way to reach them.

The offer now lists both profiles, best first (PT 112 Constrained High,
PT 108 Constrained Baseline, at the level the stream needs). The answer's
payload type tells the streamer which one the viewer took
(PeerEvent::VideoCodec now carries a VideoFormat: the codec, and H.264
with its profile). The streamer already ran one encoder per codec viewers
chose; it now runs one per format, so a Baseline viewer gets frames from
an encoder in Constrained Baseline, and frames go only to viewers of
their format (LayerFeedback has a bit for it).

voelinctl's FrameSource path offers Constrained High alone, as it cannot
encode per viewer. The browser test now offers the ladder and checks the
SPS profile of what it sent against what the browser chose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 22:45:58 +03:00
1 parent 3bd230767c
commit 9b20da22d8
9 files changed
+533 -214

No files matched your search

+7 -5
View File
@@ -21,9 +21,9 @@ use voelin_core::media::{
};
use voelin_model::ServerFlavor;
use voelin_stream::{
ClientState, EndReason, FrameSource, H264Profile, LayerId, LayerSpec, MediaKind, Output,
PeerConfig, Request, SrtpProfile, StreamEvent, StreamInfo, StreamNotification, StreamSetup,
StreamerEvent, StreamerOptions, Streams, SyntheticSource, VideoCodec, ViewerInfo, WatchEvent,
ClientState, EndReason, FrameSource, LayerId, LayerSpec, MediaKind, Output, PeerConfig,
Request, SrtpProfile, StreamEvent, StreamInfo, StreamNotification, StreamSetup, StreamerEvent,
StreamerOptions, Streams, SyntheticSource, VideoCodec, ViewerInfo, WatchEvent,
};
#[derive(Args, Debug, Clone)]
@@ -192,7 +192,7 @@ pub async fn run(con: &mut Connection, args: &StreamArgs) -> Result<()> {
if *synthetic {
let (w, h) = parse_size(size)?;
let bitrate = u64::from(*bitrate) * 1000;
config.set_h264_format(H264Profile::ConstrainedHigh, w, h, *fps, bitrate);
config.set_h264_format(w, h, *fps, bitrate);
}
}
}
@@ -204,8 +204,10 @@ pub async fn run(con: &mut Connection, args: &StreamArgs) -> Result<()> {
};
if matches!(args.command, StreamCommand::Start { .. }) {
// Frames go out through a `FrameSource`, which does not tell codecs
// apart: offer the stream codec alone.
// apart: offer the stream codec alone, H.264 in the profile it is
// encoded in (Constrained High).
config.video_codecs.truncate(1);
config.h264_profile_level_ids.truncate(1);
}
let codec = stream_codec(&codecs, &config);
let mut driver = Driver { streams: Streams::new(own, config), pending: HashMap::new() };