diff --git a/net/onvif/Cargo.toml b/net/onvif/Cargo.toml index c4581295..cbaf88e0 100644 --- a/net/onvif/Cargo.toml +++ b/net/onvif/Cargo.toml @@ -15,7 +15,7 @@ gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/g gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", branch = "0.20", version = "0.20", features = ["v1_20"] } once_cell = "1.0" xmlparser = "0.13" -chrono = { version = "0.4", default-features = false } +chrono = { version = "0.4.31", default-features = false } cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.17", version = "0.17", features=["use_glib"] } pango = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.17", version = "0.17" } pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.17", version = "0.17" } diff --git a/net/onvif/src/onvifmetadataparse/imp.rs b/net/onvif/src/onvifmetadataparse/imp.rs index 2e138d54..3ec0991b 100644 --- a/net/onvif/src/onvifmetadataparse/imp.rs +++ b/net/onvif/src/onvifmetadataparse/imp.rs @@ -219,12 +219,12 @@ impl OnvifMetadataParse { Some(diff) => diff, None => { gst::error!( - CAT, - obj: pad, - "Too big running time difference between initial running time {:?} and current running time {:?}", - initial_running_time, - running_time, - ); + CAT, + obj: pad, + "Too big running time difference between initial running time {:?} and current running time {:?}", + initial_running_time, + running_time, + ); return Err(gst::FlowError::Error); } }; @@ -359,8 +359,17 @@ impl OnvifMetadataParse { gst::FlowError::Error })?; - let dt_unix_ns = - (dt.timestamp_nanos() as u64).nseconds() + crate::PRIME_EPOCH_OFFSET; + let dt_unix_ns = dt + .timestamp_nanos_opt() + .and_then(|ns| u64::try_from(ns).ok()) + .and_then(|ns| ns.nseconds().checked_add(crate::PRIME_EPOCH_OFFSET)); + + let dt_unix_ns = if let Some(dt_unix_ns) = dt_unix_ns { + dt_unix_ns + } else { + gst::warning!(CAT, imp: self, "Frame with unrepresentable UTC time {}", dt,); + continue; + }; gst::trace!( CAT,