Skip to main content

encode_parallel

Function encode_parallel 

Source
pub fn encode_parallel(
    cfg: &ParallelConfig,
    pcm: &[f32],
    frame_size: usize,
) -> Result<Vec<Vec<u8>>>
Expand description

Encode pcm (interleaved f32, channels-interleaved) in frame_size samples-per-channel frames across several threads, returning one Opus packet per frame in order.

Output is deterministic and always the same length as a serial encode, but it is a different encode: see the module documentation for what differs and by how much. Falls back to a single encoder when the input is too short to split, which ParallelConfig::plan will say in advance.