mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
audio: Don't forget to unmap the AudioBuffer
and drop the Box
when converting into a gst::Buffer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1219>
This commit is contained in:
parent
60ad9b5038
commit
2ac85cd8de
1 changed files with 8 additions and 1 deletions
|
@ -37,7 +37,14 @@ impl<T> AudioBuffer<T> {
|
|||
|
||||
#[inline]
|
||||
pub fn into_buffer(self) -> gst::Buffer {
|
||||
unsafe { ptr::read(&mem::ManuallyDrop::new(self).buffer) }
|
||||
unsafe {
|
||||
let mut s = mem::ManuallyDrop::new(self);
|
||||
let buffer = ptr::read(&s.buffer);
|
||||
ffi::gst_audio_buffer_unmap(&mut *s.audio_buffer);
|
||||
ptr::drop_in_place(&mut s.audio_buffer);
|
||||
|
||||
buffer
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in a new issue