pub struct Producer { /* private fields */ }Expand description
Publishes encoded video frames as a moq track (avc3 / hev1 depending on the codec).
Built on the async side so the track is advertised (and the catalog
registered) before the camera opens; this is what lets a subscriber
trigger capture on demand. The moq_mux::codec importer for the codec
handles catalog registration and framing.
Implementations§
Source§impl Producer
impl Producer
Sourcepub fn publish(&mut self, encoded: &[Encoded]) -> Result<(), Error>
pub fn publish(&mut self, encoded: &[Encoded]) -> Result<(), Error>
Publish already-encoded frames, each at its own timestamp. Each frame is one whole access unit in the producer’s codec framing.
Sourcepub fn discontinuity(&mut self) -> Result<(), Error>
pub fn discontinuity(&mut self) -> Result<(), Error>
Mark a break in the published timeline: whatever is published next does not continue what came before.
Call this when the encoder stops rather than merely pausing between frames – a
capture that goes idle, a source switch, anything that will resume on a re-anchored
clock. See Producer::discontinuity
for what the marker buys a consumer.
Sourcepub fn finish(self) -> Result<(), Error>
pub fn finish(self) -> Result<(), Error>
Finalize the track.
Consumes the producer: nothing can be published after the track ends, so this is the last call rather than one leaving a dead producer in your hands.
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 the producer, like finish.