diff --git a/doc/lib/c/index.md b/doc/lib/c/index.md index d86d4e7af12..ee0d58cddfc 100644 --- a/doc/lib/c/index.md +++ b/doc/lib/c/index.md @@ -90,7 +90,7 @@ across restarts, and raise `epoch` on each: readers stitch every route of one in together, so restarting the sequences under an old instance splices unrelated groups into their tracks. -Raw video encoders take an exact numerator/denominator frame rate, such as 30000/1001. Publication track names stay separate from codec settings. For simulcast, give each rendition the next one down as the `lower` handle in its `moq_video_encode_options`: it stops encoding, advertised as disabled, while its bandwidth grant cannot fund it, and resumes once the grant recovers. A rung only disables while the session probes for bandwidth, which on native transports takes moq-quic with BBR3. +Raw video encoders take an exact numerator/denominator frame rate, such as 30000/1001. Publication track names stay separate from codec settings. For simulcast, give each rendition the next one down as the `lower` handle in its `moq_video_encode_options`: it stops encoding, advertised as disabled, while its bandwidth grant cannot fund it, and resumes once the grant recovers. A rung only disables while the session probes for bandwidth, which on native transports takes moq-quic with BBR3. For pre-encoded video, publish from the lowest rendition up and set `moq_video_init.lower` to the next lower media handle. Reserve each track with `moq_allocator_reserve_media`, then bind its reservation with `moq_rate_control_create` and call `moq_rate_control_update` on every frame. Apply changed targets to your encoder and `moq_publish_media_set_enabled`, resuming video on a keyframe; close the control and reservation separately when done. ## Things to know diff --git a/quest/m1/c/README.md b/quest/m1/c/README.md index 7e1845fc16c..1b6313edb19 100644 --- a/quest/m1/c/README.md +++ b/quest/m1/c/README.md @@ -26,7 +26,3 @@ twice (0.6 to 0.7, then to the generated 0.8); that is the accepted cost. release produces the C archive the samples are checked against. Public API: moq-c gains each m1 binding feature. Wire: none. - -## Required - -- [API gaps](/quest/m1/c/api-gaps.md) - disabling pre-encoded simulcast rungs after the shared importer support lands diff --git a/quest/m1/c/api-gaps.md b/quest/m1/c/api-gaps.md deleted file mode 100644 index 9f8e318afd8..00000000000 --- a/quest/m1/c/api-gaps.md +++ /dev/null @@ -1,30 +0,0 @@ -# [S] moq-c disables pre-encoded simulcast rungs - -## Goal - -moq-c can disable a simulcast rung on pre-encoded media, with its lower -rendition's priority and a rate control driven by the reservation. - -## Plan - -- Add C ABI support for disabling simulcast rungs on pre-encoded media on - [moq-dev/moq#7029](https://github.com/moq-dev/moq/pull/7029)'s shared - importer support. It merged as - [61cb70456d](https://github.com/moq-dev/moq/commit/61cb70456dd0d70909bc2a1c18916331e90b51ea), - so this work is unblocked: main has `moq_mux::import::Track::set_enabled`, - `import::VideoInit.priority`, the AV1/VP8/VP9 importer setters, and the - moq-ffi `MoqRateControl`, `MoqVideoInit.lower`, and media producer - `set_enabled` interfaces. -- Expose media `set_enabled`, lower-rendition ordering, and - a rate control over the C reservation. Inspect the final shared interfaces - first. Decided 2026-10-30 (maintainer, /quest-plan of the 2026-10-30 - /quest-complete follow-ups): the C epic's rule (every m1 binding feature - missing from `moq.h` lands before the cut) overrides that PR's decision 4, - which parked it until a C consumer asked: ✅ add to m1 C gaps / exempt it. - -Update the generated `moq.h`, `rs/moq-c/README.md` and `doc/lib/c` as needed. -The independent JSON window caller timestamp gap is implemented in -[moq-dev/moq#7614](https://github.com/moq-dev/moq/pull/7614). - -Public API: moq-c gains pre-encoded rung disable, lower-rendition ordering, -and reservation rate control. Wire: none. diff --git a/rs/moq-c/MIGRATE.md b/rs/moq-c/MIGRATE.md index 104b94f772b..c9acce77e19 100644 --- a/rs/moq-c/MIGRATE.md +++ b/rs/moq-c/MIGRATE.md @@ -4,6 +4,16 @@ How to update your code for each breaking change, newest first. ## Unreleased +### Pre-encoded simulcast + +`moq_video_init` gains `lower`, changing its C ABI layout. Rebuild against the +regenerated `moq.h` and matching library, zero-initialize the struct, and set +`lower` to the next lower pre-encoded video media handle (0 for none). +Use `moq_publish_media_set_enabled` to advertise disabled video renditions, +and `moq_allocator_reserve_media` with the new `moq_rate_control_*` handles to +adapt an external encoder to its reservation. Close controls and reservations +separately. No wire format changes. + ### Announcements are a listing ([#7678](https://github.com/moq-dev/moq/pull/7678)) `moq_announce_kind` is `MOQ_ANNOUNCE_KIND_PRESENT` (0) or `MOQ_ANNOUNCE_KIND_ABSENT` (1), and `moq_announce_event` loses `predecessor` and `predecessor_len`, changing the C ABI. diff --git a/rs/moq-c/README.md b/rs/moq-c/README.md index 602d93adfd9..898d7ea1002 100644 --- a/rs/moq-c/README.md +++ b/rs/moq-c/README.md @@ -172,3 +172,24 @@ converted to the track's milliseconds; pass NULL to stamp the broadcast clock. int32_t moq_publish_json_window_push(uint32_t window, const char *value, uintptr_t value_len, const moq_timestamp *timestamp); int32_t moq_publish_json_window_pop(uint32_t window, uint64_t count, const moq_timestamp *timestamp); ``` + +### Pre-encoded simulcast + +Publish video renditions from lowest to highest, passing the next lower media +handle in `moq_video_init.lower` (0 for the lowest). This orders delivery so +higher renditions yield to lower ones. `moq_publish_media_set_enabled` updates +the catalog and marks a discontinuity when disabling; resume on a keyframe. +Audio importers do not support this toggle. + +Reserve each media track with `moq_allocator_reserve_media`. Create a +`moq_rate_control_create` handle bound to the reservation, with `moq_rate_policy.max_bps` and, for higher +rungs, `has_lower` and `lower_bps`. Read its initial `moq_rate_control_target`, +then call `moq_rate_control_update` on every frame, +including while disabled. It returns 0 or a negative error; `target.changed` +is true for a new target and false to hold the last one. Apply the target's `bitrate_bps` +to your encoder and `enabled` through `moq_publish_media_set_enabled`. +The shared controller drops immediately, ramps raises, ignores small changes, +and holds without an estimate. A rung disables only with a probing session, +which on native transports requires moq-quic with BBR3, so bandwidth can recover. +Close controls with `moq_rate_control_close` and reservations with +`moq_reservation_close`; neither owns or closes the media track. diff --git a/rs/moq-c/c-tests/rate-control.c b/rs/moq-c/c-tests/rate-control.c new file mode 100644 index 00000000000..89bb5ad3e65 --- /dev/null +++ b/rs/moq-c/c-tests/rate-control.c @@ -0,0 +1,16 @@ +// Exercise rate-control records and handle ownership across the generated C ABI. +#include +#include + +int main(void) { + moq_video_init video = {0}; + assert(video.lower == 0); + moq_rate_policy policy = {.max_bps = 4000000, .lower_bps = 2000000, .has_lower = true}; + // A control refuses an invalid reservation at setup. + assert(moq_rate_control_create(0, policy) < 0); + moq_rate_target target = {0}; + assert(moq_rate_control_target(0, &target) < 0); + assert(moq_rate_control_update(0, &target) < 0); + assert(moq_rate_control_close(0) < 0); + return 0; +} diff --git a/rs/moq-c/src/api.rs b/rs/moq-c/src/api.rs index f00cb6bf943..788405c5024 100644 --- a/rs/moq-c/src/api.rs +++ b/rs/moq-c/src/api.rs @@ -269,6 +269,9 @@ pub struct moq_video_init { /// Catalog fields the bitstream cannot reveal itself. Zeroed means none. pub hint: moq_video_hint, + /// Next lower pre-encoded video media handle, or 0 for the lowest rendition. + /// Publish it first; this track gets one priority below it, saturating at -128. + pub lower: u32, } /// Optional catalog fields for [moq_video_init::hint]. @@ -2622,6 +2625,12 @@ unsafe fn parse_video_init( let mut video = moq_mux::import::VideoInit::new(video_format_from_u32(config.format)?, init.to_vec()); video.label = label.map(str::to_string); video.hint = config.hint.resolve()?; + if config.lower != 0 { + video.priority = State::lock() + .publish + .media_video_priority(ffi::parse_id(config.lower)?)? + .saturating_sub(1); + } Ok((video, config.hint.group_duration()?)) } @@ -2849,6 +2858,16 @@ pub unsafe extern "C" fn moq_publish_media_frame( }) } +/// Enable or disable a pre-encoded media rendition in its catalog. +/// +/// Disabling publishes a discontinuity and stops frames; resume video on a keyframe. +/// Audio importers reject this operation. +/// Returns zero on success or a negative error. +#[unsafe(no_mangle)] +pub extern "C" fn moq_publish_media_set_enabled(media: u32, enabled: bool) -> i32 { + ffi::enter(move || State::lock().publish.media_set_enabled(ffi::parse_id(media)?, enabled)) +} + /// Mark a timeline break without lowering the advertised jitter or delay. /// /// Publishes a discontinuity marker; resumed frames must continue the broadcast media clock, diff --git a/rs/moq-c/src/bandwidth.rs b/rs/moq-c/src/bandwidth.rs index 19a1d2170ca..98fa9bc3ad4 100644 --- a/rs/moq-c/src/bandwidth.rs +++ b/rs/moq-c/src/bandwidth.rs @@ -13,9 +13,26 @@ pub(crate) struct Bandwidth { reservations: NonZeroSlab>, consumers: NonZeroSlab>, viewers: NonZeroSlab, + controls: NonZeroSlab, viewer: NonZeroSlab, } +struct RateControl { + inner: moq_mux::rate::Control, + grant: moq_net::bandwidth::Consumer, +} + +impl RateControl { + fn update(&mut self) -> Option { + self.apply(self.grant.peek(), self.grant.probed()) + } + + fn apply(&mut self, grant: Option, probed: bool) -> Option { + self.inner.set_probed(probed); + self.inner.update(grant, kio::clock::now()) + } +} + impl Bandwidth { pub fn insert(&mut self, allocator: moq_net::bandwidth::Allocator) -> Result { self.allocators.insert(allocator) @@ -403,8 +420,176 @@ pub extern "C" fn moq_bandwidth_consumer_close(consumer: u32) -> i32 { }) } +/// Reserve up to `max_bps` for a pre-encoded media track, returning a reservation handle. +/// Close it with `moq_reservation_close`; it does not own the media handle. +#[unsafe(no_mangle)] +pub extern "C" fn moq_allocator_reserve_media(allocator: u32, media: u32, max_bps: u64) -> i32 { + ffi::enter(move || { + let mut state = State::lock(); + let demand = state.publish.media_demand(ffi::parse_id(media)?)?; + state.bandwidth.reserve(ffi::parse_id(allocator)?, &demand, max_bps) + }) +} + +/// How a rate control maps a reservation grant onto a sender's bitrate. +#[repr(C)] +pub struct moq_rate_policy { + /// Maximum bitrate the sender produces, in bits per second. + pub max_bps: u64, + /// Next lower rendition's maximum bitrate, when `has_lower` is true. + pub lower_bps: u64, + /// Whether this sender has a lower rendition; the lowest never disables. + pub has_lower: bool, +} + +/// What the sender should produce until its rate control changes again. +#[repr(C)] +pub struct moq_rate_target { + /// Whether to produce frames and advertise the rendition as enabled. + pub enabled: bool, + /// Bitrate to produce in bits per second, or 0 when disabled. + pub bitrate_bps: u64, + /// Whether `moq_rate_control_update` changed the target; always false from `moq_rate_control_target`. + pub changed: bool, +} + +impl From for moq_rate_target { + fn from(target: moq_mux::rate::Target) -> Self { + match target { + moq_mux::rate::Target::Enabled(rate) => Self { + enabled: true, + bitrate_bps: rate.as_bps(), + changed: false, + }, + moq_mux::rate::Target::Disabled => Self { + enabled: false, + bitrate_bps: 0, + changed: false, + }, + } + } +} + +/// Create a rate control following this reservation, starting at the policy's maximum bitrate. +/// +/// A zero `max_bps` is rejected with `MOQ_ERROR_INVALID_CONFIG`. +#[unsafe(no_mangle)] +pub extern "C" fn moq_rate_control_create(reservation: u32, policy: moq_rate_policy) -> i32 { + ffi::enter(move || { + if policy.max_bps == 0 { + return Err(Error::InvalidConfig("max_bps must be nonzero".into())); + } + let mut native = moq_mux::rate::Policy::new(moq_net::bandwidth::Rate::from_bps(policy.max_bps)); + native.lower = policy + .has_lower + .then(|| moq_net::bandwidth::Rate::from_bps(policy.lower_bps)); + let mut state = State::lock(); + let grant = state.bandwidth.reservation(ffi::parse_id(reservation)?)?.consume(); + state.bandwidth.controls.insert(RateControl { + inner: moq_mux::rate::Control::new(native), + grant, + }) + }) +} + +/// Read the current sender target, returning zero or a negative error. +/// +/// # Safety +/// - `target` must point to writable storage for one target. +#[unsafe(no_mangle)] +pub unsafe extern "C" fn moq_rate_control_target(control: u32, target: *mut moq_rate_target) -> i32 { + ffi::enter(move || { + let target = unsafe { target.as_mut() }.ok_or(Error::InvalidPointer)?; + *target = State::lock() + .bandwidth + .controls + .get(ffi::parse_id(control)?) + .ok_or(Error::NotFound)? + .inner + .target() + .into(); + Ok(()) + }) +} + +/// Follow the bound reservation's grant on every frame, returning zero or a negative error. +/// +/// `target.changed` is true when the target changed and false to hold the last target. +/// +/// Drops apply immediately; raises ramp and small moves are ignored. No estimate holds the +/// target. Disabling requires a probing session so the grant can recover. Apply a changed +/// target to your encoder and `moq_publish_media_set_enabled`. Closing the reservation holds +/// the last target; the control owns neither the reservation nor media. +/// +/// # Safety +/// - `target` must point to writable storage; its other fields are written only when `changed` is true. +#[unsafe(no_mangle)] +pub unsafe extern "C" fn moq_rate_control_update(control: u32, target: *mut moq_rate_target) -> i32 { + ffi::enter(move || { + let target = unsafe { target.as_mut() }.ok_or(Error::InvalidPointer)?; + let mut state = State::lock(); + let control = state + .bandwidth + .controls + .get_mut(ffi::parse_id(control)?) + .ok_or(Error::NotFound)?; + match control.update() { + Some(next) => { + *target = next.into(); + target.changed = true; + } + None => target.changed = false, + } + Ok(()) + }) +} + +/// Release a rate control without closing its reservation or media. +#[unsafe(no_mangle)] +pub extern "C" fn moq_rate_control_close(control: u32) -> i32 { + ffi::enter(move || { + State::lock() + .bandwidth + .controls + .remove(ffi::parse_id(control)?) + .ok_or(Error::NotFound)?; + Ok(()) + }) +} + #[cfg(test)] mod consumer_tests { + #[tokio::test(start_paused = true)] + async fn rate_control_probing_disables_and_recovers() { + use moq_mux::rate::{Control, Policy, Target}; + use moq_net::bandwidth::Rate; + let estimate = moq_net::bandwidth::Producer::new(); + let mut policy = Policy::new(Rate::from_bps(6_000_000)); + policy.lower = Some(Rate::from_bps(2_000_000)); + let mut control = RateControl { + inner: Control::new(policy), + grant: estimate.consume(), + }; + assert_eq!( + control.apply(Some(Rate::from_bps(3_000_000)), true), + Some(Target::Disabled) + ); + assert_eq!(control.apply(None, true), None); + tokio::time::advance(std::time::Duration::from_secs(4)).await; + assert!(matches!( + control.apply(Some(Rate::from_bps(6_000_000)), true), + Some(Target::Enabled(_)) + )); + assert_eq!( + control.apply(Some(Rate::from_bps(3_000_000)), true), + Some(Target::Disabled) + ); + assert!(matches!( + control.apply(Some(Rate::from_bps(3_000_000)), false), + Some(Target::Enabled(_)) + )); + } + use super::*; use crate::ffi::ReturnCode; diff --git a/rs/moq-c/src/publish.rs b/rs/moq-c/src/publish.rs index 9eb045961a6..9fc5eddc906 100644 --- a/rs/moq-c/src/publish.rs +++ b/rs/moq-c/src/publish.rs @@ -196,9 +196,27 @@ impl Kept { } } -impl Abort for Kept> { +struct Media { + track: Box, + video_priority: Option, +} + +impl std::ops::Deref for Media { + type Target = import::Track; + fn deref(&self) -> &Self::Target { + &self.track + } +} + +impl std::ops::DerefMut for Media { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.track + } +} + +impl Abort for Kept { fn abort(self, err: moq_net::Error) { - self.inner.abort(err); + self.inner.track.abort(err); } } @@ -285,7 +303,7 @@ pub struct Publish { /// Single-codec media importers, fed timestamped frames. // Boxed because the codec splitters/imports are much larger than the container ones. - media: NonZeroSlab>>, + media: NonZeroSlab>, /// Container importers, fed whole chunks. A separate space from `media` because a /// container publishes several tracks and carries its own timing, so it takes no @@ -525,9 +543,17 @@ impl Publish { } /// Insert a media importer as a child of the broadcast `children` belongs to. - fn insert_media(&mut self, track: import::Track, children: Children) -> Result { + fn insert_media( + &mut self, + track: import::Track, + children: Children, + video_priority: Option, + ) -> Result { let media = Kept { - inner: Box::new(track), + inner: Media { + track: Box::new(track), + video_priority, + }, children: children.clone(), }; children.insert(&mut self.media, media, Child::Media) @@ -555,7 +581,7 @@ impl Publish { let track = import::Track::audio(request, catalog.reserve().with_interval(interval), init)?; let children = children.clone(); - self.insert_media(track, children) + self.insert_media(track, children, None) } /// `interval` as in [`Self::audio`]. @@ -575,9 +601,10 @@ impl Publish { let name = broadcast.unique_name(&format!(".{}", init.format)); let request = broadcast.reserve_track(name)?; + let priority = init.priority; let track = import::Track::video(request, catalog.reserve().with_interval(interval), init)?; let children = children.clone(); - self.insert_media(track, children) + self.insert_media(track, children, Some(priority)) } pub fn container(&mut self, broadcast: Id, init: import::ContainerInit) -> Result { @@ -598,6 +625,22 @@ impl Publish { children.insert(&mut self.containers, container, Child::Container) } + pub fn media_video_priority(&self, media: Id) -> Result { + self.media + .get(media) + .ok_or(Error::MediaNotFound)? + .video_priority + .ok_or_else(|| Error::InvalidConfig("the lower rendition is not video".into())) + } + + pub fn media_set_enabled(&mut self, media: Id, enabled: bool) -> Result<(), Error> { + self.media + .get_mut(media) + .ok_or(Error::MediaNotFound)? + .set_enabled(enabled)?; + Ok(()) + } + pub fn media_frame(&mut self, media: Id, data: &[u8], timestamp: hang::container::Timestamp) -> Result<(), Error> { let track = self.media.get_mut(media).ok_or(Error::MediaNotFound)?; track.decode(data, Some(timestamp))?; @@ -1057,7 +1100,7 @@ impl Publish { } = self.track_request.remove(request).ok_or(Error::NotFound)?; let catalog = self.catalog(broadcast)?; let track = import::Track::audio(request, catalog.reserve().with_interval(interval), init)?; - self.insert_media(track, children) + self.insert_media(track, children, None) } /// Accept a track request as a video track, returning a media handle like [`Self::video`]. @@ -1073,8 +1116,9 @@ impl Publish { request, } = self.track_request.remove(request).ok_or(Error::NotFound)?; let catalog = self.catalog(broadcast)?; + let priority = init.priority; let track = import::Track::video(request, catalog.reserve().with_interval(interval), init)?; - self.insert_media(track, children) + self.insert_media(track, children, Some(priority)) } /// Reject a track request, failing every subscriber waiting on it with `error_code`. diff --git a/rs/moq-c/src/test.rs b/rs/moq-c/src/test.rs index c49fd18d9a8..427c06f00fd 100644 --- a/rs/moq-c/src/test.rs +++ b/rs/moq-c/src/test.rs @@ -413,6 +413,7 @@ fn publish_audio(broadcast: u32, format: moq_audio_format, init: &[u8], label: O fn publish_video(broadcast: u32, format: moq_video_format, init: &[u8], label: Option<&[u8]>) -> i32 { let (label, label_len) = label_ptr(label); let config = moq_video_init { + lower: 0, format: format as u32, init: init_ptr(init), init_len: init.len(), @@ -8229,6 +8230,7 @@ fn track_request_media_carries_hints() { let request = id(request_cb.recv()); let h264 = h264_init(); let video_config = moq_video_init { + lower: 0, format: moq_video_format::MOQ_VIDEO_FORMAT_AVC3 as u32, init: h264.as_ptr(), init_len: h264.len(), @@ -8283,6 +8285,7 @@ fn invalid_hints_are_refused() { }; let video = |hint: moq_video_hint| { let config = moq_video_init { + lower: 0, format: moq_video_format::MOQ_VIDEO_FORMAT_AVC3 as u32, init: h264.as_ptr(), init_len: h264.len(), @@ -8392,3 +8395,101 @@ fn group_duration_hint_declares_the_join_interval() { assert_eq!(moq_publish_close(broadcast), 0); assert_eq!(moq_origin_close(origin), 0); } + +#[test] +fn preencoded_rungs_and_rate_control() { + let origin = id(moq_origin_create()); + let broadcast = publish_broadcast(origin, b"preencoded-rungs"); + let init = h264_init(); + let config = |lower| moq_video_init { + format: moq_video_format::MOQ_VIDEO_FORMAT_AVC3 as u32, + init: init.as_ptr(), + init_len: init.len(), + label: std::ptr::null(), + label_len: 0, + hint: moq_video_hint::default(), + lower, + }; + let low = id(unsafe { moq_publish_video(broadcast, &config(0)) }); + let high = id(unsafe { moq_publish_video(broadcast, &config(low)) }); + { + let state = State::lock(); + assert_eq!( + state + .publish + .media_video_priority(crate::ffi::parse_id(high).unwrap()) + .unwrap(), + state + .publish + .media_video_priority(crate::ffi::parse_id(low).unwrap()) + .unwrap() - 1 + ); + } + assert_eq!(moq_publish_media_set_enabled(high, false), 0); + assert_eq!( + published_catalog(broadcast) + .video + .renditions + .values() + .filter(|r| !r.enabled) + .count(), + 1 + ); + assert_eq!(moq_publish_media_set_enabled(high, true), 0); + assert!( + published_catalog(broadcast) + .video + .renditions + .values() + .all(|r| r.enabled) + ); + let (allocator, estimate) = test_allocator(); + let reservation = id(moq_allocator_reserve_media(allocator, high, 4_000_000)); + let control = id(moq_rate_control_create( + reservation, + moq_rate_policy { + max_bps: 4_000_000, + lower_bps: 2_000_000, + has_lower: true, + }, + )); + let mut target = moq_rate_target { + enabled: false, + bitrate_bps: 0, + changed: true, + }; + assert!( + moq_rate_control_create( + reservation, + moq_rate_policy { + max_bps: 0, + lower_bps: 0, + has_lower: false, + }, + ) < 0 + ); + assert_eq!(unsafe { moq_rate_control_target(control, &mut target) }, 0); + assert!(target.enabled); + assert_eq!(target.bitrate_bps, 4_000_000); + assert!(!target.changed); + assert_eq!(unsafe { moq_rate_control_update(control, &mut target) }, 0); + assert!(!target.changed); + estimate + .set(Some(moq_net::bandwidth::Rate::from_bps(1_000_000))) + .unwrap(); + assert_eq!(unsafe { moq_rate_control_update(control, &mut target) }, 0); + assert!(target.changed); + // Without a probing session a rung must stay on so its grant can recover. + assert!(target.enabled); + assert_eq!(target.bitrate_bps, 1_000_000); + assert_eq!(unsafe { moq_rate_control_update(control, &mut target) }, 0); + assert!(!target.changed); + assert_eq!(moq_reservation_close(reservation), 0); + assert_eq!(moq_rate_control_close(control), 0); + assert_eq!(moq_allocator_close(allocator), 0); + assert_eq!(moq_publish_media_finish(high), 0); + assert!(unsafe { moq_publish_video(broadcast, &config(high)) } < 0); + assert_eq!(moq_publish_media_finish(low), 0); + assert_eq!(moq_publish_close(broadcast), 0); + assert_eq!(moq_origin_close(origin), 0); +}