[FFmpeg-cvslog] avcodec/h264_slice: clear old slice POC values on parsing failure

James Almer git at videolan.org
Tue Aug 10 21:29:16 EEST 2021


ffmpeg | branch: release/4.4 | James Almer <jamrial at gmail.com> | Sun Aug  8 15:30:26 2021 -0300| [bf87bdd3f65569e562341843965f0e810f7a2d1f] | committer: James Almer

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 <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf87bdd3f65569e562341843965f0e810f7a2d1f
---

 libavcodec/h264_slice.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 62f7a61aed..7c69016338 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1831,6 +1831,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);
 
@@ -1838,6 +1840,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);
 



More information about the ffmpeg-cvslog mailing list