h264decoder: Enable low-latency bumping in case of pic_order_cnt_type 2

In case of POC type 2, output order is equal to decoding order
(no frame reordering)

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2447
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4383>
This commit is contained in:
Seungha Yang 2023-04-10 20:10:50 +09:00 committed by GStreamer Marge Bot
parent 0e51c8c5e4
commit d16ed17747
2 changed files with 17 additions and 6 deletions

View file

@ -2164,9 +2164,9 @@ gst_h264_decoder_finish_picture (GstH264Decoder * self,
gst_h264_picture_unref (picture);
/* For the live mode, we try to bump here to avoid waiting
for another decoding circle. */
if (priv->is_live && priv->compliance != GST_H264_DECODER_COMPLIANCE_STRICT)
/* For low-latency output, we try to bump here to avoid waiting
* for another decoding circle. */
if (bump_level != GST_H264_DPB_BUMP_NORMAL_LATENCY)
_bump_dpb (self, bump_level, NULL, ret);
}
@ -2320,9 +2320,14 @@ gst_h264_decoder_set_latency (GstH264Decoder * self, const GstH264SPS * sps,
bump_level = get_bump_level (self);
if (bump_level != GST_H264_DPB_BUMP_NORMAL_LATENCY) {
guint32 max_reorder_frames =
gst_h264_dpb_get_max_num_reorder_frames (priv->dpb);
frames_delay = MIN (max_dpb_size, max_reorder_frames);
if (sps->pic_order_cnt_type == 2) {
/* POC type 2 has does not allow frame reordering */
frames_delay = 0;
} else {
guint32 max_reorder_frames =
gst_h264_dpb_get_max_num_reorder_frames (priv->dpb);
frames_delay = MIN (max_dpb_size, max_reorder_frames);
}
}
/* Consider output delay wanted by subclass */

View file

@ -760,6 +760,12 @@ gst_h264_dpb_needs_bump (GstH264Dpb * dpb, GstH264Picture * to_insert,
if (!gst_h264_dpb_has_empty_frame_buffer (dpb))
goto normal_bump;
/* In case of POC type 2, decoding order is equal to output order */
if (picture->pic_order_cnt_type == 2) {
GST_TRACE ("POC type == 2, bumping");
return TRUE;
}
/* 7.4.1.2.2: The values of picture order count for the coded pictures
in consecutive access units in decoding order containing non-reference
pictures shall be non-decreasing. Safe. */