threadshare/jitterbuffer: Avoid buffer copies

Replaces the RTPJitterBufferItem.get_buffer() method with an
into_buffer() version, ensuring that when we make it mutable we
don't make a copy (unless necessary)
This commit is contained in:
Mathieu Duponchelle 2019-12-09 22:02:01 +01:00 committed by Sebastian Dröge
parent 776708bee6
commit 5f9e923a04

View file

@ -198,11 +198,11 @@ impl RTPJitterBufferItem {
}
}
pub fn get_buffer(&self) -> gst::Buffer {
pub fn into_buffer(mut self) -> gst::Buffer {
unsafe {
let item = self.0.as_ref().expect("Invalid wrapper");
let item = self.0.take().expect("Invalid wrapper");
let buf = item.data as *mut gst_ffi::GstBuffer;
from_glib_none(buf)
from_glib_full(buf)
}
}