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>
This commit is contained in:
Mathieu Duponchelle 2020-04-13 17:06:14 +02:00 committed by Sebastian Dröge
parent 5ad93604ef
commit 8e2b79a90c
4 changed files with 4 additions and 19 deletions

View file

@ -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;

View file

@ -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,

View file

@ -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
}
}

View file

@ -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;