Skip to content

libs: encoder: H264: Fix one assert in get_pending_reordered().

gst_vaapi_encoder_h264_get_pending_reordered() does not consider the case for HIERARCHICAL_B mode. The pipeline:

gst-launch-1.0 videotestsrc num-buffers=48 ! vaapih264enc prediction-type=2
keyframe-period=32 ! fakesink

get a assert:

ERROR:../gst-libs/gst/vaapi/gstvaapiencoder_h264.c:1996:reflist1_init_hierarchical_b: assertion failed: (count != 0)

The last few B frames are not fetched in correct order when HIERARCHICAL_B is enabled.

We also fix a latent bug for normal mode. The g_queue_pop_tail() of B frames make the last several frames encoded in reverse order. The NAL of last few frames come in reverse order in the bit stream, though it can still output the correct image.

Merge request reports