diff --git a/modules/codec/dav1d.c b/modules/codec/dav1d.c index 12aebc36300b226d4ef8317875dfc35b68799e7b..d58b3380103f32acce30c5fd5be7a43486a8b276 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;