Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for catalog in common catalog format #103

Merged
merged 14 commits into from
Jul 24, 2024
Merged

Conversation

TilsonJoji
Copy link
Contributor

@TilsonJoji TilsonJoji commented Jul 9, 2024

Hello Luke @kixelated , thank you for your work, we ( Gwendal Simon , Tilson Joji ) from Synamedia would like to convey our interest in contributing.

With this PR have attempted to support formatting the catalog as per common catalog format defined in spec https://datatracker.ietf.org/doc/html/draft-wilaw-moq-catalogformat-02

A PR has been requested in moq-rs as well to support this change, here is the link to the PR kixelated/moq-rs#174

Kindly review and let us know your thoughts.

@englishm
Copy link
Contributor

englishm commented Jul 9, 2024

Thanks for this, @TilsonJoji (and @gwendalsimon) - the catalog support we have right now is still mostly a placeholder and the format is left over from before the current common catalog spec existed, so I see no reason not to update it both here and in moq-pub!

Copy link
Owner

@kixelated kixelated left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catalog draft is pretty rough and I need to file a lot of issues.

The catalog draft was adopted by the WG so we should be implementing the latest version. Unfortunately I just noticed that so my review was for the 02 draft you linked.

@@ -21,6 +21,7 @@ export class Catalog {
const str = decoder.decode(raw)

try {
if (typeof JSON.parse(str).packaging !== "string") throw new Error("invalid catalog")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will JSON parse the catalog twice. Also the isCatalog function should perform this check.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO Catalog should be an interface now that there's actually stuff in the root.

export interface Catalog {
  version: number,
  sequence: number,
  streamingFormat: number,
  streamingFormatVersion: string,
  renderGroup: number,
  packaging: string,
  // etc?
  tracks: Track[],
}

It means you'll need to move the other functions into the root but that's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

}

export interface Mp4Track extends Track {
container: "mp4"
init_track: string
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
init_track: string
initTrack: string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

@@ -60,63 +61,68 @@ export function isCatalog(catalog: any): catalog is Catalog {
}

export interface Track {
kind: string
container: string
name: string
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a few other fields that should be defined here, basically anything with Location = T.

Unfortunately some of these fields will be optional and default to the value in the root. ex.

let packaging = catalog.tracks[0].packaging ?? catalog.packing;

I think we should automatically populate the track using the default values so you don't have to perform the above every time. But that can be a future PR.

bit_rate?: number
}

export interface SelectionParamsAudio {
bit_rate: number;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bit_rate: number;
bitrate?: number;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

codec: string;
height: number;
width: number;
frame_rate: number
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
frame_rate: number
framerate?: number

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

export interface SelectionParamsAudio {
bit_rate: number;
channel_count: number;
codec: string;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
codec: string;
codec?: string;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

bit_rate: number;
channel_count: number;
codec: string;
sample_rate: number;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sample_rate: number;
samplerate?: number;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

channel_count: number;
codec: string;
sample_rate: number;
sample_size: number;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

height: number
frame_rate: number
bit_rate?: number
name: "video"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the track name, not the kind. We can't use "audio" or "video" because that would only allow one track of each type.

There's no equivalent to kind in draft-02, which I think is a big oversight. There is only supposed to be a single SelectionParams type instead of splitting them into audio/video.

@@ -100,8 +100,8 @@ export class Player {
}

async #runTrack(track: Mp4Track) {
if (track.kind !== "audio" && track.kind !== "video") {
throw new Error(`unknown track kind: ${track.kind}`)
if (!(track.name.toLowerCase().includes("audio")) && !(track.name.toLowerCase().includes("video"))) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isAudioTrack(track) or isVideoTrack(track) is the way you're supposed to determine the type now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

@TilsonJoji
Copy link
Contributor Author

Thank you @englishm.

Thank you @kixelated for the detailed review and the feedback . I will address the comments and update the PR.

This is related to previous PR : #1

Addressing review comments received on kixelated#103 and making the catalog compliant with https://www.ietf.org/archive/id/draft-ietf-moq-catalogformat-01.html

Related PR in moq-js : TilsonJoji/moq-rs#2
@TilsonJoji
Copy link
Contributor Author

TilsonJoji commented Jul 11, 2024

Hello Luke @kixelated , Mike @englishm , i have attempted to address the comments and followed the latest version of the spec , kindly review and let me know your thoughts.

@kixelated
Copy link
Owner

Thanks @TilsonJoji , I'll take a look hopefully tomorrow.

Untested because I have to get back to work. :x
@kixelated
Copy link
Owner

@TilsonJoji I pushed some changes inline. It passes the typescript checks (npm run build) but I haven't actually tested it yet, nor updated the Rust side.

@kixelated
Copy link
Owner

kixelated commented Jul 18, 2024

I made some issues on the catalog Github if you want to voice any opinions after having implemented this: https://github.com/moq-wg/catalog-format

Commit to address an glitch observed in UT with commit kixelated/moq-js@7baad29 part of PR kixelated#103
@TilsonJoji
Copy link
Contributor Author

TilsonJoji commented Jul 19, 2024

Hello Luke @kixelated , thank you for the refactoring the code with commit 7baad29.

Regarding moq-rs , I performed a test and have updated the RUST PR .
The commits in moq-rs PR are [commit to address PR comments in moq-rs , commit to address cargo build warning , and commit to update RS to work with your refactoring commit .

The commits in moq-rs have passed the PR build check. Kindly have a look at the moq-rs PR as time allows and let me know your thoughts.

Regarding moq-js , Have done a minor tweak to your commit to fix issue observed in UT and have pushed the changes in this UT1 commit and this UT2 commit

UT1 performed:

UT2

  1. Access URL https://ip:4321/publish?server=IP:4443
  2. Click on Camera
  3. Click on Go live and then on share
  4. Watch the stream at https://ip:4321/watch/82dd0119-de7e-4f5c-8fb1-a4768a29fb5b?server=IP:4443

@TilsonJoji
Copy link
Contributor Author

TilsonJoji commented Jul 22, 2024

Hello Luke @kixelated , pushed a commit b8d5a80/511ad99 to update moq-js with regards to namespace access, to make it compatible with commit 73bad56 f05c00e in PR : kixelated/moq-rs#174

@kixelated kixelated merged commit 5158564 into kixelated:main Jul 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants