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 /audio/csound/src/filter/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 'audio/csound/src/filter/imp.rs')
-rw-r--r-- | audio/csound/src/filter/imp.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/audio/csound/src/filter/imp.rs b/audio/csound/src/filter/imp.rs index b3c649ae6..c6f479c9c 100644 --- a/audio/csound/src/filter/imp.rs +++ b/audio/csound/src/filter/imp.rs @@ -120,8 +120,9 @@ impl State { // pts at the beginning of the adapter. let samples = distance / self.in_info.bpf() as u64; prev_pts - .zip(self.samples_to_time(samples)) - .map(|(prev_pts, time_offset)| prev_pts + time_offset) + .opt_checked_add(self.samples_to_time(samples)) + .ok() + .flatten() } fn buffer_duration(&self, buffer_size: u64) -> Option<gst::ClockTime> { |