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
10 changes: 4 additions & 6 deletions ffi/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ set shell := ["bash", "-euo", "pipefail", "-c"]

export PATH := if env("RUST2_TS_TOOLCHAIN", "") == "" { env("PATH") } else { env("RUST2_TS_TOOLCHAIN") / "bin:" + env("PATH") }

# The moq revision these recipes export by default, behind `just ts moq`'s: moq's later API
# needs moq/ffi.toml to follow it, and past moq-dev/moq#7032 moq-tokio's `Send` check
# overflows the recursion limit `moq-export` denies.
moq_rev := "30f25c04e6d0288d87893dc609ba582518be2cf6"
# The moq revision these recipes export by default: `just ts`'s, so both follow one moq.
moq_rev := shell(just_executable() + " --justfile ../ts/justfile --evaluate moq_rev")

default:
@just --list
Expand Down Expand Up @@ -241,7 +239,7 @@ standin checkout="":
dir=target/moq-ffi
# moq-ffi's dependencies among the exports, moq-tokio with its default features as
# moq-ffi has them, and moq-pattern and kio, which moq-ffi reaches through moq-net.
exports=(hang kio moq-clock moq-mux moq-net moq-pattern moq-tokio)
exports=(hang kio moq-mux moq-net moq-pattern moq-tokio)
mkdir -p "$dir/src"
{
printf '# Generated by just ffi standin, from %s.\n' "$src"
Expand All @@ -258,7 +256,7 @@ standin checkout="":
# moq's lockfile pins what moq's own builds use.
cp "$src/Cargo.lock" "$dir/Cargo.lock"

# Check out the pinned moq revision in target/moq, apart from `just ts`'s so each builds its own pin, copying the objects its clone already has.
# Check out the pinned moq revision in target/moq, apart from `just ts`'s so neither recipe touches the other's checkout, copying the objects its clone already has.
[private]
moq-pin:
[ -d target/moq/.git ] || git clone --quiet --filter=blob:none --reference-if-able ../ts/target/moq --dissociate https://github.com/moq-dev/moq target/moq
Expand Down
3 changes: 2 additions & 1 deletion ffi/moq/bench/moq-c.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ int main(void) {
for (int g = 0; g < GROUPS; g++) {
int32_t group = moq_publish_track_group((uint32_t)track);
for (int f = 0; f < FRAMES; f++) {
if (moq_publish_group_frame((uint32_t)group, payload, sizeof payload, micros++) < 0) {
moq_timestamp at = {.value = micros++, .scale = 1000000};
if (moq_publish_group_frame((uint32_t)group, payload, sizeof payload, &at) < 0) {
return 2;
}
}
Expand Down
155 changes: 106 additions & 49 deletions ffi/moq/ffi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ exclude = [
"DecodeError",
"Driver",
"IntoBytes",
"InvalidEpoch",
"InvalidInstance",
"Path::from_static",
"Path::parts",
"Server::accept",
"Server::accept_request",
"Timed",
Expand All @@ -25,7 +26,10 @@ exclude = [
"announce::Announce",
"announce::Consumer::poll_synced",
"auth::EmptyToken",
"broadcast::Lister::poll_unwanted",
"broadcast::Lister::poll_wanted",
"bytes",
"datagram::Producer::poll_priority",
"frame::Buffer",
"frame::Producer::group",
"goaway::Consumer::poll",
Expand All @@ -39,8 +43,6 @@ exclude = [
"track::Resolving",
"track::Subscribing",
"transport::Error",
"transport::MaybeSend",
"transport::MaybeSync",
"transport::memory::Chunks",
"transport::memory::SendStream",
"transport::poll::AcceptBi",
Expand Down Expand Up @@ -74,33 +76,13 @@ exclude = [
"session::Stats" = "session_stats_snapshot"
# The rule makes both this type and `Path::relative` `moq_path_relative`.
"path::Relative" = "relative"
# The rule makes both this enum and `auth::Request::kind` `moq_auth_request_kind`.
"auth::RequestKind" = "request_kind"

# Exported with moq-net, whose signatures name their types, such as `Patterns` and `Instant`.
# Exported with moq-net, whose signatures name its types, such as `Patterns`.
[crates.moq-pattern]
exclude = ["Pattern::captures"]

[crates.moq-clock]
exclude = [
"Deadline::poll",
"Deadlines::enter",
"Elapsed",
"Entered",
"Instant::from_std",
"Instant::into_std",
"OutOfRange",
"Sleep",
"Timeout",
"drive",
"timeout",
"timeout_at",
]

[crates.moq-clock.rename]
# The rule makes both this function and the type `Wall` `moq_wall`.
"wall" = "now_wall"
# The rule makes both this function and the type `Interval` `moq_interval`.
"interval" = "interval_every"

[crates.moq-tokio]
exclude = [
"Addrs",
Expand All @@ -123,6 +105,7 @@ exclude = [
"cli::answer",
"cli::check_env",
"cli::usage_rs",
"congestion",
"connect::Addr::pinned",
"connection::Monitor::poll_presence",
"crypto::install_default",
Expand All @@ -132,40 +115,37 @@ exclude = [
"notify",
"panic::isolate",
"panic::message",
"quic::Controller::0",
"quic::Error",
"quic::demux::Counters",
"quic::demux::Datagram::local",
"quic::demux::Demux::counters",
"quic::demux::Discard",
"quic::demux::Pin",
"quic::demux::Transmit",
"quic::demux::WebRtc::pin",
"quic::demux::WebRtc::poll_send",
"quic::demux::WebRtc::send",
"quic::driver::ApplicationClose",
"quic::driver::Chunk",
"quic::driver::ClosedStream",
"quic::driver::ConfigError",
"quic::driver::ConnectionClose",
"quic::driver::ConnectionId",
"quic::driver::ConnectionIdGenerator",
"quic::driver::CreditStats",
"quic::driver::Dir",
"quic::driver::EcnCodepoint",
"quic::driver::FrameStats",
"quic::driver::FrameType",
"quic::driver::InvalidCid",
"quic::driver::Lease",
"quic::driver::Limits",
"quic::driver::LimitsError",
"quic::driver::PathStats",
"quic::driver::ReadError",
"quic::driver::ReadExactError",
"quic::driver::ReadToEndError",
"quic::driver::RecvStream",
"quic::driver::ResetError",
"quic::driver::SendStream",
"quic::driver::StoppedError",
"quic::driver::StreamId",
"quic::driver::Rate",
"quic::driver::Transmit",
"quic::driver::TransportErrorCode",
"quic::driver::UdpStats",
"quic::driver::VarInt",
"quic::driver::VarIntBoundsExceeded",
"quic::driver::Version",
"quic::driver::WriteError",
"quic::driver::Written",
"quic::driver::client",
"quic::driver::connection::Connecting",
"quic::driver::connection::Connection::accept_bi",
Expand All @@ -178,12 +158,17 @@ exclude = [
"quic::driver::connection::Connection::open_bi",
"quic::driver::connection::Connection::open_uni",
"quic::driver::connection::Connection::peer_identity",
"quic::driver::connection::Connection::poll_accept_bi",
"quic::driver::connection::Connection::poll_accept_uni",
"quic::driver::connection::Connection::poll_closed",
"quic::driver::connection::Connection::poll_open_bi",
"quic::driver::connection::Connection::poll_open_uni",
"quic::driver::connection::Connection::poll_recv_datagram",
"quic::driver::connection::Connection::read_datagram",
"quic::driver::connection::Connection::send_datagram",
"quic::driver::connection::Connection::set_limits",
"quic::driver::connection::Connection::stats",
"quic::driver::connection::Error",
"quic::driver::connection::SendDatagramError",
"quic::driver::connection::Stats",
"quic::driver::crypto",
"quic::driver::endpoint::AsyncUdpSocket",
Expand All @@ -194,14 +179,49 @@ exclude = [
"quic::driver::endpoint::Error",
"quic::driver::endpoint::Incoming",
"quic::driver::endpoint::Socket",
"quic::driver::recv::Error",
"quic::driver::recv::Lease",
"quic::driver::recv::Stream",
"quic::driver::send::Error",
"quic::driver::send::Finished",
"quic::driver::send::Offset",
"quic::driver::send::Options::group",
"quic::driver::send::Stream",
"quic::driver::server",
"quic::driver::stream",
"quic::driver::transport",
"quic::web::ConnectError",
"quic::web::Request::reject",
"quic::web::Request::respond",
"quic::web::Session::poll_open_request",
"quic::web::Session::poll_recv_datagram",
"quic::web::Session::request",
"quic::web::Session::response",
"quic::web::Session::stats",
"quic::web::WebTransportError",
"quic::web::http",
"quic::web::proto",
"quic::web::recv::Stream::id",
"quic::web::recv::Stream::poll_lease",
"quic::web::recv::Stream::poll_read",
"quic::web::recv::Stream::poll_reset",
"quic::web::recv::Stream::read",
"quic::web::recv::Stream::read_exact",
"quic::web::send::Finished",
"quic::web::send::Stream::id",
"quic::web::send::Stream::poll_closed",
"quic::web::send::Stream::set_group",
"quic::web::send::Stream::write",
"rustls",
"secret::Secret::as_bytes",
"server::Config::websocket",
"server::Request::with_quic_limits",
"server::Request::within",
"tcp::Error",
"tcp::Listener",
"tcp::TlsAcceptor::accept",
"tcp::TlsAcceptor::config",
"tcp::TlsAcceptor::offered",
"tls::Connect::build",
"tls::Identity::generate",
"tls::Listen::load_roots",
Expand All @@ -211,10 +231,6 @@ exclude = [
"tls::Serve::config",
"tls::Serve::resolver",
"tls::parse_fingerprint",
"transport::Error",
"transport::RecvStream",
"transport::SendStream",
"transport::Session",
"unix::Error",
"watch::Files",
"websocket::Error",
Expand Down Expand Up @@ -244,6 +260,7 @@ exclude = [

[crates.hang]
exclude = [
"Catalog::contributions",
"Catalog::from_reader",
"Catalog::subscribe",
"catalog::Audio::enabled",
Expand Down Expand Up @@ -287,6 +304,11 @@ exclude = [
# `moq_catalog_<audio|video>_codec_kind`.
"catalog::AudioCodecKind" = "audio_codec_kind"
"catalog::VideoCodecKind" = "video_codec_kind"
# The rule makes both this method and the field `media` `moq_hang_catalog_media`. A rename
# by the generic path would name every instance's alike.
"Catalog::media" = "hang_catalog_to_media"
"Catalog<moq_mux::catalog::hang::Extra>::media" = "hang_catalog_extra_to_media"
"Catalog<moq_mux::container::ts::Ext>::media" = "hang_catalog_ext_to_media"

[crates.moq-mux]
exclude = [
Expand Down Expand Up @@ -338,6 +360,8 @@ exclude = [
"container::fmp4::mp4_atom",
"container::mkv::Error",
"container::mkv::Export",
"container::mp4::Export",
"container::mp4::repair",
"container::ts::Catalog",
"container::ts::Export",
"container::ts::Follower",
Expand All @@ -347,11 +371,18 @@ exclude = [
"container::ts::MultipleProgramsError",
"container::ts::Programs::decode",
"container::ts::Programs::finish",
"container::ts::Restart",
"container::ts::stats::Export::streams",
"container::ts::stats::Snapshot::streams",
"follow::Event",
"follow::Instances",
"json::Consumer",
"select::Selected::audio",
"select::Selected::video",
"timeline::Mapping",
"timeline::Resume",
"timeline::Track::apply",
"timeline::Track::resume",
]

[crates.moq-mux.rename]
Expand All @@ -362,7 +393,9 @@ exclude = [
"catalog::Consumer" = "mux_catalog_consumer"
# The rule makes both this constant and `CatalogFormat`'s `Default` `moq_catalog_catalog_format_default`.
"catalog::CatalogFormat::DEFAULT" = "catalog_catalog_format_fallback"
# The rule makes both this constant and the method `Clock::timescale` `moq_clock_timescale`.
# The rule makes this media clock's methods, such as `now`, kio's clock's: `moq_clock_now`.
"Clock" = "mux_clock"
# The rule makes both this constant and the method `Clock::timescale` `moq_mux_clock_timescale`.
"Clock::TIMESCALE" = "clock_fixed_timescale"
# The rule makes each of these functions and its module's `Config` `moq_codec_<codec>_config`.
"codec::aac::config" = "codec_aac_audio_config"
Expand All @@ -372,7 +405,8 @@ exclude = [
"container::fmp4::Chunk::init" = "container_fmp4_chunk_into_init"
"container::fmp4::Chunk::fragment" = "container_fmp4_chunk_into_fragment"

# The waiter a driver's poll registers, which C makes from its waker and holds across polls.
# The waiter a driver's poll registers, which C makes from its waker and holds across polls,
# and the clock it polls at.
[crates.kio]
exclude = [
"Bridge",
Expand All @@ -381,7 +415,6 @@ exclude = [
"ConsumerWeak",
"Lock",
"LockGuard",
"MaybeSend",
"Mut",
"Park::hold",
"Pending",
Expand All @@ -392,17 +425,41 @@ exclude = [
"Ref",
"Shared",
"Task",
"TaskKey",
"Tasks",
"Unused",
"Unwanted",
"Waiter::batch",
"Waiter::context",
"Waiter::poll_future",
"Waiter::waker",
"Watch",
"Weak",
"clock::Deadline::poll",
"clock::Deadlines::enter",
"clock::Elapsed",
"clock::Entered",
"clock::Instant::from_std",
"clock::Instant::into_std",
"clock::OutOfRange",
"clock::Rng",
"clock::Sleep",
"clock::Timeout",
"clock::drive",
"clock::rng",
"clock::timeout",
"clock::timeout_at",
"coop::Budget::poll_yield",
"log::Evicted",
"log::Read",
"log::Reader",
"log::Writer",
"machine",
"wait",
"wrapper",
]

[crates.kio.rename]
# The rule makes both this function and the type `clock::Wall` `moq_clock_wall`.
"clock::wall" = "clock_now_wall"
# The rule makes both this function and the type `clock::Interval` `moq_clock_interval`.
"clock::interval" = "clock_interval_every"
Loading