AVBlocks

Controling H.264 decoding latency

There is a new parameter in AVBlocks 1.8 called MaxDecFrameBuffering (corresponding to max_dec_frame_buffering from the AVC / H.264 standard). It controls the decoded picture buffer size of the decoder and indirectly affects the decoding latency.

Here are some key notes about using this parameter:

The following code can be used to set the MaxDecFrameBuffering parameter to an output pin:

void setH264DecodingLatency(primo::avblocks::MediaPin* pin, int32_t desiredLatency)
{
    using namespace primo::avblocks;
    using namespace primo::avblocks::Param;
    
    ParameterList* params ( Library::createParameterList() );
        IntParameter* maxDecFrameBuffering (Library::createIntParameter() );
            maxDecFrameBuffering->setName(Decoder::Video::H264::VUI::MaxDecFrameBuffering);
            maxDecFrameBuffering->setValue(desiredLatency);
            params->add(maxDecFrameBuffering);
        maxDecFrameBuffering->release();
        pin->setParams(params);
    params->release();
}