webrtcsink: don't try to use cudaconvert if not present

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1248>
This commit is contained in:
Mathieu Duponchelle 2023-06-08 15:31:59 +02:00 committed by Sebastian Dröge
parent f3ae457cfa
commit 927c3e9bdf

View file

@ -324,14 +324,30 @@ fn make_converter_for_video_caps(caps: &gst::Caps) -> Result<gst::Element, Error
let (head, mut tail) = {
if let Some(feature) = caps.features(0) {
if feature.contains(CUDA_MEMORY_FEATURE) {
let cudaupload = make_element("cudaupload", None)?;
let cudaconvert = make_element("cudaconvert", None)?;
let cudascale = make_element("cudascale", None)?;
if let Some(convert_factory) = gst::ElementFactory::find("cudaconvert") {
let cudaupload = make_element("cudaupload", None)?;
let cudaconvert = convert_factory.create().build()?;
let cudascale = make_element("cudascale", None)?;
ret.add_many(&[&cudaupload, &cudaconvert, &cudascale])?;
gst::Element::link_many(&[&cudaupload, &cudaconvert, &cudascale])?;
ret.add_many(&[&cudaupload, &cudaconvert, &cudascale])?;
gst::Element::link_many(&[&cudaupload, &cudaconvert, &cudascale])?;
(cudaupload, cudascale)
(cudaupload, cudascale)
} else {
let cudadownload = make_element("cudadownload", None)?;
let convert = make_element("videoconvert", None)?;
let scale = make_element("videoscale", None)?;
gst::warning!(
CAT,
"No cudaconvert factory available, falling back to software"
);
ret.add_many(&[&cudadownload, &convert, &scale])?;
gst::Element::link_many(&[&cudadownload, &convert, &scale])?;
(cudadownload, scale)
}
} else if feature.contains(GL_MEMORY_FEATURE) {
let glupload = make_element("glupload", None)?;
let glconvert = make_element("glcolorconvert", None)?;