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: 0 additions & 1 deletion quest/m1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ the transport line in m2 assumes a single stack.
- [Origin scoping](/quest/m1/api-net-origin.md) - `scope(root, patterns)` is one fallible call, a fresh origin has a random hop, and the handles stop derefing to `Hop`
- [Bindings announce match](/quest/m1/api-origin-scopes.md) - every binding takes a pattern scope and reports the announce match with its captures
- [PathPrefixes](/quest/m1/api-path-prefixes.md) - the unused moq_net::PathPrefixes type is deleted before the release
- [Route cost](/quest/m1/api-route-cost.md) - `Route::with_hop` and `Cost: From<(u64, u64)>` go; ffi and libmoq build `Hops` and `Cost::from_warm_cold`
- [Rendition ownership](/quest/m1/api-mux-rendition.md) - one handle publishes a media track and reports its estimate, instead of five
- [Gateway types](/quest/m1/api-gateways.md) - no `anyhow` in a gateway `Error`, `PathOwned` prefixes, `Duration` segments, `moq_rtc::Server::new(config)`, an SRT reject with a reason
- [libmoq units](/quest/m1/api-libmoq-units.md) - `moq_client_config` is all microseconds, the header declares every enum and error code, NULL callbacks are refused
Expand Down
1 change: 0 additions & 1 deletion quest/m1/api-review-gate.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ quest is deleted too. No code.

The list: [Announce event](/quest/m1/api-net-announce.md),
[Origin scoping](/quest/m1/api-net-origin.md),
[Route cost](/quest/m1/api-route-cost.md),
[Rendition ownership](/quest/m1/api-mux-rendition.md),
[Gateway types](/quest/m1/api-gateways.md),
[libmoq units](/quest/m1/api-libmoq-units.md).
Expand Down
29 changes: 0 additions & 29 deletions quest/m1/api-route-cost.md

This file was deleted.

8 changes: 5 additions & 3 deletions rs/libmoq/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ unsafe fn parse_route(route: *const moq_route) -> Result<moq_net::origin::Route,
return Ok(moq_net::origin::Route::default());
};
let cold = if route.has_cold { route.cold } else { route.cost };
let mut out = moq_net::origin::Route::default().with_cost((route.cost, cold));
let mut route_hops = moq_net::Hops::new();
if route.hops_len > 0 {
if route.hops.is_null() {
return Err(Error::InvalidPointer);
Expand All @@ -670,10 +670,12 @@ unsafe fn parse_route(route: *const moq_route) -> Result<moq_net::origin::Route,
} else {
moq_net::Hop::new(*id).map_err(|e| Error::InvalidConfig(e.to_string()))?
};
out = out.with_hop(hop).map_err(|e| Error::InvalidConfig(e.to_string()))?;
route_hops.push(hop).map_err(|e| Error::InvalidConfig(e.to_string()))?;
}
}
Ok(out)
Ok(moq_net::origin::Route::default()
.with_cost(moq_net::origin::Cost { warm: route.cost, cold })
.with_hops(route_hops))
}

/// A route announcement or retraction from an origin.
Expand Down
10 changes: 5 additions & 5 deletions rs/moq-ffi/src/origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,18 @@ impl TryFrom<MoqRoute> for moq_net::origin::Route {

fn try_from(route: MoqRoute) -> Result<Self, MoqError> {
let cold = route.cold.unwrap_or(route.cost);
let mut out = moq_net::origin::Route::default().with_cost((route.cost, cold));
let mut hops = moq_net::Hops::new();
for id in route.hops {
let origin = if id == 0 {
moq_net::Hop::UNKNOWN
} else {
moq_net::Hop::new(id).map_err(|e| MoqError::InvalidRoute(e.to_string()))?
};
out = out
.with_hop(origin)
.map_err(|e| MoqError::InvalidRoute(e.to_string()))?;
hops.push(origin).map_err(|e| MoqError::InvalidRoute(e.to_string()))?;
}
Ok(out)
Ok(moq_net::origin::Route::default()
.with_cost(moq_net::origin::Cost { warm: route.cost, cold })
.with_hops(hops))
}
}

