onvifmetadataextractor: fix missing pts/dts in metadata buffer

Segments coming from the onvifmetadataextractor-plugin's meta_src do not inherit pts/dts from the input.
This leads to strange bugs when trying to send the metadata using rtp.
Fix this by appending the pts/dts of the incoming buffers to the outgoing metadata buffers

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/655

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2086>
This commit is contained in:
Mark-André Schadow 2025-02-18 14:46:35 +01:00 committed by GStreamer Marge Bot
parent c0b801ce46
commit 514cf57c56

View file

@ -206,6 +206,9 @@ impl OnvifMetadataExtractor {
let remove = self.settings.lock().unwrap().remove_metadata;
let pts = buffer.pts();
let dts = buffer.dts();
if let Ok(metas) =
gst::meta::CustomMeta::from_mut_buffer(buffer.make_mut(), "OnvifXMLFrameMeta")
{
@ -213,7 +216,14 @@ impl OnvifMetadataExtractor {
if let Ok(frames) = s.get::<gst::BufferList>("frames") {
frames.foreach(|meta_buf, _idx| {
let res = self.meta_src_pad.push(meta_buf.clone());
let mut buffer = meta_buf.clone();
{
let buffer = buffer.make_mut();
buffer.set_dts(dts);
buffer.set_pts(pts);
}
let res = self.meta_src_pad.push(buffer);
let _ = self
.flow_combiner
.lock()