mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-20 17:16:39 +00:00
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.
This commit is contained in:
parent
dfaf59a59b
commit
3d26d2f27b
3 changed files with 18 additions and 0 deletions
|
@ -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> {
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -1095,6 +1095,8 @@ impl ObjectImpl for Transcriber {
|
|||
let element = obj.downcast_ref::<gst::Element>().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<gst::Clock> {
|
||||
Some(gst::SystemClock::obtain())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||
|
|
Loading…
Reference in a new issue