diff mbox series

[FFmpeg-devel] avcodec/qsvenc: clear mfx frame type in submit_frame

Message ID CAO5RS13pQybOWJ+GTwD8UxorS8=L-WakMKm-w-_-KJHuMMVLRg@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/qsvenc: clear mfx frame type in submit_frame | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make warning Make failed

Commit Message

Zivkovic, Milos Oct. 10, 2020, 5:25 p.m. UTC
Hello,

I've attached a patch that clears the mfxEncodeCtrl::FrameType field.
Since QSVFrames are reused, this field can affect not only the frame
it was supposed to affect, but also the subsequent ones.

It would be enough to force a keyframe only once and that QSVFrame
will have the FrameType field set until the end of times.
Once that QSVFrame gets reused the output frame will also be a
keyframe, even though that might not have been requested.
Subject: [PATCH] avcodec/qsvenc: clear mfx frame type in submit_frame

Signed-off-by: Milos Zivkovic <zivkovic@teralogics.com>
---
 libavcodec/qsvenc.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 1ed8f5d..f1b8994 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -1371,6 +1371,7 @@  static int submit_frame(QSVEncContext *q, const AVFrame *frame,
     }
 
     qf->surface.Data.TimeStamp = av_rescale_q(frame->pts, q->avctx->time_base, (AVRational){1, 90000});
+    qf->enc_ctrl.FrameType = MFX_FRAMETYPE_UNKNOWN;
 
     *new_frame = qf;