mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +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/1220>
This commit is contained in:
parent
6cb469934d
commit
2354cd6c4f
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