diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2020-06-02 20:31:58 +0300 |
---|---|---|
committer | Mathieu Duponchelle <mathieu@centricular.com> | 2020-06-02 20:31:58 +0300 |
commit | 3d26d2f27bff2f67cdd9e32cb847c74220774d91 (patch) | |
tree | 54fc40440ceb6f899013c2ef228f56ad7b35a5e8 /generic | |
parent | dfaf59a59ba1ef0669172210f29a154a4034e4c8 (diff) |
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.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/threadshare/src/inputselector.rs | 6 | ||||
-rw-r--r-- | generic/threadshare/src/jitterbuffer/jitterbuffer.rs | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/generic/threadshare/src/inputselector.rs b/generic/threadshare/src/inputselector.rs index 8508d4131..45e84a65d 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::<gst::Element>().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<gst::Clock> { + 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 748cfe0a2..541f5868f 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::<gst::Element>().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<gst::Clock> { + Some(gst::SystemClock::obtain()) + } } pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { |