gst: Check for video/ caps before parsing for info

The gst_video_info_from_caps() API isn't really intended to be used as a
check-for-videoness function (it generates an error-level GStreamer
debug message when used this way).

We check the caps for a video/ name for this reason, which is
functionally equivalent.
This commit is contained in:
Arun Raghavan 2024-05-27 15:59:25 +03:00
parent 7eeb657d37
commit f400ff2050
2 changed files with 16 additions and 5 deletions

View file

@ -224,7 +224,14 @@ set_config (GstBufferPool * pool, GstStructure * config)
return FALSE;
}
has_video = gst_video_info_from_caps (&p->video_info, caps);
if (g_str_has_prefix (gst_structure_get_name (
gst_caps_get_structure (caps, 0)),
"video/")) {
has_video = TRUE;
gst_video_info_from_caps (&p->video_info, caps);
} else {
has_video = FALSE;
}
p->add_metavideo = has_video && gst_buffer_pool_config_has_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);