[FFmpeg-devel] [PATCH] [RFC] libavcodec/hevc_refs: Clear DPB of old frames

Anton Khirnov anton at khirnov.net
Mon Aug 3 11:18:03 EEST 2020


Quoting Kieran Kunhya (2020-07-16 21:32:34)
> During glitching or looping streams, old frames remain in the DPB.
> The decoder incorrectly thinks that the DPB contains the right number of
> buffered frames to output and reordering breaks badly
> 
> Any non-cosmetic comments welcome.
>From 23f0272092f6528a268abe7e6a7fd8764553048f Mon Sep 17 00:00:00 2001
>From: Kieran Kunhya <kierank at obe.tv>
>Date: Thu, 16 Jul 2020 20:29:24 +0100
>Subject: [PATCH] [RFC] libavcodec/hevc_refs: Clear DPB of old frames
>
>During glitching or looping streams, old frames remain in the DPB.
>The decoder incorrectly thinks that the DPB contains the right number of buffered frames to output and reordering breaks badly

Can you describe what happens in more details? It's not obvious what you
"breaks badly" means. Even if some frame gets skipped, the old frames
should still get output in the correct order, since their POCs are
correct.

>---
> libavcodec/hevc_refs.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
>diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
>index 4f6d985..a8e0028 100644
>--- a/libavcodec/hevc_refs.c
>+++ b/libavcodec/hevc_refs.c
>@@ -277,6 +277,10 @@ static int init_slice_rpl(HEVCContext *s)
>     int ctb_addr_ts  = s->ps.pps->ctb_addr_rs_to_ts[s->sh.slice_segment_addr];
>     int i;
> 
>+    if(frame && !frame->rpl_buf) {

How can this happen? From looking at the code, I don't see how either of
those conditions can possibly be true.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list