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/1220>
This commit is contained in:
Sebastian Dröge 2023-02-13 14:28:47 +02:00
parent 2354cd6c4f
commit bc3e1404d6

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")]