mfvideosrc: Check framerate for target IMediaFrameFormat selection

Not only resolution and format, but framerate needs to be checked
for proper target IMediaFrameFormat selection.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1478>
This commit is contained in:
Seungha Yang 2020-08-01 00:53:46 +09:00 committed by GStreamer Merge Bot
parent 3fb8caf635
commit 479a67c1b7

View file

@ -787,6 +787,8 @@ MediaCaptureWrapper::mediaCaptureInitPost (ComPtr<IAsyncAction> init_async,
HString subtype;
UINT32 width = 0;
UINT32 height = 0;
UINT32 fps_n = 0;
UINT32 fps_d = 1;
hr = formatList->GetAt (i, &fmt);
if (!gst_mf_result (hr))
@ -813,6 +815,27 @@ MediaCaptureWrapper::mediaCaptureInitPost (ComPtr<IAsyncAction> init_async,
continue;
}
hr = fmt->get_FrameRate (&ratio);
if (!gst_mf_result (hr))
continue;
hr = ratio->get_Numerator (&fps_n);
if (!gst_mf_result (hr))
continue;
hr = ratio->get_Denominator (&fps_d);
if (!gst_mf_result (hr))
continue;
if ((gint) fps_n != GST_VIDEO_INFO_FPS_N (&videoInfo) ||
(gint) fps_d != GST_VIDEO_INFO_FPS_D (&videoInfo)) {
GST_DEBUG ("IMediaFrameFormat[%d], framerate %d/%d is not equal to "
"target framerate %d/%d", i, width, height,
GST_VIDEO_INFO_FPS_N (&videoInfo),
GST_VIDEO_INFO_FPS_D (&videoInfo));
continue;
}
/* TODO: check major type for audio */
hr = fmt->get_Subtype (subtype.GetAddressOf ());
if (!gst_mf_result (hr))