[FFmpeg-cvslog] qsvenc: AV_PIX_FMT_QSV path should release frame

Maxym Dmytrychenko git at videolan.org
Tue Sep 18 19:29:44 EEST 2018


ffmpeg | branch: master | Maxym Dmytrychenko <maxim.d33 at gmail.com> | Tue Sep 18 09:47:52 2018 +0200| [a2041a6522642859ce64af1c618d6fb90a50d4af] | committer: Maxym Dmytrychenko

qsvenc: AV_PIX_FMT_QSV path should release frame

Fixes high memory usage and prevents over allocation of the frames via
proper unref.

Can be checked as:
-hwaccel qsv -c:v h264_qsv -i ../h264-conformance/CANL2_Sony_E.jsv -c:v
h264_qsv -b:v 2000k -y qsv.mp4

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2041a6522642859ce64af1c618d6fb90a50d4af
---

 libavcodec/qsvenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 611449cbeb..17a0559f36 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1028,6 +1028,9 @@ static void clear_unused_frames(QSVEncContext *q)
     QSVFrame *cur = q->work_frames;
     while (cur) {
         if (cur->used && !cur->surface.Data.Locked) {
+            if (cur->frame->format == AV_PIX_FMT_QSV) {
+                av_frame_unref(cur->frame);
+            }
             cur->used = 0;
         }
         cur = cur->next;



More information about the ffmpeg-cvslog mailing list