Skip to main content

codec_thread_allocation

Function codec_thread_allocation 

Source
pub fn codec_thread_allocation(
    request: CodecThreadRequest,
) -> CodecThreadAllocation
Expand description

Divides the export CPU budget across concurrently active codec contexts.

The budget is an export-wide cap and each context needs a worker, so decoder concurrency is reduced first. Hardware video encoding does not consume this budget.

With a software encoder, which paces the run, software decoders are sized to their frame area and the encoder takes the remainder above a floor. With a hardware encoder the even split stays, since cutting decode workers only made decode fall behind the renderer.

Hardware decode sessions open with HARDWARE_DECODER_THREADS, but their share is still reserved for a software fallback, which also keeps the encoder’s worker count (and output) independent of how sources decode.