summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <[email protected]>2021-08-08 15:30:26 -0300
committerJames Almer <[email protected]>2021-08-10 15:21:16 -0300
commit3aba8b176f5dc96b9b91d94ce54c41e1ec34bc9c (patch)
treeac7154d2052362b853631001e61f63aab42ce2d0
parent85713d85a70a534e8906a574c68af37a1f7053d9 (diff)
avcodec/h264_slice: clear old slice POC values on parsing failure
If a slice header fails to parse, and the next one uses different Sequence and Picture parameter sets, certain values may not be read if they are not coded, resulting in the previous slice values being used. Signed-off-by: James Almer <[email protected]>
-rw-r--r--libavcodec/h264_slice.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 4e3abf859b..b0c890a251 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1819,6 +1819,8 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl,
if (nal->type == H264_NAL_IDR_SLICE)
get_ue_golomb_long(&sl->gb); /* idr_pic_id */
+ sl->poc_lsb = 0;
+ sl->delta_poc_bottom = 0;
if (sps->poc_type == 0) {
sl->poc_lsb = get_bits(&sl->gb, sps->log2_max_poc_lsb);
@@ -1826,6 +1828,7 @@ static int h264_slice_header_parse(const H264Context *h, H264SliceContext *sl,
sl->delta_poc_bottom = get_se_golomb(&sl->gb);
}
+ sl->delta_poc[0] = sl->delta_poc[1] = 0;
if (sps->poc_type == 1 && !sps->delta_pic_order_always_zero_flag) {
sl->delta_poc[0] = get_se_golomb(&sl->gb);