From aa73624638b89a76b3a6d44cbb5353edc86feaac Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 21 Mar 2014 17:03:36 +0100 Subject: [PATCH] codecparsers: h264: fix SEI buffering_period() parsing. Fix parsing of buffering_period() SEI messages. The number of bits used to express {nal,vcl}_initial_cpb_removal_delay{,_offset} syntax elements is not 5 but 1 + initial_cpb_removal_delay_length_minus1. https://bugzilla.gnome.org/show_bug.cgi?id=726828 Signed-off-by: Gwenole Beauchesne --- gst-libs/gst/codecparsers/gsth264parser.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/codecparsers/gsth264parser.c b/gst-libs/gst/codecparsers/gsth264parser.c index 4ebe28292f..63312d6666 100644 --- a/gst-libs/gst/codecparsers/gsth264parser.c +++ b/gst-libs/gst/codecparsers/gsth264parser.c @@ -687,25 +687,29 @@ gst_h264_parser_parse_buffering_period (GstH264NalParser * nalparser, if (vui->nal_hrd_parameters_present_flag) { GstH264HRDParams *hrd = &vui->nal_hrd_parameters; + const guint8 nbits = hrd->initial_cpb_removal_delay_length_minus1 + 1; guint8 sched_sel_idx; for (sched_sel_idx = 0; sched_sel_idx <= hrd->cpb_cnt_minus1; sched_sel_idx++) { - READ_UINT8 (nr, per->nal_initial_cpb_removal_delay[sched_sel_idx], 5); + READ_UINT8 (nr, per->nal_initial_cpb_removal_delay[sched_sel_idx], + nbits); READ_UINT8 (nr, - per->nal_initial_cpb_removal_delay_offset[sched_sel_idx], 5); + per->nal_initial_cpb_removal_delay_offset[sched_sel_idx], nbits); } } if (vui->vcl_hrd_parameters_present_flag) { GstH264HRDParams *hrd = &vui->vcl_hrd_parameters; + const guint8 nbits = hrd->initial_cpb_removal_delay_length_minus1 + 1; guint8 sched_sel_idx; for (sched_sel_idx = 0; sched_sel_idx <= hrd->cpb_cnt_minus1; sched_sel_idx++) { - READ_UINT8 (nr, per->vcl_initial_cpb_removal_delay[sched_sel_idx], 5); + READ_UINT8 (nr, per->vcl_initial_cpb_removal_delay[sched_sel_idx], + nbits); READ_UINT8 (nr, - per->vcl_initial_cpb_removal_delay_offset[sched_sel_idx], 5); + per->vcl_initial_cpb_removal_delay_offset[sched_sel_idx], nbits); } } }