From 3d26d2f27bff2f67cdd9e32cb847c74220774d91 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Tue, 2 Jun 2020 19:31:58 +0200 Subject: [PATCH] sync elements: implement provide_clock Since those are using the clock for sync, they need to also provide a clock for good measure. The reason is that even if downstream elements provide a clock, we don't want to have that clock selected because it might not be running yet. --- generic/threadshare/src/inputselector.rs | 6 ++++++ generic/threadshare/src/jitterbuffer/jitterbuffer.rs | 6 ++++++ net/rusoto/src/aws_transcribe_parse.rs | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/generic/threadshare/src/inputselector.rs b/generic/threadshare/src/inputselector.rs index 8508d413..45e84a65 100644 --- a/generic/threadshare/src/inputselector.rs +++ b/generic/threadshare/src/inputselector.rs @@ -556,6 +556,8 @@ impl ObjectImpl for InputSelector { let element = obj.downcast_ref::().unwrap(); element.add_pad(self.src_pad.gst_pad()).unwrap(); + element + .set_element_flags(gst::ElementFlags::PROVIDE_CLOCK | gst::ElementFlags::REQUIRE_CLOCK); } } @@ -626,6 +628,10 @@ impl ElementImpl for InputSelector { let _ = element.post_message(&gst::Message::new_latency().src(Some(element)).build()); } + + fn provide_clock(&self, _element: &gst::Element) -> Option { + Some(gst::SystemClock::obtain()) + } } pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { diff --git a/generic/threadshare/src/jitterbuffer/jitterbuffer.rs b/generic/threadshare/src/jitterbuffer/jitterbuffer.rs index 748cfe0a..541f5868 100644 --- a/generic/threadshare/src/jitterbuffer/jitterbuffer.rs +++ b/generic/threadshare/src/jitterbuffer/jitterbuffer.rs @@ -1592,6 +1592,8 @@ impl ObjectImpl for JitterBuffer { let element = obj.downcast_ref::().unwrap(); element.add_pad(self.sink_pad.gst_pad()).unwrap(); element.add_pad(self.src_pad.gst_pad()).unwrap(); + element + .set_element_flags(gst::ElementFlags::PROVIDE_CLOCK | gst::ElementFlags::REQUIRE_CLOCK); } } @@ -1634,6 +1636,10 @@ impl ElementImpl for JitterBuffer { Ok(success) } + + fn provide_clock(&self, _element: &gst::Element) -> Option { + Some(gst::SystemClock::obtain()) + } } pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { diff --git a/net/rusoto/src/aws_transcribe_parse.rs b/net/rusoto/src/aws_transcribe_parse.rs index bd76108c..c8eecfea 100644 --- a/net/rusoto/src/aws_transcribe_parse.rs +++ b/net/rusoto/src/aws_transcribe_parse.rs @@ -1095,6 +1095,8 @@ impl ObjectImpl for Transcriber { let element = obj.downcast_ref::().unwrap(); element.add_pad(&self.sinkpad).unwrap(); element.add_pad(&self.srcpad).unwrap(); + element + .set_element_flags(gst::ElementFlags::PROVIDE_CLOCK | gst::ElementFlags::REQUIRE_CLOCK); } fn set_property(&self, _obj: &glib::Object, id: usize, value: &glib::Value) { @@ -1170,6 +1172,10 @@ impl ElementImpl for Transcriber { Ok(success) } + + fn provide_clock(&self, _element: &gst::Element) -> Option { + Some(gst::SystemClock::obtain()) + } } pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {