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
This commit is contained in:
Haihao Xiang 2019-12-25 13:21:11 +08:00
parent da22ff3846
commit 9064de27f9

View file

@ -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.