mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +00:00
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:
parent
5ad93604ef
commit
8e2b79a90c
4 changed files with 4 additions and 19 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue