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:
1 parent
3bd230767c
commit
9b20da22d8
9 files changed
+533
-214
No files matched your search
@@ -30,7 +30,7 @@ use voelin_stream::{
|
||||
pub use voelin_stream::{
|
||||
Codec, EncodedFrame, EndReason, FrameSource, Frequency, LayerId, LayerSet, LayerSpec,
|
||||
LeaveReason, MediaFrame, MediaKind, MediaTime, PeerConfig, SrtpProfile, StreamInfo, StreamKind,
|
||||
StreamSetup, SyntheticSource, VideoCodec, ViewerInfo, ViewerState,
|
||||
StreamSetup, SyntheticSource, VideoCodec, VideoFormat, ViewerInfo, ViewerState,
|
||||
};
|
||||
|
||||
use crate::audio::{AudioHandle, AudioIn};
|
||||
@@ -92,16 +92,16 @@ impl StreamSink {
|
||||
self.live.load(Ordering::Relaxed) && self.tx.send(StreamInput::Frame(frame)).is_ok()
|
||||
}
|
||||
|
||||
/// Send one video frame encoded in `codec`: only viewers whose answer
|
||||
/// chose `codec` get it.
|
||||
pub fn send_video(&self, frame: EncodedFrame, codec: VideoCodec) -> bool {
|
||||
/// Send one video frame encoded in `format`: only viewers whose answer
|
||||
/// chose that codec (and H.264 profile) get it.
|
||||
pub fn send_video(&self, frame: EncodedFrame, format: VideoFormat) -> bool {
|
||||
self.live.load(Ordering::Relaxed)
|
||||
&& self.tx.send(StreamInput::VideoFrame(frame, codec)).is_ok()
|
||||
&& self.tx.send(StreamInput::VideoFrame(frame, format)).is_ok()
|
||||
}
|
||||
|
||||
/// Whether a viewer's answer chose `codec`.
|
||||
pub fn has_video_codec(&self, codec: VideoCodec) -> bool {
|
||||
self.feedback.has_codec(codec)
|
||||
/// Whether a viewer's answer chose `format`.
|
||||
pub fn has_video_codec(&self, format: VideoFormat) -> bool {
|
||||
self.feedback.has_codec(format)
|
||||
}
|
||||
|
||||
/// Whether a viewer asked for a keyframe of any layer since the last
|
||||
@@ -172,8 +172,8 @@ pub(crate) enum StreamInput {
|
||||
/// SRTP profile order of new connections.
|
||||
SrtpProfiles(Vec<SrtpProfile>),
|
||||
Frame(EncodedFrame),
|
||||
/// A video frame for the viewers that chose its codec.
|
||||
VideoFrame(EncodedFrame, VideoCodec),
|
||||
/// A video frame for the viewers that chose its codec and H.264 profile.
|
||||
VideoFrame(EncodedFrame, VideoFormat),
|
||||
Notification(StreamNotification),
|
||||
RequestFailed(Request, String),
|
||||
/// Clients on the server: channel and `client_is_streaming`.
|
||||
@@ -397,8 +397,8 @@ impl StreamTask {
|
||||
self.streams.write_frame(&frame);
|
||||
Ok(())
|
||||
}
|
||||
StreamInput::VideoFrame(frame, codec) => {
|
||||
self.streams.write_frame_in(&frame, Some(codec));
|
||||
StreamInput::VideoFrame(frame, format) => {
|
||||
self.streams.write_frame_in(&frame, Some(format));
|
||||
Ok(())
|
||||
}
|
||||
StreamInput::Notification(n) => {
|
||||
|
||||
Reference in new issue
Block a user