#[non_exhaustive]pub struct ParallelConfig {Show 15 fields
pub sample_rate: i32,
pub channels: usize,
pub application: Application,
pub bitrate_bps: i32,
pub complexity: i32,
pub rate_control: RateControl,
pub use_inband_fec: bool,
pub use_dtx: bool,
pub packet_loss_perc: i32,
pub force_bandwidth: Option<Bandwidth>,
pub signal_type: Option<Signal>,
pub max_bandwidth: Bandwidth,
pub lsb_depth: i32,
pub warmup_ms: u32,
pub threads: usize,
}Expand description
Configuration for a parallel encode.
Every setting OpusEncoder exposes appears here, because a worker’s
encoder is built from this struct and nothing else: a setting missing from
this list is one the parallel path cannot reach at all. The defaults are
OpusEncoder’s own, apart from bitrate_bps and complexity, which have
none there.
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.sample_rate: i32Rate of the PCM being encoded, as OpusEncoder::new takes it.
channels: usizeChannels in that PCM, interleaved. 1 or 2.
application: ApplicationWhat to optimise for, as OpusEncoder::new takes it.
bitrate_bps: i32OpusEncoder::bitrate_bps. Defaults to 64000 here, where the encoder
itself has no default of its own.
complexity: i32OpusEncoder::complexity. Defaults to 9 here, where the encoder
itself has no default of its own.
rate_control: RateControl§use_inband_fec: bool§use_dtx: boolDiscontinuous transmission. Its trigger counts consecutive inactive frames and each worker starts that count at zero, so a chunked encode emits fewer DTX packets than a serial one over the same silence.
packet_loss_perc: i32§force_bandwidth: Option<Bandwidth>Pinning this, or Self::signal_type, takes the content analysis out of
the coding-mode decision and lets warmup_ms be much shorter.
signal_type: Option<Signal>§max_bandwidth: BandwidthOpusEncoder::max_bandwidth. Unlike Self::force_bandwidth this
only caps the automatic choice, so it does not remove the analysis from
the decision and does not shorten the warm-up.
lsb_depth: i32§warmup_ms: u32Audio each worker re-encodes before its own chunk to prime encoder state,
then discards. Milliseconds rather than frames because what it has to
cover is a time constant; see DEFAULT_WARMUP_MS. 0 disables priming,
which is naive chunking and audibly wrong.
threads: usizeWorker count; 0 selects available_parallelism. Capped by the
redundancy ceiling — ask Self::plan what will actually be used.
Implementations§
Source§impl ParallelConfig
impl ParallelConfig
Sourcepub fn new(sample_rate: i32, channels: usize, application: Application) -> Self
pub fn new(sample_rate: i32, channels: usize, application: Application) -> Self
A configuration with the defaults described on this type.
The three arguments are the ones OpusEncoder::new fixes for an
encoder’s life; the remaining fields are ordinary and can be set on the
returned value before it is handed to encode_parallel.
Sourcepub fn warmup_frames(&self, frame_size: usize) -> usize
pub fn warmup_frames(&self, frame_size: usize) -> usize
Warm-up expressed in frames of frame_size samples per channel, rounded
up so a frame duration that does not divide warmup_ms still covers it.
Sourcepub fn plan(&self, total_frames: usize, frame_size: usize) -> ParallelPlan
pub fn plan(&self, total_frames: usize, frame_size: usize) -> ParallelPlan
How encode_parallel will divide total_frames, without encoding
anything.
Worth asking before a large job: the worker count is capped by the redundancy ceiling, so a short clip or a long warm-up can leave far fewer threads in use than were requested, or fall back to serial encoding altogether.
Trait Implementations§
Source§impl Clone for ParallelConfig
impl Clone for ParallelConfig
Source§fn clone(&self) -> ParallelConfig
fn clone(&self) -> ParallelConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more