mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-02-16 12:55:13 +00:00
threadshare: Remove glib::SendUnique usage
It's being removed from the GLib bindings because it does not add much value.
This commit is contained in:
parent
558656deb5
commit
5af52f94a8
2 changed files with 16 additions and 25 deletions
|
@ -151,8 +151,8 @@ impl SinkHandler {
|
|||
) -> BTreeSet<GapPacket> {
|
||||
gst::info!(CAT, obj: element, "Resetting");
|
||||
|
||||
state.jbuf.borrow().flush();
|
||||
state.jbuf.borrow().reset_skew();
|
||||
state.jbuf.flush();
|
||||
state.jbuf.reset_skew();
|
||||
state.discont = true;
|
||||
|
||||
state.last_popped_seqnum = None;
|
||||
|
@ -211,7 +211,7 @@ impl SinkHandler {
|
|||
state.clock_rate = Some(clock_rate as u32);
|
||||
|
||||
inner.packet_rate_ctx.reset(clock_rate);
|
||||
state.jbuf.borrow().set_clock_rate(clock_rate as u32);
|
||||
state.jbuf.set_clock_rate(clock_rate as u32);
|
||||
|
||||
Ok(gst::FlowSuccess::Ok)
|
||||
}
|
||||
|
@ -404,14 +404,9 @@ impl SinkHandler {
|
|||
let max_dropout = inner.packet_rate_ctx.max_dropout(max_dropout_time as i32);
|
||||
let max_misorder = inner.packet_rate_ctx.max_dropout(max_misorder_time as i32);
|
||||
|
||||
pts = state.jbuf.borrow().calculate_pts(
|
||||
dts,
|
||||
estimated_dts,
|
||||
rtptime,
|
||||
element.base_time(),
|
||||
0,
|
||||
false,
|
||||
);
|
||||
pts = state
|
||||
.jbuf
|
||||
.calculate_pts(dts, estimated_dts, rtptime, element.base_time(), 0, false);
|
||||
|
||||
if pts.is_none() {
|
||||
gst::debug!(
|
||||
|
@ -462,7 +457,7 @@ impl SinkHandler {
|
|||
RTPJitterBufferItem::new(buffer, dts, pts, Some(seq), rtptime)
|
||||
};
|
||||
|
||||
let (success, _, _) = state.jbuf.borrow().insert(jb_item);
|
||||
let (success, _, _) = state.jbuf.insert(jb_item);
|
||||
|
||||
if !success {
|
||||
/* duplicate */
|
||||
|
@ -778,7 +773,7 @@ impl SrcHandler {
|
|||
let mut state = jb.state.lock().unwrap();
|
||||
|
||||
let mut discont = false;
|
||||
let (jb_item, _) = state.jbuf.borrow().pop();
|
||||
let (jb_item, _) = state.jbuf.pop();
|
||||
|
||||
let jb_item = match jb_item {
|
||||
None => {
|
||||
|
@ -995,7 +990,7 @@ struct Stats {
|
|||
|
||||
// Shared state between element, sink and source pad
|
||||
struct State {
|
||||
jbuf: glib::SendUniqueCell<RTPJitterBuffer>,
|
||||
jbuf: RTPJitterBuffer,
|
||||
|
||||
last_res: Result<gst::FlowSuccess, gst::FlowError>,
|
||||
position: Option<gst::ClockTime>,
|
||||
|
@ -1023,7 +1018,7 @@ struct State {
|
|||
impl Default for State {
|
||||
fn default() -> State {
|
||||
State {
|
||||
jbuf: glib::SendUniqueCell::new(RTPJitterBuffer::new()).unwrap(),
|
||||
jbuf: RTPJitterBuffer::new(),
|
||||
|
||||
last_res: Ok(gst::FlowSuccess::Ok),
|
||||
position: None,
|
||||
|
@ -1166,7 +1161,7 @@ impl TaskImpl for JitterBufferTask {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
let (head_pts, head_seq) = state.jbuf.borrow().peek();
|
||||
let (head_pts, head_seq) = state.jbuf.peek();
|
||||
|
||||
(head_pts, head_seq)
|
||||
};
|
||||
|
@ -1179,7 +1174,7 @@ impl TaskImpl for JitterBufferTask {
|
|||
state.last_res = res;
|
||||
|
||||
if head_pts == state.earliest_pts && head_seq == state.earliest_seqnum {
|
||||
let (earliest_pts, earliest_seqnum) = state.jbuf.borrow().find_earliest();
|
||||
let (earliest_pts, earliest_seqnum) = state.jbuf.find_earliest();
|
||||
state.earliest_pts = earliest_pts;
|
||||
state.earliest_seqnum = earliest_seqnum;
|
||||
}
|
||||
|
@ -1270,7 +1265,7 @@ impl JitterBuffer {
|
|||
|
||||
let mut state = self.state.lock().unwrap();
|
||||
state.clock_rate = None;
|
||||
state.jbuf.borrow().reset_skew();
|
||||
state.jbuf.reset_skew();
|
||||
}
|
||||
|
||||
fn prepare(&self, element: &super::JitterBuffer) -> Result<(), gst::ErrorMessage> {
|
||||
|
@ -1452,7 +1447,7 @@ impl ObjectImpl for JitterBuffer {
|
|||
};
|
||||
|
||||
let state = self.state.lock().unwrap();
|
||||
state.jbuf.borrow().set_delay(latency);
|
||||
state.jbuf.set_delay(latency);
|
||||
|
||||
let _ = obj.post_message(gst::message::Latency::builder().src(obj).build());
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ use std::ptr;
|
|||
|
||||
use glib::translate::*;
|
||||
use gst::glib;
|
||||
use gst::prelude::*;
|
||||
|
||||
use std::mem;
|
||||
|
||||
|
@ -35,11 +34,8 @@ glib::wrapper! {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl glib::SendUnique for RTPJitterBuffer {
|
||||
fn is_unique(&self) -> bool {
|
||||
self.ref_count() == 1
|
||||
}
|
||||
}
|
||||
// SAFETY: We ensure that we never get another reference to the jitterbuffer
|
||||
unsafe impl Send for RTPJitterBuffer {}
|
||||
|
||||
impl IntoGlib for RTPJitterBufferMode {
|
||||
type GlibType = ffi::RTPJitterBufferMode;
|
||||
|
|
Loading…
Reference in a new issue