[FFmpeg-devel] [PATCH] lavc/hevc_ps: fix process failed when SPS before VPS in hvcC
1035567130 at qq.com
1035567130 at qq.com
Fri Sep 9 16:09:06 EEST 2022
From: Wang Yaqiang <wangyaqiang03 at kuaishou.com>
In some videos, SPS will be stored before VPS in hvcC box,
parse SPS does not depend on VPS, so the video is expected to be processed normally.
Added "parsed_vps" parameter to indicate whether VPS have been parsed.
Only VPS have been parsed can be verified during SPS parsing.
Signed-off-by: Wang Yaqiang <wangyaqiang03 at kuaishou.com>
---
libavcodec/hevc_ps.c | 4 ++--
libavcodec/hevc_ps.h | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index f665d8053c..71835d0f36 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -464,7 +464,7 @@ int ff_hevc_decode_nal_vps(GetBitContext *gb, AVCodecContext *avctx,
if (!vps_buf)
return AVERROR(ENOMEM);
vps = (HEVCVPS*)vps_buf->data;
-
+ ps->parsed_vps = 1;
av_log(avctx, AV_LOG_DEBUG, "Decoding VPS\n");
nal_size = gb->buffer_end - gb->buffer;
@@ -1272,7 +1272,7 @@ int ff_hevc_decode_nal_sps(GetBitContext *gb, AVCodecContext *avctx,
ret = ff_hevc_parse_sps(sps, gb, &sps_id,
apply_defdispwin,
- ps->vps_list, avctx);
+ ps->parsed_vps ? ps->vps_list : NULL, avctx);
if (ret < 0) {
av_buffer_unref(&sps_buf);
return ret;
diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h
index 2a1bbf6489..e6b694e7f3 100644
--- a/libavcodec/hevc_ps.h
+++ b/libavcodec/hevc_ps.h
@@ -333,6 +333,7 @@ typedef struct HEVCParamSets {
const HEVCVPS *vps;
const HEVCSPS *sps;
const HEVCPPS *pps;
+ int parsed_vps; // indicates VPS has been parsed
} HEVCParamSets;
/**
--
2.33.0
More information about the ffmpeg-devel
mailing list