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
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion rs/hang/examples/video.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// cargo run --example video
use moq_lite::coding::Bytes;
use bytes::Bytes;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
Expand Down
3 changes: 1 addition & 2 deletions rs/hang/src/container/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::collections::VecDeque;

use buf_list::BufList;
use futures::{StreamExt, stream::FuturesUnordered};
use moq_lite::coding::Decode;

use super::{Frame, Timestamp};
use crate::Error;
Expand Down Expand Up @@ -188,7 +187,7 @@ impl GroupReader {

let mut payload = BufList::from_iter(payload);

let timestamp = Timestamp::decode(&mut payload, ())?;
let timestamp = Timestamp::decode(&mut payload)?;

let frame = Frame {
keyframe: (self.index == 0),
Expand Down
3 changes: 1 addition & 2 deletions rs/hang/src/container/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use bytes::{Buf, BytesMut};
use derive_more::Debug;

pub use buf_list::BufList;
use moq_lite::{coding::Encode, lite};

use crate::Error;

Expand Down Expand Up @@ -42,7 +41,7 @@ impl Frame {
/// NOTE: The [Self::keyframe] flag is ignored for this method; you need to create a new group manually.
pub fn encode(&self, group: &mut moq_lite::GroupProducer) -> Result<(), Error> {
let mut header = BytesMut::new();
self.timestamp.encode(&mut header, lite::Version::Draft02);
self.timestamp.encode(&mut header);

let size = header.len() + self.payload.remaining();

Expand Down
4 changes: 0 additions & 4 deletions rs/hang/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ pub enum Error {
#[error("moq lite error: {0}")]
Moq(#[from] moq_lite::Error),

/// Failed to decode a message at the MoQ transport layer.
#[error("decode error: {0}")]
Decode(#[from] moq_lite::coding::DecodeError),

/// JSON serialization/deserialization error.
#[error("json error: {0}")]
Json(Arc<serde_json::Error>),
Expand Down
1 change: 1 addition & 0 deletions rs/libmoq/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ crate-type = ["staticlib"]

[dependencies]
anyhow = { version = "1", features = ["backtrace"] }
bytes = "1"
hang = { workspace = true }
moq-lite = { workspace = true, features = ["serde"] }
moq-mux = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion rs/libmoq/src/consume.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::ffi::c_char;

use moq_lite::coding::Buf;
use bytes::Buf;
use tokio::sync::oneshot;

use crate::ffi::OnStatus;
Expand Down
2 changes: 1 addition & 1 deletion rs/libmoq/src/publish.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{str::FromStr, sync::Arc};

use moq_lite::coding::Buf;
use bytes::Buf;
use moq_mux::import;

use crate::{Error, Id, NonZeroSlab};
Expand Down
3 changes: 0 additions & 3 deletions rs/moq-lite/src/coding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,3 @@ pub use stream::*;
pub use varint::*;
pub use version::*;
pub use writer::*;

// Re-export the bytes crate
pub use bytes::*;
2 changes: 1 addition & 1 deletion rs/moq-lite/src/coding/reader.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{cmp, fmt::Debug, io, sync::Arc};

use bytes::{Buf, Bytes, BytesMut};
use bytes::{Buf, BufMut, Bytes, BytesMut};

use crate::{Error, coding::*};

Expand Down
4 changes: 0 additions & 4 deletions rs/moq-lite/src/coding/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ use std::{fmt, ops::Deref};
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Version(pub u64);

/// A version number negotiated during the setup.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Alpn(pub &'static str);

impl From<u64> for Version {
fn from(v: u64) -> Self {
Self(v)
Expand Down
1 change: 1 addition & 0 deletions rs/moq-lite/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ impl<T> SendSyncError for T where T: std::error::Error + MaybeSend + MaybeSync {

/// A list of possible errors that can occur during the session.
#[derive(thiserror::Error, Debug, Clone)]
#[non_exhaustive]
pub enum Error {
#[error("transport error: {0}")]
Transport(Arc<dyn SendSyncError>),
Expand Down
17 changes: 0 additions & 17 deletions rs/moq-lite/src/ietf/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,23 +312,6 @@ impl<V> Decode<V> for FetchHeader {
}
}

/// Fetch object serialization (v14 format).
/// v15 adds SerializationFlags for delta encoding but we skip that for now.
pub struct FetchObject {
/*
v14:
Group ID (i),
Subgroup ID (i),
Object ID (i),
Publisher Priority (8),
Extension Headers Length (i),
[Extension headers (...)],
Object Payload Length (i),
[Object Status (i)],
Object Payload (..),
*/
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
2 changes: 0 additions & 2 deletions rs/moq-lite/src/ietf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ mod publish_namespace;
mod publisher;
mod request;
mod session;
mod setup;
mod subscribe;
mod subscribe_namespace;
mod subscriber;
Expand All @@ -36,7 +35,6 @@ pub use publish_namespace::*;
use publisher::*;
pub use request::*;
pub(crate) use session::*;
pub use setup::*;
pub use subscribe::*;
pub use subscribe_namespace::*;
use subscriber::*;
Expand Down
11 changes: 7 additions & 4 deletions rs/moq-lite/src/ietf/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ impl Parameters {
self.vars.insert(kind, value);
}

#[cfg(test)]
pub fn get_bytes(&self, kind: ParameterBytes) -> Option<&[u8]> {
self.bytes.get(&kind).map(|v| v.as_slice())
}
Expand Down Expand Up @@ -246,10 +247,10 @@ impl Encode<Version> for MessageParameters {

impl MessageParameters {
// Varint parameter IDs (even)
const DELIVERY_TIMEOUT: u64 = 0x02;
const MAX_CACHE_DURATION: u64 = 0x04;
const EXPIRES: u64 = 0x08;
const PUBLISHER_PRIORITY: u64 = 0x0E;
//const DELIVERY_TIMEOUT: u64 = 0x02;
//const MAX_CACHE_DURATION: u64 = 0x04;
//const EXPIRES: u64 = 0x08;
//const PUBLISHER_PRIORITY: u64 = 0x0E;
const FORWARD: u64 = 0x10;
const SUBSCRIBER_PRIORITY: u64 = 0x20;
const GROUP_ORDER: u64 = 0x22;
Expand All @@ -262,6 +263,7 @@ impl MessageParameters {

// --- Varint accessors ---

/*
pub fn delivery_timeout(&self) -> Option<u64> {
self.vars.get(&Self::DELIVERY_TIMEOUT).copied()
}
Expand Down Expand Up @@ -293,6 +295,7 @@ impl MessageParameters {
pub fn set_publisher_priority(&mut self, v: u8) {
self.vars.insert(Self::PUBLISHER_PRIORITY, v as u64);
}
*/

pub fn forward(&self) -> Option<bool> {
self.vars.get(&Self::FORWARD).map(|v| *v != 0)
Expand Down
172 changes: 0 additions & 172 deletions rs/moq-lite/src/ietf/setup.rs

This file was deleted.

Loading
Loading