pub fn encode_parallel(
cfg: &ParallelConfig,
pcm: &[f32],
frame_size: usize,
) -> Vec<Vec<u8>>Expand description
Encode pcm (interleaved f32, channels-interleaved) in frame_size
samples-per-channel frames, across cfg.threads workers, returning one Opus
packet per frame in order. Falls back to a single serial encoder when the
input is too small to split usefully.
The serial equivalent is encode_serial; this returns the same count of
packets and (with adequate warmup) a perceptually-identical bitstream.
ยงPanics
Panics if cfg is not a valid encoder configuration (see
crate::OpusEncoder::new) or if encoding a frame fails, which can only
happen for an invalid configuration. Validate the configuration with
OpusEncoder::new first when it comes from untrusted input.
Also panics if a worker thread panics.