[FFmpeg-devel] [PATCH v3 8/8] lavc/hevcdec: Prompt detailed logs for invalid PPS id
Linjie Fu
linjie.justin.fu at gmail.com
Mon Dec 7 14:55:45 EET 2020
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 at gmail.com>
---
libavcodec/hevc_parser.c | 2 +-
libavcodec/hevcdec.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
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 &&
--
2.25.1
More information about the ffmpeg-devel
mailing list