pub struct Import { /* private fields */ }Expand description
Opus importer.
Publishes raw Opus frames (no Ogg framing) to a single moq track. Build it with
new, passing the track producer and the
catalog::Reserved it reserves its rendition from.
Every Opus packet is independently decodable, so decode marks only the first
frame of each group a keyframe (the rest extend it): frames accumulate into the current group
until the caller cuts. The
import::Track facade cuts once a group (one QUIC stream) holds 100 ms,
as Join says. Opus’ packet loss concealment handles drops.
Implementations§
Source§impl Import
impl Import
Sourcepub fn new<E: CatalogExt>(
track: Producer,
reserved: Reserved<E>,
config: AudioConfig,
) -> Result<Self>
pub fn new<E: CatalogExt>( track: Producer, reserved: Reserved<E>, config: AudioConfig, ) -> Result<Self>
Publish on an existing track producer with a resolved catalog config.
Audio can’t derive its config from frames, so the caller passes a complete
AudioConfig (build one from an OpusHead with config, or
from an out-of-band Config via into()). The rendition publishes immediately.
Sourcepub fn finish(self) -> Result<Finished<Wire, AudioConfig>>
pub fn finish(self) -> Result<Finished<Wire, AudioConfig>>
Finish the track, flushing the current group, and return the Finished
track, which keeps it and its catalog rendition published.
A finish that fails ends the track with the cause instead, so it can’t be retried.
Sourcepub fn abort(self, err: Error)
pub fn abort(self, err: Error)
Abort the track with err instead of finishing it cleanly, so subscribers
see the real cause rather than [moq_net::Error::Dropped]. Consumes this importer.
Sourcepub fn cut(&mut self, end: Option<Timestamp>) -> Result<()>
pub fn cut(&mut self, end: Option<Timestamp>) -> Result<()>
Cut the current group at end without finishing the track.
Sourcepub fn discontinuity(&mut self) -> Result<()>
pub fn discontinuity(&mut self) -> Result<()>
Mark a break in the timeline by publishing a marker group. To bound the closing
group’s final frame first, cut(end) before this. See
Producer::discontinuity.
Sourcepub fn decode<B: IntoBytes>(
&mut self,
frame: B,
pts: Option<Timestamp>,
) -> Result<()>
pub fn decode<B: IntoBytes>( &mut self, frame: B, pts: Option<Timestamp>, ) -> Result<()>
Publish one Opus packet, stamping pts or a wall clock when absent.
Opus is independently decodable, so the packet is marked a keyframe only when it starts a group
(see Producer::needs_keyframe); otherwise it
extends the current group. The caller bounds groups via cut.