From 9064de27f9a79d5976df580b919e264fc9f98b2b Mon Sep 17 00:00:00 2001 From: Haihao Xiang Date: Wed, 25 Dec 2019 13:21:11 +0800 Subject: [PATCH] msdkvp9enc: fix 10bit encoding The codec profile should be consistent with the frame fourcc code, this fixes pipeline below: gst-launch-1.0 videotestsrc ! \ video/x-raw,width=320,height=240,format=P010_10LE ! msdkvp9enc ! \ fakesink --- sys/msdk/gstmsdkvp9enc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/msdk/gstmsdkvp9enc.c b/sys/msdk/gstmsdkvp9enc.c index a456d7a..af2dcd3 100644 --- a/sys/msdk/gstmsdkvp9enc.c +++ b/sys/msdk/gstmsdkvp9enc.c @@ -111,7 +111,6 @@ gst_msdkvp9enc_set_format (GstMsdkEnc * encoder) static gboolean gst_msdkvp9enc_configure (GstMsdkEnc * encoder) { - GstMsdkVP9Enc *thiz = GST_MSDKVP9ENC (encoder); mfxSession session; if (encoder->hardware) { @@ -124,7 +123,17 @@ gst_msdkvp9enc_configure (GstMsdkEnc * encoder) encoder->num_extra_frames = encoder->async_depth - 1; encoder->param.mfx.CodecId = MFX_CODEC_VP9; encoder->param.mfx.CodecLevel = 0; - encoder->param.mfx.CodecProfile = thiz->profile; + + switch (encoder->param.mfx.FrameInfo.FourCC) { + case MFX_FOURCC_P010: + encoder->param.mfx.CodecProfile = MFX_PROFILE_VP9_2; + break; + + default: + encoder->param.mfx.CodecProfile = MFX_PROFILE_VP9_0; + break; + } + /* 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. -- 2.7.4