Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions doc/concept/layer/hang.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ Here is Big Buck Bunny's `catalog.json` as of 2026-02-02:
"codedHeight": 720,
"container": "legacy"
}
},
"priority": 1
}
},
"audio": {
"renditions": {
Expand All @@ -44,8 +43,7 @@ Here is Big Buck Bunny's `catalog.json` as of 2026-02-02:
"bitrate": 283637,
"container": "legacy"
}
},
"priority": 2
}
}
}
```
Expand Down
5 changes: 0 additions & 5 deletions js/hang/src/catalog/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { u53Schema } from "./integers";
// Backwards compatibility: old track schema
const TrackSchema = z.object({
name: z.string(),
priority: z.number().int().min(0).max(255),
});

// Mirrors AudioDecoderConfig
Expand Down Expand Up @@ -46,9 +45,6 @@ export const AudioSchema = z
// A map of track name to rendition configuration.
// This is not an array so it will work with JSON Merge Patch.
renditions: z.record(z.string(), AudioConfigSchema),

// The priority of the audio track, relative to other tracks in the broadcast.
priority: z.number().int().min(0).max(255),
})
.or(
// Backwards compatibility: transform old {track, config} format to new object format
Expand All @@ -59,7 +55,6 @@ export const AudioSchema = z
})
.transform((old) => ({
renditions: { [old.track.name]: old.config },
priority: old.track.priority,
})),
);

Expand Down
1 change: 0 additions & 1 deletion js/hang/src/catalog/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ import { z } from "zod";

export const TrackSchema = z.object({
name: z.string(),
priority: z.number().int().min(0).max(255),
});
export type Track = z.infer<typeof TrackSchema>;
5 changes: 0 additions & 5 deletions js/hang/src/catalog/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { u53Schema } from "./integers";
// Backwards compatibility: old track schema
const TrackSchema = z.object({
name: z.string(),
priority: z.number().int().min(0).max(255),
});

// Based on VideoDecoderConfig
Expand Down Expand Up @@ -62,9 +61,6 @@ export const VideoSchema = z
// This is not an array in order for it to work with JSON Merge Patch.
renditions: z.record(z.string(), VideoConfigSchema),

// The priority of the video track, relative to other tracks in the broadcast.
priority: z.number().int().min(0).max(255),

// Render the video at this size in pixels.
// This is separate from the display aspect ratio because it does not require reinitialization.
display: z
Expand Down Expand Up @@ -95,7 +91,6 @@ export const VideoSchema = z
const config = arr[0]?.config;
return {
renditions: Object.fromEntries(arr.map((item) => [item.track.name, item.config])),
priority: arr[0]?.track.priority ?? 128,
display:
config?.displayAspectWidth && config?.displayAspectHeight
? { width: config.displayAspectWidth, height: config.displayAspectHeight }
Expand Down
1 change: 0 additions & 1 deletion js/hang/src/publish/audio/encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ export class Encoder {

const catalog: Catalog.Audio = {
renditions: { [Encoder.TRACK]: config },
priority: Encoder.PRIORITY,
};

effect.set(this.#catalog, catalog);
Expand Down
2 changes: 1 addition & 1 deletion js/hang/src/publish/chat/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class Message {
const enabled = effect.get(this.enabled);
if (!enabled) return;

effect.set(this.catalog, { name: Message.TRACK, priority: Message.PRIORITY });
effect.set(this.catalog, { name: Message.TRACK });
});
}

Expand Down
2 changes: 1 addition & 1 deletion js/hang/src/publish/chat/typing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class Typing {
const enabled = effect.get(this.enabled);
if (!enabled) return;

effect.set(this.catalog, { name: Typing.TRACK, priority: Typing.PRIORITY });
effect.set(this.catalog, { name: Typing.TRACK });
});
}

Expand Down
2 changes: 1 addition & 1 deletion js/hang/src/publish/location/peers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Peers {
const enabled = effect.get(this.enabled);
if (!enabled) return;

effect.set(this.catalog, { name: Peers.TRACK, priority: Peers.PRIORITY });
effect.set(this.catalog, { name: Peers.TRACK });
});
}

Expand Down
2 changes: 1 addition & 1 deletion js/hang/src/publish/location/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class Window {

effect.set(this.catalog, {
initial: this.position.peek(),
track: { name: Window.TRACK, priority: Window.PRIORITY },
track: { name: Window.TRACK },
handle: effect.get(this.handle),
});
});
Expand Down
2 changes: 1 addition & 1 deletion js/hang/src/publish/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class Preview {

this.signals.effect((effect) => {
if (!effect.get(this.enabled)) return;
effect.set(this.catalog, { name: Preview.TRACK, priority: Preview.PRIORITY });
effect.set(this.catalog, { name: Preview.TRACK });
});
}

Expand Down
1 change: 0 additions & 1 deletion js/hang/src/publish/video/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export class Root {

const catalog: Catalog.Video = {
renditions,
priority: Root.PRIORITY,
display: {
width: Catalog.u53(display.width),
height: Catalog.u53(display.height),
Expand Down
4 changes: 2 additions & 2 deletions js/hang/src/watch/chat/message.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type * as Moq from "@moq/lite";
import { Effect, type Getter, Signal } from "@moq/signals";
import type * as Catalog from "../../catalog";
import * as Catalog from "../../catalog";

export interface MessageProps {
// Whether to start downloading the chat.
Expand Down Expand Up @@ -43,7 +43,7 @@ export class Message {
if (!values) return;
const [_, catalog, broadcast] = values;

const track = broadcast.subscribe(catalog.name, catalog.priority);
const track = broadcast.subscribe(catalog.name, Catalog.PRIORITY.chat);
effect.cleanup(() => track.close());

// Undefined is only when we're not subscribed to the track.
Expand Down
4 changes: 2 additions & 2 deletions js/hang/src/watch/chat/typing.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type * as Moq from "@moq/lite";
import { Effect, type Getter, Signal } from "@moq/signals";
import type * as Catalog from "../../catalog";
import * as Catalog from "../../catalog";

export interface TypingProps {
// Whether to start downloading the chat.
Expand Down Expand Up @@ -41,7 +41,7 @@ export class Typing {
if (!values) return;
const [_, catalog, broadcast] = values;

const track = broadcast.subscribe(catalog.name, catalog.priority);
const track = broadcast.subscribe(catalog.name, Catalog.PRIORITY.typing);
effect.cleanup(() => track.close());

effect.spawn(async () => {
Expand Down
2 changes: 1 addition & 1 deletion js/hang/src/watch/location/peers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class Peers {
if (!values) return;
const [_, catalog, broadcast] = values;

const track = broadcast.subscribe(catalog.name, catalog.priority);
const track = broadcast.subscribe(catalog.name, Catalog.PRIORITY.location);
effect.cleanup(() => track.close());

effect.spawn(this.#runTrack.bind(this, track));
Expand Down
2 changes: 1 addition & 1 deletion js/hang/src/watch/location/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class Window {
const updates = effect.get(this.#catalog)?.track;
if (!updates) return;

const track = broadcast.subscribe(updates.name, updates.priority);
const track = broadcast.subscribe(updates.name, Catalog.PRIORITY.location);
effect.cleanup(() => track.close());

effect.spawn(this.#runTrack.bind(this, track));
Expand Down
2 changes: 1 addition & 1 deletion js/hang/src/watch/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class Preview {
const [_, broadcast, catalog] = values;

// Subscribe to the preview.json track directly
const track = broadcast.subscribe(catalog.name, catalog.priority);
const track = broadcast.subscribe(catalog.name, Catalog.PRIORITY.preview);
effect.cleanup(() => track.close());

effect.spawn(async () => {
Expand Down
1 change: 0 additions & 1 deletion rs/hang/examples/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ fn create_track(broadcast: &mut moq_lite::BroadcastProducer) -> hang::TrackProdu
// Create the video catalog entry with the renditions
let video = hang::catalog::Video {
renditions,
priority: 1,
display: None,
rotation: None,
flip: None,
Expand Down
3 changes: 0 additions & 3 deletions rs/hang/src/catalog/audio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ pub struct Audio {
/// This is not an array so it will work with JSON Merge Patch.
/// We use a BTreeMap so keys are sorted alphabetically for *some* deterministic behavior.
pub renditions: BTreeMap<String, AudioConfig>,

/// The priority of the audio track, relative to other tracks in the broadcast.
pub priority: u8,
}

/// Audio decoder configuration based on WebCodecs AudioDecoderConfig.
Expand Down
2 changes: 0 additions & 2 deletions rs/hang/src/catalog/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,12 @@ mod test {
let decoded = Catalog {
video: Some(Video {
renditions: video_renditions,
priority: 1,
display: None,
rotation: None,
flip: None,
}),
audio: Some(Audio {
renditions: audio_renditions,
priority: 2,
}),
..Default::default()
};
Expand Down
3 changes: 0 additions & 3 deletions rs/hang/src/catalog/video/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ pub struct Video {
/// We use a BTreeMap so keys are sorted alphabetically for *some* deterministic behavior.
pub renditions: BTreeMap<String, VideoConfig>,

/// The priority of the video track, relative to other tracks in the broadcast.
pub priority: u8,

/// Render the video at this size in pixels.
/// This is separate from the display aspect ratio because it does not require reinitialization.
#[serde(default)]
Expand Down
3 changes: 1 addition & 2 deletions rs/hang/src/import/aac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ impl Aac {
let track = self.broadcast.create_track(track);

let mut catalog = self.broadcast.catalog.lock();
let audio = catalog.insert_audio(track.info.name.clone(), config);
audio.priority = 2;
catalog.insert_audio(track.info.name.clone(), config);

self.track = Some(track);

Expand Down
3 changes: 1 addition & 2 deletions rs/hang/src/import/avc3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ impl Avc3 {

{
let mut catalog = self.broadcast.catalog.lock();
let video = catalog.insert_video(track.name.clone(), config.clone());
video.priority = 2;
catalog.insert_video(track.name.clone(), config.clone());
}

let track = self.broadcast.create_track(track);
Expand Down
6 changes: 2 additions & 4 deletions rs/hang/src/import/fmp4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ impl Fmp4 {
priority: 1,
};

let video = catalog.insert_video(track.name.clone(), config.clone());
video.priority = 1;
catalog.insert_video(track.name.clone(), config.clone());

// Record this track name
created_video_tracks.push(track.name.clone());
Expand All @@ -204,8 +203,7 @@ impl Fmp4 {
priority: 2,
};

let audio = catalog.insert_audio(track.name.clone(), config.clone());
audio.priority = 2;
catalog.insert_audio(track.name.clone(), config.clone());

// Record this track name
created_audio_tracks.push(track.name.clone());
Expand Down
3 changes: 1 addition & 2 deletions rs/hang/src/import/hev1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ impl Hev1 {

{
let mut catalog = self.broadcast.catalog.lock();
let video = catalog.insert_video(track.name.clone(), config.clone());
video.priority = 2;
catalog.insert_video(track.name.clone(), config.clone());
}

let track = self.broadcast.create_track(track);
Expand Down
3 changes: 1 addition & 2 deletions rs/hang/src/import/opus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ impl Opus {
let track = self.broadcast.create_track(track);

let mut catalog = self.broadcast.catalog.lock();
let audio = catalog.insert_audio(track.info.name.clone(), config);
audio.priority = 2;
catalog.insert_audio(track.info.name.clone(), config);

self.track = Some(track);

Expand Down
4 changes: 2 additions & 2 deletions rs/libmoq/src/consume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl Consume {

let track = consume.broadcast.subscribe_track(&moq_lite::Track {
name: rendition.clone(),
priority: video.priority,
priority: 1,
});
let track = TrackConsumer::new(track, latency);

Expand Down Expand Up @@ -215,7 +215,7 @@ impl Consume {

let track = consume.broadcast.subscribe_track(&moq_lite::Track {
name: rendition.clone(),
priority: audio.priority,
priority: 2,
});
let track = TrackConsumer::new(track, latency);

Expand Down
Loading