-
Notifications
You must be signed in to change notification settings - Fork 197
feat(moq-net): hook up the rest of moq-lite-05 wire (TRACK_INFO, SUBSCRIBE_END, frame timestamps) #1963
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
Merged
+854
−64
Merged
feat(moq-net): hook up the rest of moq-lite-05 wire (TRACK_INFO, SUBSCRIBE_END, frame timestamps) #1963
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import type { Reader, Writer } from "../stream.ts"; | ||
| import * as Message from "./message.ts"; | ||
| import { hasSetupStream, type Version } from "./version.ts"; | ||
|
|
||
| /// Setup parameter ID for the request Path (client-only, on URI-less transports). | ||
| const PARAM_PATH = 0x2; | ||
|
|
||
| /** | ||
| * The moq-lite-05 SETUP message, sent once per endpoint on a unidirectional Setup stream. | ||
| * | ||
| * The browser conveys its path via the WebTransport URL, so it never sends a Path | ||
| * parameter; this class still parses one for completeness when reading a peer's SETUP. | ||
| */ | ||
| export class Setup { | ||
| /// The request path, only sent on transport bindings without a request URI. | ||
| path?: string; | ||
|
|
||
| constructor(props: { path?: string } = {}) { | ||
| this.path = props.path; | ||
| } | ||
|
|
||
| async #encode(w: Writer) { | ||
| if (this.path !== undefined) { | ||
| await w.u53(1); // parameter count | ||
| const value = new TextEncoder().encode(this.path); | ||
| await w.u53(PARAM_PATH); | ||
| await w.u53(value.byteLength); | ||
| await w.write(value); | ||
| } else { | ||
| await w.u53(0); // no parameters | ||
| } | ||
| } | ||
|
|
||
| static async #decode(r: Reader): Promise<Setup> { | ||
| const count = await r.u53(); | ||
| let path: string | undefined; | ||
| for (let i = 0; i < count; i++) { | ||
| const id = await r.u53(); | ||
| const len = await r.u53(); | ||
| const value = await r.read(len); | ||
| // Unknown parameters are ignored so new ones stay backward compatible. | ||
| if (id === PARAM_PATH) { | ||
| path = new TextDecoder().decode(value); | ||
| } | ||
| } | ||
| return new Setup({ path }); | ||
| } | ||
|
|
||
| async encode(w: Writer, version: Version): Promise<void> { | ||
| if (!hasSetupStream(version)) throw new Error("SETUP requires moq-lite-05+"); | ||
| return Message.encode(w, this.#encode.bind(this)); | ||
| } | ||
|
|
||
| static async decode(r: Reader, version: Version): Promise<Setup> { | ||
| if (!hasSetupStream(version)) throw new Error("SETUP requires moq-lite-05+"); | ||
| return Message.decode(r, Setup.#decode); | ||
| } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.