mirror of https://github.com/mpv-player/mpv
video: fix memory leaks with hwdec copy modes
This leaked 2 unreffed AVFrame structs (roughly 1KB) per decoded frame. Can I blame the FFmpeg API and the weird difference between freeing and unreffing an AVFrame?
This commit is contained in:
parent
c5fac0c2b0
commit
afd5f3227e
|
@ -297,9 +297,9 @@ struct mp_image *mp_image_hw_download(struct mp_image *src,
|
|||
}
|
||||
|
||||
int res = av_hwframe_transfer_data(dstav, srcav, 0);
|
||||
av_frame_unref(srcav);
|
||||
av_frame_free(&srcav);
|
||||
dst = mp_image_from_av_frame(dstav);
|
||||
av_frame_unref(dstav);
|
||||
av_frame_free(&dstav);
|
||||
if (res >= 0 && dst) {
|
||||
mp_image_set_size(dst, src->w, src->h);
|
||||
mp_image_copy_attributes(dst, src);
|
||||
|
|
Loading…
Reference in New Issue