From eb7e707be32833fe564e0c815a25e414baf06595 Mon Sep 17 00:00:00 2001 From: kixelated Date: Tue, 19 Sep 2023 10:01:26 -0700 Subject: [PATCH] Implement prioritization in moq-pub (#74) Here's the main change in webtransport-quinn 0.5.3: https://github.com/kixelated/webtransport-rs/commit/ec553fa340895aad3505487f4624440e111e3384 I haven't run into any errors so I don't know what was broken before @englishm. I'm hoping that setting the stream priority to max when writing the stream header avoids the issue? Otherwise we need to go bug diving. --- Cargo.lock | 4 ++-- moq-pub/src/media.rs | 4 ++-- moq-transport/Cargo.toml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5cdc8fa..c402c66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2139,9 +2139,9 @@ dependencies = [ [[package]] name = "webtransport-quinn" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea8dec60bceb5523139e095ff3ac4622ef0cffdd53f59fb68dd94f93f041ae4" +checksum = "10cfc3592022726f4e8e5a536e68fb1ecb0b077e6b5435bd7ac3b9c97670c18c" dependencies = [ "async-std", "bytes", diff --git a/moq-pub/src/media.rs b/moq-pub/src/media.rs index 2fe1205..e74ddd4 100644 --- a/moq-pub/src/media.rs +++ b/moq-pub/src/media.rs @@ -258,7 +258,7 @@ impl Track { // Compute the timestamp in milliseconds. // Overflows after 583 million years, so we're fine. - let _timestamp: i32 = fragment + let timestamp: i32 = fragment .timestamp(self.timescale) .as_millis() .try_into() @@ -267,7 +267,7 @@ impl Track { // Create a new segment. let mut segment = self.track.create_segment(segment::Info { sequence: VarInt::try_from(self.sequence).context("sequence too large")?, - priority: i32::MAX, // TODO + priority: timestamp, // newer segments are higher priority // Delete segments after 10s. expires: Some(time::Duration::from_secs(10)), diff --git a/moq-transport/Cargo.toml b/moq-transport/Cargo.toml index b99648a..4009d86 100644 --- a/moq-transport/Cargo.toml +++ b/moq-transport/Cargo.toml @@ -23,4 +23,4 @@ log = "0.4" indexmap = "2" quinn = "0.10" -webtransport-quinn = "0.5.2" +webtransport-quinn = "0.5.3"