mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-05 00:59:42 +00:00
onvifmetadataparse: Skip metadata frames with unrepresentable UTC time
Previously we would panic, which causes the element to post an error message. Instead, simply skip metadata frames if their UTC time since the UNIX epoch can't be represented as nanoseconds in u64. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1330>
This commit is contained in:
parent
d134e165c5
commit
26d90191b5
2 changed files with 18 additions and 9 deletions
|
@ -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"] }
|
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"
|
once_cell = "1.0"
|
||||||
xmlparser = "0.13"
|
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"] }
|
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" }
|
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" }
|
pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.17", version = "0.17" }
|
||||||
|
|
|
@ -359,8 +359,17 @@ impl OnvifMetadataParse {
|
||||||
gst::FlowError::Error
|
gst::FlowError::Error
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let dt_unix_ns =
|
let dt_unix_ns = dt
|
||||||
(dt.timestamp_nanos() as u64).nseconds() + crate::PRIME_EPOCH_OFFSET;
|
.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!(
|
gst::trace!(
|
||||||
CAT,
|
CAT,
|
||||||
|
|
Loading…
Reference in a new issue