video: Don't forget to unmap the VideoFrame when converting into a gst::Buffer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1219>
This commit is contained in:
Sebastian Dröge 2023-02-13 14:28:47 +02:00
parent 2ac85cd8de
commit 6ffb1db482

View file

@ -46,8 +46,12 @@ impl<T> VideoFrame<T> {
#[inline]
pub fn into_buffer(self) -> gst::Buffer {
let s = mem::ManuallyDrop::new(self);
unsafe { ptr::read(&s.buffer) }
unsafe {
let mut s = mem::ManuallyDrop::new(self);
let buffer = ptr::read(&s.buffer);
ffi::gst_video_frame_unmap(&mut s.frame);
buffer
}
}
#[doc(alias = "gst_video_frame_copy")]