From 392bfc0b1e67ec207c0de6a7298e6b735752dcba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 25 Jun 2020 13:58:22 +0300 Subject: [PATCH] fallbacksrc: Create an `identity sync=true` if the new `clocksync` element can't be found --- utils/fallbackswitch/src/fallbacksrc.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/utils/fallbackswitch/src/fallbacksrc.rs b/utils/fallbackswitch/src/fallbacksrc.rs index 1343930e..723c3857 100644 --- a/utils/fallbackswitch/src/fallbacksrc.rs +++ b/utils/fallbackswitch/src/fallbacksrc.rs @@ -599,7 +599,14 @@ impl FallbackSrc { gst::ElementFactory::make("imagefreeze", Some("fallback_imagefreeze")) .expect("No imagefreeze found"); let clocksync = gst::ElementFactory::make("clocksync", Some("fallback_clocksync")) - .expect("No clocksync found"); + .or_else(|_| -> Result<_, glib::BoolError> { + let identity = + gst::ElementFactory::make("identity", Some("fallback_clocksync"))?; + identity.set_property("sync", &true).unwrap(); + Ok(identity) + }) + .expect("No clocksync or identity found"); + input .add_many(&[ &filesrc, @@ -753,7 +760,13 @@ impl FallbackSrc { let switch = gst::ElementFactory::make("fallbackswitch", None).expect("No fallbackswitch found"); - let clocksync = gst::ElementFactory::make("clocksync", None).expect("No clocksync found"); + let clocksync = gst::ElementFactory::make("clocksync", None) + .or_else(|_| -> Result<_, glib::BoolError> { + let identity = gst::ElementFactory::make("identity", None)?; + identity.set_property("sync", &true).unwrap(); + Ok(identity) + }) + .expect("No clocksync or identity found"); element .add_many(&[&fallback_input, &switch, &clocksync])