From 0b562557eb782560dadd622db658f0f5df13a8d0 Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Sat, 7 May 2022 13:19:24 +0800 Subject: [PATCH] dav1d: fix decoder failed after seek decoder_NewPicture() can return NULL due to picture_pool_Cancel, which can happen when seek. With alloc_picture_callback, decoder_NewPicture() error leads to decoder failure. Fix #26915 --- modules/codec/dav1d.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/codec/dav1d.c b/modules/codec/dav1d.c index 12aebc36300..d58b3380103 100644 --- a/modules/codec/dav1d.c +++ b/modules/codec/dav1d.c @@ -199,6 +199,11 @@ static int NewPicture(Dav1dPicture *img, void *cookie) { picture_t *pic; pic = decoder_NewPicture(dec); + /* It can triggered by picture_pool_Cancel. Try to allocate a picture + * directly to avoid decoder failure. + */ + if (pic == NULL) + pic = picture_NewFromFormat(&dec->fmt_out.video); if (unlikely(pic == NULL)) return -1; -- GitLab