#[non_exhaustive]pub struct Options {
pub track: Option<String>,
pub codec: Codec,
pub sample_rate: Option<u32>,
pub channels: Option<u32>,
pub bitrate: Option<u32>,
pub fec: bool,
pub dtx: bool,
pub frame_duration: Duration,
}Expand description
Source-agnostic encode knobs for Producer and publish_capture, where
the input PCM layout comes from the caller’s frames or the capture source
rather than from these options. For the bring-your-own-PCM
Encoder, which needs that layout up front, use
Config instead.
#[non_exhaustive]: construct via Options::default and set fields, so
new knobs can be added without breaking callers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.track: Option<String>Track name to publish under. None derives a unique one from the codec
(0.opus, then 1.opus, …), matching how the video side names its
track. Subscribers find it through the catalog either way.
codec: CodecOutput codec. Defaults to Codec::Opus.
sample_rate: Option<u32>Sample rate the codec runs at. None snaps the input rate up to the
nearest rate the codec supports, resampling if that moved it.
channels: Option<u32>Channel count the codec runs at. None matches the input; anything else
is rejected, since remapping isn’t implemented.
bitrate: Option<u32>Bitrate in bits per second. None lets Opus pick. PCM requires None
because its bitrate is fixed by the sample rate and channel count.
fec: boolEnable Opus in-band forward error correction.
dtx: boolEnable Opus discontinuous transmission during silence.
frame_duration: DurationEncoded frame duration. Opus accepts 2.5 / 5 / 10 / 20 / 40 / 60 ms. PCM accepts any duration containing a whole number of samples.