We stream live H.264 over WebRTC (webrtcbin) at 30 fps and are trying to bring glass-to-glass latency down. Almost all of the remaining receiver time is in the hardware decoder: nvh264dec holds each decoded frame for one frame period before pushing it downstream. Software decoders on the same stream don’t do this.
Setup
-
GStreamer 1.24.2, Ubuntu, NVIDIA GPU: [GPU model / driver version]
-
Sender:
x264enc tune=zerolatency speed-preset=ultrafast key-int-max=30 pass=cbr byte-stream=true. No B-frames, so the stream needs no reordering. -
Receiver:
webrtcbin → rtph264depay → decodebin(picksnvh264dec)→ videoconvert/glupload → qml6glsink -
1080p, 30 fps, progressive
The
nvh264dectime is about one frame period, 33.3 ms at 30 fps. Decode itself is fast. The frame is complete and decoded long before it is pushed out.What we tried
-
max-display-delay=0onnvh264dec: no change. -
compliancesettings: no change. -
Checked the SPS:
num_reorder_frames = 0, and no B-frames are present.Our understanding of why
From GST debug logs, the output seems to be driven by the
GstH264Decoderbase class DPB “bumping” logic, not bynvh264decitself. With a DPB size of 1 andnum_reorder_frames = 0, the decoded picture is a reference picture, and it stays in the DPB until the next picture needs the slot. It is only output then. So every frame leaves when the next frame arrives, which is one frame period late.max-display-delaydoesn’t seem to affect this path.The software decoders (
avdec_h264,openh264dec) don’t useGstH264Decoder, which would explain why they don’t show the delay.We also read the 1.28 release notes (through 1.28.8) and didn’t find a change to this behaviour.
Questions
- Is this understanding right, or are we missing a setting? For example, is there a low-latency or “output as soon as decoded” mode for
GstH264Decoder-based decoders? - For a stream that signals
num_reorder_frames = 0(ormax_dec_frame_buffering), could the base class output the picture immediately while still keeping it as a reference?
- Is this understanding right, or are we missing a setting? For example, is there a low-latency or “output as soon as decoded” mode for
-