Skip to main content

moq_consume_audio_ordered

Function moq_consume_audio_ordered 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn moq_consume_audio_ordered( catalog: u32, index: u32, max_latency_ms: u64, on_frame: Option<extern "C" fn(user_data: *mut c_void, frame: i32)>, user_data: *mut c_void, ) -> i32
Expand description

Consume an audio track from a broadcast, emitting the frames in order.

on_frame is called with a positive frame ID per frame, then exactly once more with a terminal code: 0 (closed cleanly) or a negative error. After the terminal (<= 0) callback, on_frame is never called again and user_data is never touched again, so release user_data there. The terminal callback fires even after moq_consume_audio_close. The max_latency_ms parameter controls how long to wait before skipping frames.

Returns a non-zero handle to the track on success, or a negative code on failure.

ยงSafety

  • The caller must keep user_data valid until the terminal (<= 0) on_frame callback.