feat: relative broadcast paths for cross-broadcast catalog renditions#1371
Draft
kixelated wants to merge 2 commits into
Draft
feat: relative broadcast paths for cross-broadcast catalog renditions#1371kixelated wants to merge 2 commits into
kixelated wants to merge 2 commits into
Conversation
Contributor
WalkthroughThis change adds an optional per-rendition broadcast reference to audio and video configs and implements path utilities to normalize and resolve relative broadcast strings. Runtime code (Broadcast.trackBroadcast and updated decoder/MSE codepaths) now resolves and caches override broadcasts and falls back to the catalog broadcast when absent or self-referential. Importers populate the new field as None by default. Rust and JS tests exercise normalization, resolution, serialization, and subscription behavior. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
A hang catalog rendition can now set an optional `broadcast` field, a path relative to the broadcast that served the catalog (e.g. "../source"), pointing at the broadcast that actually publishes the track. A transcoder can then publish a sidecar catalog that adds new renditions while pointing unchanged ones at the original broadcast instead of re-publishing the bytes. - moq-net: new PathRelative type (normalized, ".."-capable, serde-only) and Path::resolve. Mirrored in @moq/net as Path.normalizeRelative/Path.resolve. - hang / @moq/hang: optional `broadcast` field on VideoConfig and AudioConfig. - moq-mux: new Source type bundling the catalog BroadcastConsumer with optional (OriginConsumer, path) context. Exporters take `impl Into<Source>` (bare BroadcastConsumer still works via From) and the shared ExportSource resolves per-rendition references via OriginConsumer::request_broadcast. - moq-cli subscribe, moq-srt egress, and moq-hls pass their origin through. - @moq/watch: Broadcast.trackBroadcast() resolves the reference against the broadcast name and consumes the resolved path on the same connection, caching one subscription per referenced broadcast; wired into the audio and video decoder and MSE pipelines. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
be48c4c to
87b2f9b
Compare
…-917897 # Conflicts: # js/watch/src/broadcast.ts # rs/moq-cli/src/main.rs # rs/moq-cli/src/subscribe.rs # rs/moq-hls/src/export/mod.rs # rs/moq-hls/src/export/rendition.rs # rs/moq-mux/src/codec/h264/export.rs # rs/moq-mux/src/container/fmp4/export.rs # rs/moq-mux/src/container/mkv/export.rs # rs/moq-mux/src/lib.rs # rs/moq-srt/src/ts.rs
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
Rewritten from scratch against
dev(the original main-based implementation predated the moq-mux catalog machinery and the js/watch rework) and now hooked up end to end on the consumer side.A rendition in a hang catalog can set an optional
broadcastfield: a path relative to the broadcast that served the catalog (e.g."../source"), pointing at the broadcast that actually publishes the track. A transcoder can then publish a sidecar catalog that adds new renditions while pointing unchanged ones at the original broadcast, instead of re-publishing those bytes.Schema / path math
moq-net: newPathRelativetype (trims slashes, drops.segments, preserves..; serde only, never on the announce/subscribe wire) andPath::resolvewith excess-..clamping. Mirrored in@moq/netasPath.normalizeRelative/Path.resolveso both sides agree byte-for-byte.hang/@moq/hang: optionalbroadcastfield onVideoConfigandAudioConfig(skipped when unset, so existing catalogs are byte-identical).Consumer wiring (the new part)
moq-mux: newSourcetype bundling the catalogBroadcastConsumerwith optional(OriginConsumer, path)context, built viaSource::new(broadcast).with_origin(origin, path). All exporters (fmp4, mkv, ts, flv, h264, h265) now takeimpl Into<Source>; a bareBroadcastConsumerstill compiles viaFrombut fails with a clearError::MissingOriginif a catalog actually references another broadcast. The sharedExportSourceresolves the reference and fetches the broadcast viaOriginConsumer::request_broadcast(announced broadcasts resolve immediately;OriginDynamichandlers serve the rest). Self-references and empty resolutions reuse the catalog broadcast instead of opening a duplicate subscription.moq-cli subscribe,moq-srtegress, andmoq-hlspass their origin through, so all three honor cross-broadcast renditions.@moq/watch:Broadcast.trackBroadcast(effect, rel)resolves the reference against the broadcast name and consumes the resolved path on the same connection, caching one subscription per referenced broadcast (shared across renditions, gated on the same reload/announced logic). Wired into the audio + video decoder and MSE pipelines.Public API changes
moq_net::{PathRelative, PathRelativeOwned},moq_net::Path::resolve,moq_mux::Source,moq_mux::Error::MissingOrigin,hang::catalog::{VideoConfig,AudioConfig}::broadcast,@moq/netPath.resolve/Path.normalizeRelative,@moq/hangRelativeBroadcastSchema,@moq/watchBroadcast.trackBroadcast.dev): moq-mux exporter constructors andmoq_hls::Broadcaster::newnow takeimpl Into<Source>(source-compatible for callers passing aBroadcastConsumerby value);moq-cli'sSubscribe::newlikewise; catalog format gains an optional field.Not covered (follow-ups)
moq-ffi(and the py/swift/kt/go wrappers) andmoq-gst/moq-rtcconsume tracks from a bareBroadcastConsumerand don't resolve references yet; they need origin context plumbed the same way.conn.consume(path)in JS.dev:Cargo.lockis stale w.r.t. thenvidia-video-codec-sdkgit dep (cargo metadata --lockedfails before this PR too); left untouched here.Test plan
PathRelativenormalization +Path::resolveunit tests (Rust and JS mirrors)Nonestays off the wire, empty string normalizes (Rusthang+@moq/hangzod)moq_mux::Sourceunit tests: no-override, missing-origin error, self-reference reuse, override resolving through a live originjust check(full Rust + JS suites, clippy, fmt, rustdoc, biome)room/source, publish a sidecar catalog withbroadcast: "../source", verify@moq/watchandmoq subscribepull the track from the source broadcast(Written by Claude Fable 5)
🤖 Generated with Claude Code