mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-23 17:38:20 +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/1327>
This commit is contained in:
parent
4fc905c9ea
commit
04136b6cc1
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.19", version = "0.19", features = ["v1_20"] }
|
gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", branch = "0.19", version = "0.19", 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.16", version = "0.16", features=["use_glib"] }
|
cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16", features=["use_glib"] }
|
||||||
pango = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16" }
|
pango = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16" }
|
||||||
pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16" }
|
pangocairo = { git = "https://github.com/gtk-rs/gtk-rs-core", branch = "0.16", version = "0.16" }
|
||||||
|
|
|
@ -219,12 +219,12 @@ impl OnvifMetadataParse {
|
||||||
Some(diff) => diff,
|
Some(diff) => diff,
|
||||||
None => {
|
None => {
|
||||||
gst::error!(
|
gst::error!(
|
||||||
CAT,
|
CAT,
|
||||||
obj: pad,
|
obj: pad,
|
||||||
"Too big running time difference between initial running time {:?} and current running time {:?}",
|
"Too big running time difference between initial running time {:?} and current running time {:?}",
|
||||||
initial_running_time,
|
initial_running_time,
|
||||||
running_time,
|
running_time,
|
||||||
);
|
);
|
||||||
return Err(gst::FlowError::Error);
|
return Err(gst::FlowError::Error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -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