Expand Down
6 changes: 3 additions & 3 deletions rs/moq-ffi/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ fn origin_config_set_cache_capacity() {
#[test]
fn route_cold_cost_conversions_are_lossless() {
// An explicit cold half survives the round trip in both directions.
let route = moq_net::origin::Route::default().with_cost((0u64, 9u64));
let route = moq_net::origin::Route::default().with_cost(moq_net::origin::Cost { warm: 0, cold: 9 });
let ffi = MoqRoute::from(route.clone());
assert_eq!(ffi.cost, 0);
assert_eq!(ffi.cold, Some(9));
Expand All @@ -281,7 +281,7 @@ fn route_cold_cost_conversions_are_lossless() {
anonymous: false,
})
.unwrap();
assert_eq!(seeded.cost, moq_net::origin::Cost::from((5u64, 5u64)));
assert_eq!(seeded.cost, moq_net::origin::Cost { warm: 5, cold: 5 });

let anonymous = MoqRoute::from(
moq_net::origin::Route::default().with_hops(moq_net::Hops::try_from(vec![moq_net::Hop::UNKNOWN]).unwrap()),
Expand Down Expand Up @@ -326,7 +326,7 @@ async fn announced_route_keeps_cold_cost_on_reannounce() {
// the conversion rather than waiting for a second update.)
broadcast.announce(route.clone()).unwrap();
let back = moq_net::origin::Route::try_from(route.clone()).unwrap();
assert_eq!(back.cost, moq_net::origin::Cost::from((0u64, 9u64)));
assert_eq!(back.cost, moq_net::origin::Cost { warm: 0, cold: 9 });
assert_eq!(MoqRoute::from(back), route);

broadcast.finish().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion rs/moq-hls/src/export/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ mod tests {
let mut broadcast = origin.create_broadcast("live").expect("publish allowed");
broadcast.announce(Default::default()).expect("publish allowed");
settle().await;
let mut catalog = moq_mux::catalog::Producer::new(&mut broadcast).unwrap();
let mut catalog = moq_mux::catalog::Producer::new(&mut broadcast, moq_mux::catalog::Config::default()).unwrap();

let reserved = catalog.reserve();
let mut registration = reserved.video("video0").unwrap();
Expand Down
2 changes: 1 addition & 1 deletion rs/moq-net/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- [**breaking**] Dead exports removed: `Hops::replace_first`, `origin::Dynamic::{hop, root}`, `DRAIN_COST` / `MAX_COST` (use `Cost::{DRAIN, MAX}`), `broadcast::Producer::remove_track`, `track::Producer::start_sequence`, `Subscriber::with_groups`, `Ordered::with_groups`, `group::Consumer::with_frames`, `cache::Pool::same_pool`, `Timestamp::new_const`, `Error::to_code`. `Route::with_hop` and `Cost: From<(u64, u64)>` stay; libmoq and moq-ffi still call them.
- [**breaking**] Dead exports removed: `Hops::replace_first`, `origin::Dynamic::{hop, root}`, `DRAIN_COST` / `MAX_COST` (use `Cost::{DRAIN, MAX}`), `broadcast::Producer::remove_track`, `track::Producer::start_sequence`, `Subscriber::with_groups`, `Ordered::with_groups`, `group::Consumer::with_frames`, `cache::Pool::same_pool`, `Timestamp::new_const`, `Error::to_code`, `Route::with_hop` (build `Hops` and use `with_hops`), and `Cost: From<(u64, u64)>` (use `Cost { warm, cold }`).
- [**breaking**] `track::SubscriberControl` is `track::Control`, `track::GroupRequest` is `group::Request`, `ConnectionStats` is `session::Stats` with `estimated_send_rate` / `estimated_recv_rate` as `Option<bandwidth::Rate>`, and the paused handshake `Request<S, R>` is `server::Handshake`.
- [**breaking**] `create_track`, `reserve_track`, `unique_track`, `finish`, `create_group`, and `append_group` take `&self`. `track::Consumer::info()` is `query()`. `track::Demand` gains `is_used` / `poll_used` / `poll_unused`. `track::Producer::poll_unused` returns `Poll<Result<()>>`. `bandwidth::Producer::closed()` returns the cause.
- [**breaking**] `stats::Presence` and `stats::Traffic` name both edges of each cumulative pair `*_started` / `*_ended` (`sessions_started` / `sessions_ended`, `announces_started` / `announces_ended`, `broadcasts_*`, `subscriptions_*`). Serialize still writes the previous `announced` / `*_closed` names beside the new ones; deserialize accepts either spelling, with the canonical name winning.
Expand Down
21 changes: 0 additions & 21 deletions rs/moq-net/src/model/origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ const MAX_COST: u64 = (1 << 62) - 1;
/// path as if nothing were cached, so it stays meaningful once discounts have
/// flattened `warm`.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
#[non_exhaustive]
pub struct Cost {
/// The cost of pulling content via this route as the mesh stands today,
/// accumulated per link. Lower wins.
Expand Down Expand Up @@ -445,17 +444,6 @@ impl From<u64> for Cost {
}
}

impl From<(u64, u64)> for Cost {
/// Both magnitudes explicitly: `(warm, cold)`.
///
/// Unlike [`new`](Self::new), which prices the route undiscounted, this keeps a
/// discounted `warm` alongside its undiscounted `cold`, which is what an
/// application re-announcing an observed route means.
fn from((warm, cold): (u64, u64)) -> Self {
Self { warm, cold }
}
}

/// The path a route took through the mesh and what using it costs.
///
/// The metadata half of an advertisement: [`Producer::dynamic`] pairs it with
Expand Down Expand Up @@ -499,15 +487,6 @@ impl Default for Route {
}

impl Route {
/// Append a hop to the chain, oldest first.
///
/// Fails with [`crate::InvalidHop`] for a hop the wire would reject: one past the
/// chain's length cap, or one already in it, which is a loop.
pub fn with_hop(mut self, hop: Hop) -> Result<Self, InvalidHop> {
self.hops.push(hop)?;
Ok(self)
}

/// Replace the hop chain.
pub fn with_hops(mut self, hops: Hops) -> Self {
self.hops = hops;
Expand Down
Loading