Expand description
Encoder frame queue with PTS-ordered input, B-frame reorder buffer, and DTS calculation.
§Overview
Video encoders with B-frame support cannot emit packets in display order. They need to:
- Receive frames in display/presentation order (PTS-ordered).
- Reorder them so reference frames (I/P) are encoded before the B-frames that depend on them.
- Emit encoded packets with a decode timestamp (DTS) that is ≤ the PTS and strictly non-decreasing.
This module provides:
FrameQueue— PTS-sorted input staging area that enforces ordering and detects duplicate / out-of-order submissions.BFrameReorderBuffer— Delayed-output buffer with configurable lookahead depth that reorders frames for B-frame encoding and computes DTS offsets.DtsCalculator— Standalone utility to turn a sequence of (PTS, is_key) pairs into correct DTS values.
Structs§
- BFrame
Reorder Buffer - B-frame reorder buffer.
- DtsCalculator
- Standalone DTS calculator.
- Frame
Queue - PTS-ordered staging queue for incoming frames.
- Queued
Frame - A single frame entry held in the queue.
- Ready
Frame - A
QueuedFrameaugmented with its computed DTS, ready to be handed to the codec for actual encoding. - Reorder
Config - Configuration for the B-frame reorder buffer.
Enums§
- Queue
Frame Type - Frame type hint supplied by the caller.