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/poll-first/no-spawn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ binding boundary.

- [The remaining spawns](/quest/m2/spawn-audit.md) - the same rule for every other library crate
- [Generated async wrappers](/quest/m1/poll-first/async-feature.md) - the poll-first sibling that gates the async layer
- [Poll-native async in moq-ffi](/quest/m2/ffi-poll-migrate.md) - its PR reworks the moq-ffi task plumbing this epic touches
13 changes: 4 additions & 9 deletions quest/m1/poll-first/no-spawn/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@ is one runtime-owned driver task that holds every `Background` as `kio::Tasks`
children. Rejected: having each handle's calls poll its `Background`, which
fails for an origin with no reader, since nobody would poll its driver.

[moq-dev/moq#7497](https://github.com/moq-dev/moq/pull/7497) replaces
`ffi::Task` with `ffi::Polled` and changes `Background` and shutdown in
`ffi.rs`, keeping demand waits `detached` for now. Build on it: converting
before it lands would conflict on almost every line. Recount the sites above
once it merges.
[moq-dev/moq#7497](https://github.com/moq-dev/moq/pull/7497) replaced
`ffi::Task` with `ffi::Polled` for kio-backed reads and changed `Background`
and shutdown in `ffi.rs`, keeping demand waits `detached`. Recount the sites
above against it before converting.

Public API: no binding signature changes. Wire: none.

## Required

- [Poll-native async in moq-ffi](/quest/m2/ffi-poll-migrate.md) - its PR rewrites the `Task` and `Background` plumbing this changes
1 change: 0 additions & 1 deletion quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ lite-07; bitrate enforcement is not part of this release.
- [A runtime-free QUIC driver](/quest/m2/quic-sansio-driver.md) - a caller's own loop moves UDP datagrams and polls moq sessions over moq-quic, for rust2's bindings
- [MoQ on rind](/quest/m2/rind/README.md) - every MoQ crate takes its crypto from rind, a pure-Rust graviola fork, so no build compiles C crypto
- [Benchmark sources](/quest/m2/bench-sources.md) - every measuring nightly benchmark feeds the regression table, and none is a smoke run
- [Poll-native async](/quest/m2/ffi-poll-migrate.md) - moq-ffi's pure-kio async exports poll their state directly instead of going through `ffi::Task`
- [QoS](/quest/m2/qos/README.md) - the relay's egress `lag` histogram and `dropped` counters on the stats totals and prefix tracks
- [HLS and DASH browser playback](/quest/m2/hls-player-test.md) - hls.js and dash.js play, reload, switch, and survive reconfiguration nightly
- [The DASH manifest keeps segments across a reconfigure](/quest/m2/dash-reconfigure.md) - a same-codec reconfigure keeps the old instance's segments listed in DASH, as HLS does
Expand Down
80 changes: 0 additions & 80 deletions quest/m2/ffi-poll-migrate.md

This file was deleted.

6 changes: 6 additions & 0 deletions rs/moq-ffi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
subscribe with `MoqAudioConsumer::subscribe` / `MoqVideoConsumer::subscribe`.
Codec-only `MoqAudioEncoder` / `MoqVideoEncoder` are available alongside them.
- Audio frame duration defaults to the codec's own frame; video GOP mode is an enum.
- Track, group, and datagram reads, announcement and follow streams, request and fill
waits, the JSON and media consumers, and grant and bandwidth waits poll their handle's
state directly. Concurrent calls on one handle no longer queue in call order: each
takes the next item as it arrives, and sequence or arrival order is unchanged. A call
the binding cancelled but has not freed yet no longer holds up the next one, and
`cancel()` on these handles releases their state before it returns.

## [0.4.12](https://github.com/moq-dev/moq/compare/moq-ffi-v0.4.11...moq-ffi-v0.4.12) - 2026-10-06

Expand Down
10 changes: 6 additions & 4 deletions rs/moq-ffi/src/auth.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! What the peer lets a session do.

use crate::error::MoqError;
use crate::ffi::Task;
use crate::ffi::Polled;

/// What the peer lets this side do, in this side's own paths.
///
Expand Down Expand Up @@ -40,14 +40,14 @@ pub struct MoqGrantConsumer {
/// The watch behind [`grant`](Self::grant), which reads without the lock.
peek: moq_net::auth::Watch,
/// The watch behind [`changed`](Self::changed), which tracks what it last returned.
changed: Task<moq_net::auth::Watch>,
changed: Polled<moq_net::auth::Watch>,
}

impl MoqGrantConsumer {
pub(crate) fn new(handle: &moq_net::auth::Handle) -> Self {
Self {
peek: handle.grant(),
changed: Task::new(handle.grant()),
changed: Polled::new(handle.grant()),
}
}
}
Expand All @@ -68,7 +68,9 @@ impl MoqGrantConsumer {
/// session ended, or [`cancel`](Self::cancel). A reconnect is not an end.
pub async fn changed(&self) -> Result<Option<MoqGrant>, MoqError> {
self.changed
.run(|mut watch| async move { Ok(watch.changed().await?.map(Into::into)) })
.wait(|watch, waiter| {
std::task::Poll::Ready(Ok(std::task::ready!(watch.poll_changed(waiter))?.map(Into::into)))
})
.await
}

Expand Down
32 changes: 10 additions & 22 deletions rs/moq-ffi/src/bandwidth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,13 @@ mod tests {
/// An owned bandwidth estimate; holding it requests estimates until released.
#[derive(uniffi::Object)]
pub struct MoqBandwidthConsumer {
inner: std::sync::Mutex<Option<moq_net::bandwidth::Consumer>>,
changed: crate::ffi::Task<()>,
inner: crate::ffi::Polled<moq_net::bandwidth::Consumer>,
}

impl MoqBandwidthConsumer {
pub(crate) fn new(inner: moq_net::bandwidth::Consumer) -> Self {
Self {
inner: std::sync::Mutex::new(Some(inner)),
changed: crate::ffi::Task::new(()),
inner: crate::ffi::Polled::new(inner),
}
}
}
Expand All @@ -378,36 +376,26 @@ impl MoqBandwidthConsumer {
/// The current estimate in bits per second, or None while unavailable.
pub fn rate(&self) -> Option<u64> {
self.inner
.lock()
.unwrap()
.as_ref()
.and_then(moq_net::bandwidth::Consumer::peek)
.peek(moq_net::bandwidth::Consumer::peek)
.flatten()
.map(moq_net::bandwidth::Rate::as_bps)
}

/// Wait for the estimate to change and return the new [`rate`](Self::rate), erroring when
/// its producer closes.
pub async fn rate_changed(&self) -> Result<Option<u64>, MoqError> {
self.changed
.run(|_guard| async move {
moq_net::kio::wait(|waiter| {
let mut inner = self.inner.lock().unwrap();
let inner = inner.as_mut().ok_or(MoqError::Cancelled)?;
inner.poll_changed(waiter).map(|result| {
result
.map(|rate| rate.map(moq_net::bandwidth::Rate::as_bps))
.map_err(Into::into)
})
})
.await
self.inner
.wait(|inner, waiter| {
std::task::Poll::Ready(Ok(
std::task::ready!(inner.poll_changed(waiter))?.map(moq_net::bandwidth::Rate::as_bps)
))
})
.await
}

/// Release this consumer's demand, including a pending wait.
pub fn cancel(&self) {
self.inner.lock().unwrap().take();
self.changed.cancel();
self.inner.cancel();
}
}

Expand Down
Loading
Loading