Command and Event no longer carry voelin-stream's types. voelin-core owns StreamInfo, ViewerInfo, StreamSetup, StreamKind, ViewerState, EndReason and LeaveReason (stream_types.rs) with u16 client ids, a viewer's SRTP profile as its name and its codec as voelin_media::Codec; stream.rs converts at the boundary. Command::SetSrtpProfiles takes profile names, which the stream task parses. EncodedFrame, LayerSpec, LayerId and LayerSet move into voelin-media (stream::EncodedFrame, layer); voelin-stream depends on it and re-exports them, so the engine, the stream sessions and voelinctl share one type. The crate is now a plain dependency of voelin-core (feature media keeps the module and WHIP), and its str0m feature is gone with str0m always there. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
35 lines
1.2 KiB
Rust
35 lines
1.2 KiB
Rust
//! The frames of a stream on their way to its viewers.
|
|
//!
|
|
//! An [`EncodedFrame`] is what the streamer's encoders and the Opus encoder
|
|
//! hand to a stream: the encoder's output ([`codec::EncodedFrame`]) plus what
|
|
//! the transport needs, which media it is, its RTP time and its simulcast
|
|
//! layer. The engine's stream sink, the stream sessions (`voelin-stream`) and
|
|
//! the tools that feed a stream by hand all pass it on unchanged.
|
|
//!
|
|
//! [`codec::EncodedFrame`]: crate::codec::EncodedFrame
|
|
|
|
use std::sync::Arc;
|
|
|
|
use str0m::media::{MediaKind, MediaTime};
|
|
|
|
use crate::layer::LayerId;
|
|
|
|
/// One encoded video or audio frame of a stream, ready to be sent.
|
|
///
|
|
/// Not the encoder's [`codec::EncodedFrame`](crate::codec::EncodedFrame),
|
|
/// which has neither a kind nor a layer and counts time on the 90 kHz clock
|
|
/// only.
|
|
#[derive(Clone, Debug)]
|
|
pub struct EncodedFrame {
|
|
pub kind: MediaKind,
|
|
/// RTP time: 90 kHz for video, 48 kHz for Opus.
|
|
pub time: MediaTime,
|
|
pub data: Arc<[u8]>,
|
|
/// The simulcast layer of a video frame (0 without simulcast, and for
|
|
/// audio).
|
|
pub layer: LayerId,
|
|
/// A video keyframe: viewers can start decoding (or switch to this layer)
|
|
/// here.
|
|
pub keyframe: bool,
|
|
}
|