diff options
author | François Laignel <fengalin@free.fr> | 2021-10-09 13:17:05 +0300 |
---|---|---|
committer | François Laignel <fengalin@free.fr> | 2021-10-18 16:09:47 +0300 |
commit | 27b9f0d868f436e9b2bcc3e51f393c40b56fcc02 (patch) | |
tree | 93c0db7b1cf26ea7d0e3a4d70a7d2844c2e00975 /generic/threadshare/src/appsrc/imp.rs | |
parent | bd8a7e8df7e8ebf751b2d00fe6a096d726683c00 (diff) |
Improve usability thanks to opt-ops
The crate option-operations simplifies usage when dealing with
`Option`s, which is often the case with `ClockTime`.
Diffstat (limited to 'generic/threadshare/src/appsrc/imp.rs')
-rw-r--r-- | generic/threadshare/src/appsrc/imp.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/generic/threadshare/src/appsrc/imp.rs b/generic/threadshare/src/appsrc/imp.rs index 2f5dd4284..a0d9cb3e4 100644 --- a/generic/threadshare/src/appsrc/imp.rs +++ b/generic/threadshare/src/appsrc/imp.rs @@ -38,8 +38,7 @@ use crate::runtime::prelude::*; use crate::runtime::{Context, PadSrc, PadSrcRef, PadSrcWeak, Task, TaskState}; const DEFAULT_CONTEXT: &str = ""; -// FIXME use Duration::ZERO when MSVC >= 1.53.2 -const DEFAULT_CONTEXT_WAIT: Duration = Duration::from_nanos(0); +const DEFAULT_CONTEXT_WAIT: Duration = Duration::ZERO; const DEFAULT_CAPS: Option<gst::Caps> = None; const DEFAULT_MAX_BUFFERS: u32 = 10; const DEFAULT_DO_TIMESTAMP: bool = false; @@ -391,10 +390,7 @@ impl AppSrc { let now = clock.time(); let buffer = buffer.make_mut(); - buffer.set_dts( - now.zip(base_time) - .and_then(|(now, base_time)| now.checked_sub(base_time)), - ); + buffer.set_dts(now.opt_checked_sub(base_time).ok().flatten()); buffer.set_pts(None); } else { gst_error!(CAT, obj: element, "Don't have a clock yet"); |