diff options
author | Mathieu Duponchelle <mathieu@centricular.com> | 2020-04-13 18:06:14 +0300 |
---|---|---|
committer | Sebastian Dröge <slomo@coaxion.net> | 2020-04-13 20:25:31 +0300 |
commit | 8e2b79a90c941aea0b6ede12ae0291a330577f2f (patch) | |
tree | 132709547593eacca4da5948c418a07056092b09 /generic | |
parent | 5ad93604ef3dc5807ced735d79dadc0d7b159e23 (diff) |
threadshare: remove hand-rolled get_current_running_time
Instead, use the new Element method exposed in
<https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/450>
Diffstat (limited to 'generic')
-rw-r--r-- | generic/threadshare/src/inputselector.rs | 3 | ||||
-rw-r--r-- | generic/threadshare/src/jitterbuffer/jitterbuffer.rs | 5 | ||||
-rw-r--r-- | generic/threadshare/src/lib.rs | 13 | ||||
-rw-r--r-- | generic/threadshare/src/udpsink.rs | 2 |
4 files changed, 4 insertions, 19 deletions
diff --git a/generic/threadshare/src/inputselector.rs b/generic/threadshare/src/inputselector.rs index 47e3ba6f3..8811ccd1c 100644 --- a/generic/threadshare/src/inputselector.rs +++ b/generic/threadshare/src/inputselector.rs @@ -37,7 +37,6 @@ use std::sync::{Arc, Mutex}; use std::time::Duration; use std::u32; -use crate::get_current_running_time; use crate::runtime::prelude::*; use crate::runtime::{self, PadSink, PadSinkRef, PadSrc, PadSrcRef}; @@ -120,7 +119,7 @@ impl InputSelectorPadSinkHandler { /* Wait until specified time */ async fn sync(&self, element: &gst::Element, running_time: gst::ClockTime) { - let now = get_current_running_time(&element); + let now = element.get_current_running_time(); if now.is_some() && now < running_time { let delay = running_time - now; diff --git a/generic/threadshare/src/jitterbuffer/jitterbuffer.rs b/generic/threadshare/src/jitterbuffer/jitterbuffer.rs index 6e2a2244e..07ece7952 100644 --- a/generic/threadshare/src/jitterbuffer/jitterbuffer.rs +++ b/generic/threadshare/src/jitterbuffer/jitterbuffer.rs @@ -40,7 +40,6 @@ use std::sync::Arc; use std::sync::Mutex as StdMutex; use std::time::Duration; -use crate::get_current_running_time; use crate::runtime::prelude::*; use crate::runtime::{self, Context, PadSink, PadSinkRef, PadSrc, PadSrcRef, Task}; @@ -426,7 +425,7 @@ impl SinkHandler { } if dts == gst::CLOCK_TIME_NONE { - dts = get_current_running_time(element); + dts = element.get_current_running_time(); pts = dts; estimated_dts = state.clock_rate.is_some(); @@ -919,7 +918,7 @@ impl SrcHandler { latency: gst::ClockTime, context_wait: gst::ClockTime, ) -> (gst::ClockTime, Option<(gst::ClockTime, Duration)>) { - let now = get_current_running_time(element); + let now = element.get_current_running_time(); gst_debug!( CAT, diff --git a/generic/threadshare/src/lib.rs b/generic/threadshare/src/lib.rs index beb53569a..615148372 100644 --- a/generic/threadshare/src/lib.rs +++ b/generic/threadshare/src/lib.rs @@ -46,7 +46,6 @@ use glib_sys as glib_ffi; use gst; use gst::gst_plugin_define; -use gst::prelude::*; use gstreamer_sys as gst_ffi; fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { @@ -104,15 +103,3 @@ impl<'a> Drop for MutexGuard<'a> { } } } - -pub fn get_current_running_time(element: &gst::Element) -> gst::ClockTime { - if let Some(clock) = element.get_clock() { - if clock.get_time() > element.get_base_time() { - clock.get_time() - element.get_base_time() - } else { - 0.into() - } - } else { - gst::CLOCK_TIME_NONE - } -} diff --git a/generic/threadshare/src/udpsink.rs b/generic/threadshare/src/udpsink.rs index 18cd414f4..38617aa3e 100644 --- a/generic/threadshare/src/udpsink.rs +++ b/generic/threadshare/src/udpsink.rs @@ -745,7 +745,7 @@ impl UdpSinkPadHandler { /* Wait until specified time */ async fn sync(&self, element: &gst::Element, running_time: gst::ClockTime) { - let now = super::get_current_running_time(&element); + let now = element.get_current_running_time(); if now < running_time { let delay = running_time - now; |