Skip to main content

encode_streams

Function encode_streams 

Source
pub fn encode_streams(
    streams: &[(ParallelConfig, &[f32], usize)],
    threads: usize,
) -> Vec<Vec<Vec<u8>>>
Expand description

R1a — per-stream parallelism (byte-identical). Encode several independent PCM streams concurrently, one serial encoder per worker. Each stream’s output is exactly its serial encode (no chunk seams), so this is bit-identical to encoding them one-by-one — the right tool for batch/many-stream workloads (and for short streams too small to split internally with encode_parallel).

streams[i] is (config, pcm, frame_size); returns out[i] = that stream’s packets. Order preserved. Uses a bounded pool (threads, or all cores) so a thousand tiny streams don’t spawn a thousand threads.