[FFmpeg-devel] [PATCH] avcodec/h264_slice: properly handle missing reference frames with hwaccels
James Almer
jamrial at gmail.com
Mon Mar 8 16:00:53 EET 2021
Unlike av_image_copy(), av_frame_copy() supports hardware pixel formats.
Based on a patch by Hendrik Leppkes.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavcodec/h264_slice.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index fa7a639053..0916de6cd2 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1599,13 +1599,9 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
ff_thread_await_progress(&prev->tf, INT_MAX, 0);
if (prev->field_picture)
ff_thread_await_progress(&prev->tf, INT_MAX, 1);
- av_image_copy(h->short_ref[0]->f->data,
- h->short_ref[0]->f->linesize,
- (const uint8_t **)prev->f->data,
- prev->f->linesize,
- prev->f->format,
- prev->f->width,
- prev->f->height);
+ ret = av_frame_copy(h->short_ref[0]->f, prev->f);
+ if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
+ return ret;
h->short_ref[0]->poc = prev->poc + 2U;
} else if (!h->frame_recovered && !h->avctx->hwaccel)
ff_color_frame(h->short_ref[0]->f, c);
--
2.30.1
More information about the ffmpeg-devel
mailing list