From da22ff3846ddbe82214522989a09af491faff826 Mon Sep 17 00:00:00 2001 From: Haihao Xiang Date: Wed, 25 Dec 2019 10:51:36 +0800 Subject: [PATCH] msdkvp9enc: fix width and height The frame width and height is rounded up to 128 and 32 since commit 8daac1c, so the width, height for initialization should be rounded up to 128 and 32 too because the MSDK VP9 encoder will do some check on width and height. Sample pipeline: gst-launch-1.0 videotestsrc ! \ video/x-raw,width=320,height=240,format=NV12 ! msdkvp9enc ! fakesink --- sys/msdk/gstmsdkvp9enc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/msdk/gstmsdkvp9enc.c b/sys/msdk/gstmsdkvp9enc.c index 8aaa817073..a456d7a2e2 100644 --- a/sys/msdk/gstmsdkvp9enc.c +++ b/sys/msdk/gstmsdkvp9enc.c @@ -125,6 +125,15 @@ gst_msdkvp9enc_configure (GstMsdkEnc * encoder) encoder->param.mfx.CodecId = MFX_CODEC_VP9; encoder->param.mfx.CodecLevel = 0; encoder->param.mfx.CodecProfile = thiz->profile; + /* As the frame width and height is rounded up to 128 and 32 since commit 8daac1c, + * so the width, height for initialization should be rounded up to 128 and 32 + * too because VP9 encoder in MSDK will do some check on width and height. + */ + encoder->param.mfx.FrameInfo.Width = + GST_ROUND_UP_128 (encoder->param.mfx.FrameInfo.CropW); + encoder->param.mfx.FrameInfo.Height = + GST_ROUND_UP_32 (encoder->param.mfx.FrameInfo.CropH); + /* Always turn on this flag for VP9 */ encoder->param.mfx.LowPower = MFX_CODINGOPTION_ON;