From 2166befce7e5780a170b8a33cb41d70b3d4de6a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 27 Apr 2025 22:00:48 +0300 Subject: [PATCH] dav1ddec: Set output frame duration via the codec frame Part-of: --- video/dav1d/src/dav1ddec/imp.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/video/dav1d/src/dav1ddec/imp.rs b/video/dav1d/src/dav1ddec/imp.rs index 5e2587e7e..cfcc542fa 100644 --- a/video/dav1d/src/dav1ddec/imp.rs +++ b/video/dav1d/src/dav1ddec/imp.rs @@ -544,6 +544,11 @@ impl Dav1dDec { drop(state_guard); + let duration = pic.duration() as u64; + if duration > 0 { + codec_frame.set_duration(gst::ClockTime::from_nseconds(duration)); + } + if forward_buffer { // SAFETY: The frame is still write-mapped in dav1d but won't be modified // anymore. We don't have a way to atomically re-map it read-only. @@ -553,11 +558,6 @@ impl Dav1dDec { let in_vframe_ptr = in_vframe.as_ptr(); let buffer_ptr = (*in_vframe_ptr).buffer; - let duration = pic.duration() as u64; - if duration > 0 { - (*buffer_ptr).duration = duration; - } - let codec_frame_ptr = codec_frame.to_glib_none().0; gst::ffi::gst_mini_object_ref(buffer_ptr as *mut _); (*codec_frame_ptr).output_buffer = buffer_ptr; @@ -569,11 +569,6 @@ impl Dav1dDec { .output_buffer_mut() .expect("output_buffer is set"); - let duration = pic.duration() as u64; - if duration > 0 { - mut_buffer.set_duration(duration.nseconds()); - } - gst::trace!( gst::CAT_PERFORMANCE, imp = self,