[codex] reject unsupported enhanced RTMP codecs#2017
Draft
kixelated wants to merge 2 commits into
Draft
Conversation
There was a problem hiding this comment.
Sorry @kixelated, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
e9dbcbe to
8e676bd
Compare
kixelated
commented
Jul 3, 2026
| #[non_exhaustive] | ||
| pub struct EnhancedCodecs { | ||
| /// The enhanced video FourCC, if the selected video rendition needs one. | ||
| pub video: Option<[u8; 4]>, |
Collaborator
Author
There was a problem hiding this comment.
Maybe make a FourCC type?
Co-Authored-By: GPT-5 <codex@openai.com>
8e676bd to
1fab896
Compare
Collapse the client-capability model and play-accept path added for rejecting
unsupported enhanced-RTMP codecs on playback:
- ClientCapabilities (6 fields) -> ClientCodecs { video, audio } backed by a
small Support enum (None/Any/Only). Drops the any_* flags, the combined
fourcc_list, push_unique, and the is_empty() special-case.
- Merge the two header-waiting tokio::select! blocks in Play::accept into one:
pull the first FLV chunk (resolves the header), then read codecs synchronously
via enhanced_codecs() before Play.Start.
- Rename ConnectCapabilitiesParser -> ConnectSniffer; it owns its parsed result.
- Honor only CanDecode (a terminal player can't render CanForward/CanEncode).
- Drop poll_enhanced_codecs from moq-mux's public API (keep async
enhanced_codecs).
- Revert the unrelated just --fmt justfile churn.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 3, 2026
kixelated
added a commit
that referenced
this pull request
Jul 3, 2026
…a private module) Advertise the codecs moq-rtmp can ingest in the RTMP connect _result, so a well-behaved enhanced encoder knows it may send HEVC/AV1/VP9/Opus/etc. This is the server-side counterpart to the play-side codec gating in #2017. moq-rtmp is built on rml_rtmp, which is unmaintained (last release 2023-04-29) and hard-codes the connect _result with no hook to inject properties. No maintained pure-Rust RTMP library exposes both the connect object and _result customization, and every alternative is a large tokio-locked rewrite that would still need a fork for _result injection. So vendor rml_rtmp 0.8.0 directly into moq-rtmp as a private `rml` module (not a separate published crate: moq-rtmp is published, so a `[patch.crates-io]` fork would ship a broken crate to consumers). The vendor carries one additive patch, `ServerSession::set_connect_response_properties`, which merges caller-supplied name-value pairs into the connect _result command object (empty by default = byte-identical to upstream). Porting the edition-2015 source into moq-rtmp's edition-2024 crate needed three mechanical fixes: `crate::rml::` path prefixes, `r#gen` for the now-reserved keyword, and dropping explicit `ref` under the new match ergonomics. The module opts out of the workspace -D warnings gate at its root; MIT preserved (see src/rml/LICENSE); upstream's 168 tests come along. On connect, moq-rtmp advertises the FLV importer's accepted FourCCs (avc1/hvc1/av01/vp09, Opus/mp4a/.mp3/ac-3/ec-3) as videoFourCcInfoMap / audioFourCcInfoMap, each flagged CanForward (the gateway demuxes FLV into MoQ, it doesn't decode). A wire-level test drives a raw client through handshake + connect and deserializes the server's _result to confirm the maps arrive.
kixelated
added a commit
that referenced
this pull request
Jul 3, 2026
…a private module) Advertise the codecs moq-rtmp can ingest in the RTMP connect _result, so a well-behaved enhanced encoder knows it may send HEVC/AV1/VP9/Opus/etc. This is the server-side counterpart to the play-side codec gating in #2017. moq-rtmp is built on rml_rtmp, which is unmaintained (last release 2023-04-29) and hard-codes the connect _result with no hook to inject properties. No maintained pure-Rust RTMP library exposes both the connect object and _result customization, and every alternative is a large tokio-locked rewrite that would still need a fork for _result injection. So vendor rml_rtmp 0.8.0 directly into moq-rtmp as a private `rml` module (not a separate published crate: moq-rtmp is published, so a `[patch.crates-io]` fork would ship a broken crate to consumers). The vendor carries one additive patch, `ServerSession::set_connect_response_properties`, which merges caller-supplied name-value pairs into the connect _result command object (empty by default = byte-identical to upstream). Porting the edition-2015 source into moq-rtmp's edition-2024 crate needed three mechanical fixes: `crate::rml::` path prefixes, `r#gen` for the now-reserved keyword, and dropping explicit `ref` under the new match ergonomics. The module opts out of the workspace -D warnings gate at its root; MIT preserved (see src/rml/LICENSE); upstream's 168 tests come along. On connect, moq-rtmp advertises the FLV importer's accepted FourCCs (avc1/hvc1/av01/vp09, Opus/mp4a/.mp3/ac-3/ec-3) as videoFourCcInfoMap / audioFourCcInfoMap, each flagged CanForward (the gateway demuxes FLV into MoQ, it doesn't decode). A wire-level test drives a raw client through handshake + connect and deserializes the server's _result to confirm the maps arrive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
connectcommand beforerml_rtmpdrops the raw AMF properties (it keeps onlyapp, so a second deserializer sniffs the connect object).NetStream.Play.Failedwhen the selected broadcast needs enhanced FourCC codecs the client did not advertise it can decode (CanForward/CanEncodedon't let a terminal player render).moq-rtmpcan check the muxed audio/video FourCCs before sendingNetStream.Play.Start.Fixes #2007.
Public API Changes
moq_mux::container::flv::EnhancedCodecs.Export::enhanced_codecs(async).Additive and non-breaking. No wire-protocol changes.
Follow-ups (not in this PR)
capsEx) in the connect_resultcommand object so an enhanced encoder will send E-RTMP on ingest.rml_rtmp0.8 hard-codes the_resultand keeps its serializer private, so this needs a smallrml_rtmpfork/patch to inject connect-response properties.Validation
cargo test -p moq-rtmp(20) +cargo test -p moq-mux(337) passcargo clippy -p moq-rtmp -p moq-mux --all-targetscleancargo fmtcleanHistory
The second commit simplifies the first: collapses the 6-field client-capability struct to
ClientCodecs { video, audio }over a smallSupportenum, merges the two header-waitingselect!blocks inPlay::acceptinto one, renames the connect parser toConnectSniffer, tightens the gate toCanDecode, dropspoll_enhanced_codecsfrom the public API, and reverts the unrelatedjust --fmtjustfile churn.(Written by GPT-5; simplification commit and this update written by Claude Opus 4.8)