pub struct TrackProducer {
pub inner: TrackProducer,
/* private fields */
}Expand description
A producer for media tracks.
This wraps a moq_lite::TrackProducer and adds hang-specific functionality
like automatic timestamp encoding and keyframe-based group management.
§Group Management
Groups are automatically created and managed based on keyframes:
- When a keyframe is written, the current group is finished and a new one begins.
- Non-keyframes are appended to the current group.
- Each frame includes a timestamp header for proper playback timing.
Fields§
§inner: TrackProducerImplementations§
Source§impl TrackProducer
impl TrackProducer
Sourcepub fn new(inner: TrackProducer) -> Self
pub fn new(inner: TrackProducer) -> Self
Create a new TrackProducer wrapping the given moq-lite producer.
Sourcepub fn write(&mut self, frame: Frame)
pub fn write(&mut self, frame: Frame)
Write a frame to the track.
The frame’s timestamp is automatically encoded as a header, and keyframes trigger the creation of new groups for efficient seeking and caching.
All frames should be in decode order.
The timestamp is usually monotonically increasing, but it depends on the encoding. For example, H.264 B-frames will introduce jitter and reordering.
Sourcepub fn consume(&self) -> TrackConsumer
pub fn consume(&self) -> TrackConsumer
Create a consumer for this track.
Multiple consumers can be created from the same producer, each receiving a copy of all data written to the track.
Trait Implementations§
Source§impl Clone for TrackProducer
impl Clone for TrackProducer
Source§fn clone(&self) -> TrackProducer
fn clone(&self) -> TrackProducer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more