From d062677b3fb0a3acbb1feebb1f55c41227547fc7 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 13 May 2020 15:32:44 -0400 Subject: [PATCH] codecparsers: h264: Fix default ref list size The default in PPS was not applied properly. The default does not apply for I-Slice and l1 default only applies for B-Slice. This fixes the slice values for num_ref_idx_l0_active_minus1 and num_ref_idx_l1_active_minus1. Part-of: --- gst-libs/gst/codecparsers/gsth264parser.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c index 44dcc7e023..a7ddad4b6f 100644 --- a/gst-libs/gst/codecparsers/gsth264parser.c +++ b/gst-libs/gst/codecparsers/gsth264parser.c @@ -2253,8 +2253,17 @@ gst_h264_parser_parse_slice_hdr (GstH264NalParser * nalparser, /* set default values for fields that might not be present in the bitstream and have valid defaults */ - slice->num_ref_idx_l0_active_minus1 = pps->num_ref_idx_l0_active_minus1; - slice->num_ref_idx_l1_active_minus1 = pps->num_ref_idx_l1_active_minus1; + if (GST_H264_IS_I_SLICE (slice)) { + slice->num_ref_idx_l0_active_minus1 = 0; + slice->num_ref_idx_l1_active_minus1 = 0; + } else { + slice->num_ref_idx_l0_active_minus1 = pps->num_ref_idx_l0_active_minus1; + + if (GST_H264_IS_B_SLICE (slice)) + slice->num_ref_idx_l1_active_minus1 = pps->num_ref_idx_l1_active_minus1; + else + slice->num_ref_idx_l1_active_minus1 = 0; + } if (sps->separate_colour_plane_flag) READ_UINT8 (&nr, slice->colour_plane_id, 2);