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

Update to draft-04 #172

Merged
merged 14 commits into from
Aug 16, 2024
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions moq-clock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Luke Curley"]
repository = "https://github.com/kixelated/moq-rs"
license = "MIT OR Apache-2.0"

version = "0.4.2"
version = "0.5.0"
edition = "2021"

keywords = ["quic", "http3", "webtransport", "media", "live"]
Expand All @@ -14,8 +14,8 @@ categories = ["multimedia", "network-programming", "web-programming"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
moq-native = { path = "../moq-native", version = "0.3" }
moq-transport = { path = "../moq-transport", version = "0.5" }
moq-native = { path = "../moq-native", version = "0.4" }
moq-transport = { path = "../moq-transport", version = "0.6" }

# QUIC
url = "2"
Expand Down
6 changes: 3 additions & 3 deletions moq-dir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ authors = ["Luke Curley"]
repository = "https://github.com/kixelated/moq-rs"
license = "MIT OR Apache-2.0"

version = "0.1.2"
version = "0.2.0"
edition = "2021"

keywords = ["quic", "http3", "webtransport", "media", "live"]
categories = ["multimedia", "network-programming", "web-programming"]

[dependencies]
moq-native = { path = "../moq-native", version = "0.3" }
moq-transport = { path = "../moq-transport", version = "0.5" }
moq-native = { path = "../moq-native", version = "0.4" }
moq-transport = { path = "../moq-transport", version = "0.6" }

# QUIC
web-transport = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions moq-native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ authors = ["Luke Curley"]
repository = "https://github.com/kixelated/moq-rs"
license = "MIT OR Apache-2.0"

version = "0.3.0"
version = "0.4.0"
edition = "2021"

keywords = ["quic", "http3", "webtransport", "media", "live"]
categories = ["multimedia", "network-programming", "web-programming"]

[dependencies]
moq-transport = { path = "../moq-transport", version = "0.5" }
moq-transport = { path = "../moq-transport", version = "0.6" }
web-transport = { workspace = true }
web-transport-quinn = "0.3"

Expand Down
6 changes: 3 additions & 3 deletions moq-pub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Mike English", "Luke Curley"]
repository = "https://github.com/kixelated/moq-rs"
license = "MIT OR Apache-2.0"

version = "0.6.1"
version = "0.7.0"
edition = "2021"

keywords = ["quic", "http3", "webtransport", "media", "live"]
Expand All @@ -14,8 +14,8 @@ categories = ["multimedia", "network-programming", "web-programming"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
moq-native = { path = "../moq-native", version = "0.3" }
moq-transport = { path = "../moq-transport", version = "0.5" }
moq-native = { path = "../moq-native", version = "0.4" }
moq-transport = { path = "../moq-transport", version = "0.6" }
moq-catalog = { path = "../moq-catalog", version = "0.2" }

url = "2"
Expand Down
6 changes: 3 additions & 3 deletions moq-relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ authors = ["Luke Curley"]
repository = "https://github.com/kixelated/moq-rs"
license = "MIT OR Apache-2.0"

version = "0.5.1"
version = "0.6.0"
edition = "2021"

keywords = ["quic", "http3", "webtransport", "media", "live"]
categories = ["multimedia", "network-programming", "web-programming"]

[dependencies]
moq-transport = { path = "../moq-transport", version = "0.5" }
moq-native = { path = "../moq-native", version = "0.3" }
moq-transport = { path = "../moq-transport", version = "0.6" }
moq-native = { path = "../moq-native", version = "0.4" }
moq-api = { path = "../moq-api", version = "0.2" }

# QUIC
Expand Down
6 changes: 3 additions & 3 deletions moq-sub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = []
repository = "https://github.com/kixelated/moq-rs"
license = "MIT OR Apache-2.0"

version = "0.1.1"
version = "0.2.0"
edition = "2021"

keywords = ["quic", "http3", "webtransport", "media", "live"]
Expand All @@ -14,8 +14,8 @@ categories = ["multimedia", "network-programming", "web-programming"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
moq-transport = { path = "../moq-transport", version = "0.5" }
moq-native = { path = "../moq-native", version = "0.3" }
moq-transport = { path = "../moq-transport", version = "0.6" }
moq-native = { path = "../moq-native", version = "0.4" }
url = "2"

# Async stuff
Expand Down
2 changes: 1 addition & 1 deletion moq-transport/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Luke Curley"]
repository = "https://github.com/kixelated/moq-rs"
license = "MIT OR Apache-2.0"

version = "0.5.3"
version = "0.6.0"
edition = "2021"

keywords = ["quic", "http3", "webtransport", "media", "live"]
Expand Down
12 changes: 12 additions & 0 deletions moq-transport/src/coding/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ pub enum DecodeError {
#[error("invalid subscribe location")]
InvalidSubscribeLocation,

#[error("invalid filter type")]
InvalidFilterType,

#[error("invalid object status")]
InvalidObjectStatus,

#[error("invalid track status code")]
InvalidTrackStatusCode,

#[error("missing field")]
MissingField,

#[error("invalid value")]
InvalidValue,

Expand Down
3 changes: 3 additions & 0 deletions moq-transport/src/coding/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ pub enum EncodeError {
#[error("invalid value")]
InvalidValue,

#[error("missing field")]
MissingField,

#[error("i/o error: {0}")]
Io(sync::Arc<io::Error>),
}
Expand Down
8 changes: 8 additions & 0 deletions moq-transport/src/data/datagram.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::coding::{Decode, DecodeError, Encode, EncodeError};
use crate::data::ObjectStatus;

#[derive(Clone, Debug)]
pub struct Datagram {
// The subscribe ID.
Expand All @@ -16,6 +18,9 @@ pub struct Datagram {
// The priority, where **smaller** values are sent first.
pub send_order: u64,

// Object status
pub object_status: ObjectStatus,

// The payload.
pub payload: bytes::Bytes,
}
Expand All @@ -27,6 +32,7 @@ impl Decode for Datagram {
let group_id = u64::decode(r)?;
let object_id = u64::decode(r)?;
let send_order = u64::decode(r)?;
let object_status = ObjectStatus::decode(r)?;
let payload = r.copy_to_bytes(r.remaining());

Ok(Self {
Expand All @@ -35,6 +41,7 @@ impl Decode for Datagram {
group_id,
object_id,
send_order,
object_status,
payload,
})
}
Expand All @@ -47,6 +54,7 @@ impl Encode for Datagram {
self.group_id.encode(w)?;
self.object_id.encode(w)?;
self.send_order.encode(w)?;
self.object_status.encode(w)?;
Self::encode_remaining(w, self.payload.len())?;
w.put_slice(&self.payload);

Expand Down
22 changes: 21 additions & 1 deletion moq-transport/src/data/group.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::coding::{Decode, DecodeError, Encode, EncodeError};
use crate::data::ObjectStatus;

#[derive(Clone, Debug)]
pub struct GroupHeader {
Expand Down Expand Up @@ -41,14 +42,27 @@ impl Encode for GroupHeader {
pub struct GroupObject {
pub object_id: u64,
pub size: usize,
pub status: ObjectStatus,
}

impl Decode for GroupObject {
fn decode<R: bytes::Buf>(r: &mut R) -> Result<Self, DecodeError> {
let object_id = u64::decode(r)?;
let size = usize::decode(r)?;

Ok(Self { object_id, size })
// If the size is 0, then the status is sent explicitly.
// Otherwise, the status is assumed to be 0x0 (Object).
let status = if size == 0 {
ObjectStatus::decode(r)?
} else {
ObjectStatus::Object
};

Ok(Self {
object_id,
size,
status,
})
}
}

Expand All @@ -57,6 +71,12 @@ impl Encode for GroupObject {
self.object_id.encode(w)?;
self.size.encode(w)?;

// If the size is 0, then the status is sent explicitly.
// Otherwise, the status is assumed to be 0x0 (Object).
if self.size == 0 {
self.status.encode(w)?;
}

Ok(())
}
}
39 changes: 39 additions & 0 deletions moq-transport/src/data/object.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
use crate::coding::{Decode, DecodeError, Encode, EncodeError};

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ObjectStatus {
Object = 0x0,
ObjectDoesNotExist = 0x1,
GroupDoesNotExist = 0x2,
EndOfGroup = 0x3,
EndOfTrack = 0x4,
}

impl Decode for ObjectStatus {
fn decode<B: bytes::Buf>(r: &mut B) -> Result<Self, DecodeError> {
match u64::decode(r)? {
0x0 => Ok(Self::Object),
0x1 => Ok(Self::ObjectDoesNotExist),
0x2 => Ok(Self::GroupDoesNotExist),
0x3 => Ok(Self::EndOfGroup),
0x4 => Ok(Self::EndOfTrack),
_ => Err(DecodeError::InvalidObjectStatus),
}
}
}

impl Encode for ObjectStatus {
fn encode<W: bytes::BufMut>(&self, w: &mut W) -> Result<(), EncodeError> {
match self {
Self::Object => (0x0_u64).encode(w),
Self::ObjectDoesNotExist => (0x1_u64).encode(w),
Self::GroupDoesNotExist => (0x2_u64).encode(w),
Self::EndOfGroup => (0x3_u64).encode(w),
Self::EndOfTrack => (0x4_u64).encode(w),
}
}
}

#[derive(Clone, Debug)]
pub struct ObjectHeader {
// The subscribe ID.
Expand All @@ -16,6 +50,9 @@ pub struct ObjectHeader {

// The send order, where **smaller** values are sent first.
pub send_order: u64,

// The object status
pub object_status: ObjectStatus,
}

impl Decode for ObjectHeader {
Expand All @@ -26,6 +63,7 @@ impl Decode for ObjectHeader {
group_id: u64::decode(r)?,
object_id: u64::decode(r)?,
send_order: u64::decode(r)?,
object_status: ObjectStatus::decode(r)?,
})
}
}
Expand All @@ -37,6 +75,7 @@ impl Encode for ObjectHeader {
self.group_id.encode(w)?;
self.object_id.encode(w)?;
self.send_order.encode(w)?;
self.object_status.encode(w)?;

Ok(())
}
Expand Down
Loading
Loading