diff mbox series

[FFmpeg-devel,v3,8/8] lavc/hevcdec: Prompt detailed logs for invalid PPS id

Message ID 20201207125545.621159-9-linjie.justin.fu@gmail.com
State New
Headers show
Series HEVC native support for Screen content coding
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Linjie Fu Dec. 7, 2020, 12:55 p.m. UTC
There are 3 functions reporting the same log, which is not straight
forward enough for users:
 - hevc_parse_slice_header()
 - ff_hevc_decode_nal_pps()
 - hls_slice_header()

Provide detailed logs to distinguish from "out of range PPS id" and
"empty pps_list[pps_id]".

Before:
PPS id out of range: 0
After:
PPS id out of range or empty pps_list[0]: 0

Since 0 is within the range of pps_id, it's more clear that there is
an invalid pps_list.

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
---
 libavcodec/hevc_parser.c | 2 +-
 libavcodec/hevcdec.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/hevc_parser.c b/libavcodec/hevc_parser.c
index 463d352055..0c6b50c0b9 100644
--- a/libavcodec/hevc_parser.c
+++ b/libavcodec/hevc_parser.c
@@ -75,7 +75,7 @@  static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal,
 
     pps_id = get_ue_golomb(gb);
     if (pps_id >= HEVC_MAX_PPS_COUNT || !ps->pps_list[pps_id]) {
-        av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", pps_id);
+        av_log(avctx, AV_LOG_ERROR, "PPS id out of range or empty pps_list[%d]: %d\n", pps_id, pps_id);
         return AVERROR_INVALIDDATA;
     }
     ps->pps = (HEVCPPS*)ps->pps_list[pps_id]->data;
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index e1d469658c..02c489e1f9 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -554,7 +554,7 @@  static int hls_slice_header(HEVCContext *s)
 
     sh->pps_id = get_ue_golomb_long(gb);
     if (sh->pps_id >= HEVC_MAX_PPS_COUNT || !s->ps.pps_list[sh->pps_id]) {
-        av_log(s->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id);
+        av_log(s->avctx, AV_LOG_ERROR, "PPS id out of range or empty pps_list[%d]: %d\n", sh->pps_id, sh->pps_id);
         return AVERROR_INVALIDDATA;
     }
     if (!sh->first_slice_in_pic_flag &&