Skip to content

webrtc: negotiate H.264 High profile when the browser offers it - #62

Merged
Rust-KVM merged 1 commit into
devfrom
claude/video-h264-high-profile
Oct 12, 2026
Merged

Rust-KVM merged 1 commit into
devfrom
claude/video-h264-high-profile

Conversation

@Rust-KVM

Copy link
Copy Markdown
Owner

Requested by 4c · project thread

Summary

Before: mpph264enc emits High profile (level 5.2, 640034), but only a Constrained Baseline H.264 codec was registered, so the SDP answer always labelled the stream 42e01f. Chrome tolerates the mismatch; stricter decoders may not.

After: when the browser offers H.264 High (Chrome, Safari, Edge), the answer negotiates High and the SDP matches what the encoder sends. Offers without High fall back to the existing Constrained Baseline entry as before.

How

webrtc.rs: register a second H.264 codec (payload 106, profile-level-id=640034) next to the Constrained Baseline one, and give the video track the High fmtp so binding prefers the negotiated High payload. This assumes the default encoder profile; a --video-profile override is not reflected in the SDP.

Testing

  • cargo +nightly fmt --all (CI)
  • cargo +nightly clippy --workspace --release --all-targets -- -D warnings (CI)
  • cargo +nightly test --workspace (CI)
  • Frontend touched: not applicable
  • Tested on an RK3588 device: a build with all three video branches (fast first frame, idle without viewer, H.264 High profile) was deployed to the NanoPC-T6 (health ok, 4K60, no WARN/ERROR at startup); video played in Chrome on cold connects and on 6 takeover reconnects, first frame 101–162 ms.

Checklist

  • No #[allow(...)] suppressions and no new unwrap() / expect() in production paths
  • Hot paths stay zero-copy; periodic loops use MissedTickBehavior::Delay
  • Shared protocol types live in rkvm-proto
  • RPC method set changed → not applicable
  • Module tree or build invariants changed → not applicable

Part of a set of three video PRs (#60, #61); merges onto dev together with them without conflicts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PbdzY6PfT28goR4BhqdsXR


Generated by Claude Code

mpph264enc emits High profile (level 5.2, 640034), but only a
Constrained Baseline codec was registered, so the answer always
labelled the stream 42e01f. Chrome tolerates the mismatch; stricter
decoders may not.

Register a High profile H.264 codec alongside the existing Constrained
Baseline one and give the video track the High fmtp, so binding picks
the negotiated High payload when the offer has one (Chrome, Safari,
Edge) and otherwise falls back to the first negotiated H.264 payload as
before. This assumes the default encoder profile; a --video-profile
override is not reflected in the SDP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the area: video GStreamer, MPP encoding, WebRTC media label Oct 12, 2026
@Rust-KVM Rust-KVM self-assigned this Oct 12, 2026
@Rust-KVM
Rust-KVM merged commit 7940ea8 into dev Oct 12, 2026
8 checks passed
@Rust-KVM
Rust-KVM deleted the claude/video-h264-high-profile branch October 12, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: video GStreamer, MPP encoding, WebRTC media

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants