aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorNuo Mi <nuomi2021@gmail.com>2024-02-03 14:04:02 +0800
committerNuo Mi <nuomi2021@gmail.com>2024-02-05 21:43:18 +0800
commit88a040386a0ea95306d8d8fdf9400f6214c89e7d (patch)
tree17dbdb2b3618b1ef0a609d9a0eb6268ae1c0da6b /libavcodec
parentf80d91c05112fede33b230459baeb92912e33bb8 (diff)
downloadffmpeg-88a040386a0ea95306d8d8fdf9400f6214c89e7d.tar.gz
avcodec/vvcdec: fix seeking for open GOP
how to reproduce: wget https://media.xiph.org/video/derf/y4m/students_cif.y4m vvencapp --input students_cif.y4m --preset faster --output students.266 MP4Box -add students.266:fps=30000/1001:par=12:11 -new students.mp4 ffplay students.mp4
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/vvc/vvc_refs.c6
-rw-r--r--libavcodec/vvc/vvc_refs.h1
-rw-r--r--libavcodec/vvc/vvcdec.c6
3 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/vvc/vvc_refs.c b/libavcodec/vvc/vvc_refs.c
index bf503e429e..e1895d1cca 100644
--- a/libavcodec/vvc/vvc_refs.c
+++ b/libavcodec/vvc/vvc_refs.c
@@ -80,6 +80,12 @@ void ff_vvc_clear_refs(VVCFrameContext *fc)
VVC_FRAME_FLAG_SHORT_REF | VVC_FRAME_FLAG_LONG_REF);
}
+void ff_vvc_flush_dpb(VVCFrameContext *fc)
+{
+ for (int i = 0; i < FF_ARRAY_ELEMS(fc->DPB); i++)
+ ff_vvc_unref_frame(fc, &fc->DPB[i], ~0);
+}
+
static void free_progress(FFRefStructOpaque unused, void *obj)
{
FrameProgress *p = (FrameProgress *)obj;
diff --git a/libavcodec/vvc/vvc_refs.h b/libavcodec/vvc/vvc_refs.h
index cd3b5f5632..eba4422fb4 100644
--- a/libavcodec/vvc/vvc_refs.h
+++ b/libavcodec/vvc/vvc_refs.h
@@ -33,6 +33,7 @@ int ff_vvc_frame_rpl(VVCContext *s, VVCFrameContext *fc, SliceContext *sc);
int ff_vvc_slice_rpl(VVCContext *s, VVCFrameContext *fc, SliceContext *sc);
void ff_vvc_unref_frame(VVCFrameContext *fc, VVCFrame *frame, int flags);
void ff_vvc_clear_refs(VVCFrameContext *fc);
+void ff_vvc_flush_dpb(VVCFrameContext *fc);
typedef enum VVCProgress {
VVC_PROGRESS_MV,
diff --git a/libavcodec/vvc/vvcdec.c b/libavcodec/vvc/vvcdec.c
index 83ee472ce6..1a050600eb 100644
--- a/libavcodec/vvc/vvcdec.c
+++ b/libavcodec/vvc/vvcdec.c
@@ -922,9 +922,15 @@ static av_cold void vvc_decode_flush(AVCodecContext *avctx)
{
VVCContext *s = avctx->priv_data;
int got_output = 0;
+ VVCFrameContext *last;
while (s->nb_delayed)
wait_delayed_frame(s, NULL, &got_output);
+
+ last = get_frame_context(s, s->fcs, s->nb_frames - 1);
+ ff_vvc_flush_dpb(last);
+
+ s->eos = 1;
}
static av_cold int vvc_decode_free(AVCodecContext *avctx)