[FFmpeg-cvslog] avcodec/hevc_sei: fix amount of bits skipped when reading picture timing SEI message

James Almer git at videolan.org
Wed May 10 21:00:25 EEST 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat May  6 20:31:45 2017 -0300| [f738140807f504c9af7850042067777832f05e88] | committer: James Almer

avcodec/hevc_sei: fix amount of bits skipped when reading picture timing SEI message

The code was skipping the entire reported SEI message size regardless of
the amount of bits read.
While in theory safe for NALU where the picture timing SEI message is alone
or at the end as we're using the checked bitstream reader, it isn't in any
other situation, where every SEI message in the NALU after the picture
timing one would potentially fail to parse.

Change the function name to one more in line with the rest of file, and
remove the bogus "Skipped SEI" debug message while at it.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/hevc_sei.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index b86f7e4d6f..0fdbd85429 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -124,8 +124,8 @@ static int decode_nal_sei_display_orientation(HEVCSEIDisplayOrientation *s, GetB
     return 0;
 }
 
-static int decode_pic_timing(HEVCSEIContext *s, GetBitContext *gb, const HEVCParamSets *ps,
-                             void *logctx)
+static int decode_nal_sei_pic_timing(HEVCSEIContext *s, GetBitContext *gb, const HEVCParamSets *ps,
+                                     void *logctx, int size)
 {
     HEVCSEIPictureTiming *h = &s->picture_timing;
     HEVCSPS *sps;
@@ -146,8 +146,12 @@ static int decode_pic_timing(HEVCSEIContext *s, GetBitContext *gb, const HEVCPar
         }
         get_bits(gb, 2);                   // source_scan_type
         get_bits(gb, 1);                   // duplicate_flag
+        skip_bits1(gb);
+        size--;
     }
-    return 1;
+    skip_bits_long(gb, 8 * size);
+
+    return 0;
 }
 
 static int decode_registered_user_data_closed_caption(HEVCSEIA53Caption *s, GetBitContext *gb,
@@ -272,12 +276,7 @@ static int decode_nal_sei_prefix(GetBitContext *gb, HEVCSEIContext *s, const HEV
     case HEVC_SEI_TYPE_DISPLAY_ORIENTATION:
         return decode_nal_sei_display_orientation(&s->display_orientation, gb);
     case HEVC_SEI_TYPE_PICTURE_TIMING:
-        {
-            int ret = decode_pic_timing(s, gb, ps, logctx);
-            av_log(logctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type);
-            skip_bits(gb, 8 * size);
-            return ret;
-        }
+        return decode_nal_sei_pic_timing(s, gb, ps, logctx, size);
     case HEVC_SEI_TYPE_MASTERING_DISPLAY_INFO:
         return decode_nal_sei_mastering_display_info(&s->mastering_display, gb);
     case HEVC_SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO:



More information about the ffmpeg-cvslog mailing list