[FFmpeg-devel] [PATCH 3/6] avcodec/hevc: Don't drop packet with duplicate POC

Zhao Zhili quinkblack at foxmail.com
Tue Mar 18 14:58:42 EET 2025


From: Zhao Zhili <zhilizhao at tencent.com>

This can happen when stream repeat from CRA, e.g., generated by
mp4 with editlist. Hardware decoder like videotoolbox reports error
after packet been dropped.
---
 libavcodec/hevc/refs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc/refs.c b/libavcodec/hevc/refs.c
index 6f291bbf79..269787e198 100644
--- a/libavcodec/hevc/refs.c
+++ b/libavcodec/hevc/refs.c
@@ -217,9 +217,9 @@ int ff_hevc_set_new_ref(HEVCContext *s, HEVCLayerContext *l, int poc)
         HEVCFrame *frame = &l->DPB[i];
 
         if (frame->f && frame->poc == poc) {
-            av_log(s->avctx, AV_LOG_ERROR, "Duplicate POC in a sequence: %d.\n",
+            av_log(s->avctx, AV_LOG_WARNING, "Duplicate POC in a sequence: %d.\n",
                    poc);
-            return AVERROR_INVALIDDATA;
+            break;
         }
     }
 
-- 
2.46.0



More information about the ffmpeg-devel mailing list