Skip to main content

Module frame_queue

Module frame_queue 

Source
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:

  1. Receive frames in display/presentation order (PTS-ordered).
  2. Reorder them so reference frames (I/P) are encoded before the B-frames that depend on them.
  3. 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§

BFrameReorderBuffer
B-frame reorder buffer.
DtsCalculator
Standalone DTS calculator.
FrameQueue
PTS-ordered staging queue for incoming frames.
QueuedFrame
A single frame entry held in the queue.
ReadyFrame
A QueuedFrame augmented with its computed DTS, ready to be handed to the codec for actual encoding.
ReorderConfig
Configuration for the B-frame reorder buffer.

Enums§

QueueFrameType
Frame type hint supplied by the caller.