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/test-flakes-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ Public API: none. Wire: none.
- [Media resource instrumentation](/quest/m1/test-flakes-2/resource-instrumentation.md) - the media test stops seeing a playing player report nothing to release
- [Tone check grace](/quest/m1/test-flakes-2/tone-grace.md) - the interop tone check charges its grace only for audible playback, so a refilling ring under CPU starvation is not a failure
- [IETF22 fallback](/quest/m1/test-flakes-2/ietf22-fallback.md) - an IETF22 browser viewer follows a fallback within the media lane's bound, keeping its session and its audio
- [Go reservation grant](/quest/m1/test-flakes-2/go-reservation-grant.md) - the Go reservation test waits for its grant
16 changes: 0 additions & 16 deletions quest/m1/test-flakes-2/go-reservation-grant.md

This file was deleted.

2 changes: 2 additions & 0 deletions rs/moq-ffi/src/session/dial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ async fn run(
return err;
}
};
// Before the session publishes, so a watcher that sees it already reads its estimate.
let _ = send.set(session.send_bandwidth().and_then(|bw| bw.peek()));
published.session = Some(Accepted {
session: session.clone(),
});
Expand Down
7 changes: 6 additions & 1 deletion rs/moq-net/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1225,9 +1225,14 @@ mod tests {

let client = Client::new().with_versions(Version::Lite(lite::Version::Lite04).into());
let (session, driver) = client.connect(moq_clock::now(), fake.clone()).await.unwrap();
let mut bandwidth = session.send_bandwidth().expect("backend reports an estimate");
assert_eq!(
bandwidth.peek(),
Some(crate::bandwidth::Rate::from_bps(1_000_000)),
"the estimate is readable before the sampler first runs"
);
moq_clock::sim::spawn(crate::time::run(driver));

let mut bandwidth = session.send_bandwidth().expect("backend reports an estimate");
assert_eq!(
bandwidth.changed().await.unwrap(),
Some(crate::bandwidth::Rate::from_bps(1_000_000))
Expand Down
4 changes: 4 additions & 0 deletions rs/moq-net/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ impl Session {
/// Returns a consumer for the estimated send bitrate (from the congestion controller).
///
/// Returns `None` if the QUIC backend doesn't support bandwidth estimation.
/// Otherwise it holds an estimate from the start, the session's first sample.
pub fn send_bandwidth(&self) -> Option<bandwidth::Consumer> {
self.send_bandwidth.as_ref().map(bandwidth::Weak::consume)
}
Expand Down Expand Up @@ -415,8 +416,11 @@ impl Session {
}

// Send bandwidth is version-agnostic: it depends on QUIC backend support.
// Seeded with the first sample, so a consumer taken before the sampler
// first runs reads the estimate instead of `None`.
let (send_bandwidth, send_producer) = if sample.estimated_send_rate.is_some() {
let producer = bandwidth::Producer::new();
let _ = producer.set(sample.estimated_send_rate);
(Some(producer.weak()), Some(producer))
} else {
(None, None)
Expand Down
5 changes: 4 additions & 1 deletion rs/moq-tokio/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,9 @@ impl Shared {
session.abort(err.clone());
return;
}
// Before the state publishes, so a watcher that sees this connect already
// reads its estimate, and the grants that divide it.
let _ = self.send_bw.set(session.send_bandwidth().and_then(|bw| bw.peek()));
if let Ok(mut state) = self.state.write() {
// A migration replaces a live session without a disconnect in between, so
// its end is counted here, keeping `started - ended` at 1 while connected.
Expand Down Expand Up @@ -1489,7 +1492,7 @@ impl Connection {
///
/// Unlike the session's, this handle is persistent: the reconnect loop forwards each session's
/// estimate into it, so it survives reconnects. Its value is `None` while disconnected or when the
/// backend has no estimate.
/// backend has no estimate, and is already set when a watcher sees the connect.
pub fn send_bandwidth(&self) -> BandwidthConsumer {
self.send_bandwidth.clone()
}
Expand Down
Loading