From cc7bb86aa661cc8969a5785cea48c8f6c655e799 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 25 Mar 2021 03:24:11 +0900 Subject: [PATCH] mfvideoenc: Don't pass 0/1 framerate to MFT Some MFT implementations do not accept 0/1 framerate and it will result in encoder open failure. If framerate is unknown, we will use arbitrary 25/1 framerate value. Part-of: --- sys/mediafoundation/gstmfvideoenc.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/mediafoundation/gstmfvideoenc.cpp b/sys/mediafoundation/gstmfvideoenc.cpp index 8bedc5f605..968a6e41f4 100644 --- a/sys/mediafoundation/gstmfvideoenc.cpp +++ b/sys/mediafoundation/gstmfvideoenc.cpp @@ -320,8 +320,11 @@ gst_mf_video_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state) fps_n = GST_VIDEO_INFO_FPS_N (info); fps_d = GST_VIDEO_INFO_FPS_D (info); - if (fps_n == 0 || fps_d == 0) { - fps_n = 0; + if (fps_n <= 0 || fps_d <= 0) { + /* XXX: not sure why. NVIDIA MFT accepts 0/1 framerate, but Intel or + * Microsoft's software MFT doesn't accept 0/1 framerate. + * Need to set something meaningful value here therefore */ + fps_n = 25; fps_d = 1; }