jitterbuffer: Minor code cleanup

This commit is contained in:
Sebastian Dröge 2019-09-07 10:53:11 +03:00
parent 83cc8104a1
commit 1084178e95
2 changed files with 4 additions and 14 deletions

View file

@ -719,13 +719,12 @@ impl JitterBuffer {
element: &gst::Element,
) -> Result<gst::FlowSuccess, gst::FlowError> {
let mut discont = false;
let (mut jb_item, _) = state.jbuf.borrow().pop();
let (jb_item, _) = state.jbuf.borrow().pop();
let dts = jb_item.get_dts();
let pts = jb_item.get_pts();
let seq = jb_item.get_seqnum();
/* FIXME: this is awkward */
let mut buffer = jb_item.take_buffer();
let mut buffer = jb_item.get_buffer();
let buffer = buffer.make_mut();

View file

@ -63,9 +63,8 @@ mod jitterbuffer;
mod proxy;
mod queue;
use glib::prelude::*;
use glib::translate::*;
use glib::ObjectExt;
use gst::MiniObject;
use std::mem;
use std::ptr;
@ -282,18 +281,10 @@ impl RTPJitterBufferItem {
}
}
pub fn get_buffer(&mut self) -> &mut gst::BufferRef {
pub fn get_buffer(&self) -> gst::Buffer {
unsafe {
let item = self.0.as_ref().expect("Invalid wrapper");
let buf = item.data as *mut gst_ffi::GstBuffer;
gst::BufferRef::from_mut_ptr(buf)
}
}
pub fn take_buffer(&mut self) -> gst::Buffer {
unsafe {
let item = self.0.take().expect("Invalid wrapper");
let buf = item.data as *mut gst_ffi::GstBuffer;
from_glib_none(buf)
}
}