mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-06-21 15:40:33 +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
|
@ -151,8 +151,8 @@ impl SinkHandler {
|
||||||
) -> BTreeSet<GapPacket> {
|
) -> BTreeSet<GapPacket> {
|
||||||
gst::info!(CAT, obj: element, "Resetting");
|
gst::info!(CAT, obj: element, "Resetting");
|
||||||
|
|
||||||
state.jbuf.borrow().flush();
|
state.jbuf.flush();
|
||||||
state.jbuf.borrow().reset_skew();
|
state.jbuf.reset_skew();
|
||||||
state.discont = true;
|
state.discont = true;
|
||||||
|
|
||||||
state.last_popped_seqnum = None;
|
state.last_popped_seqnum = None;
|
||||||
|
@ -211,7 +211,7 @@ impl SinkHandler {
|
||||||
state.clock_rate = Some(clock_rate as u32);
|
state.clock_rate = Some(clock_rate as u32);
|
||||||
|
|
||||||
inner.packet_rate_ctx.reset(clock_rate);
|
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)
|
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_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);
|
let max_misorder = inner.packet_rate_ctx.max_dropout(max_misorder_time as i32);
|
||||||
|
|
||||||
pts = state.jbuf.borrow().calculate_pts(
|
pts = state
|
||||||
dts,
|
.jbuf
|
||||||
estimated_dts,
|
.calculate_pts(dts, estimated_dts, rtptime, element.base_time(), 0, false);
|
||||||
rtptime,
|
|
||||||
element.base_time(),
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
|
|
||||||
if pts.is_none() {
|
if pts.is_none() {
|
||||||
gst::debug!(
|
gst::debug!(
|
||||||
|
@ -462,7 +457,7 @@ impl SinkHandler {
|
||||||
RTPJitterBufferItem::new(buffer, dts, pts, Some(seq), rtptime)
|
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 {
|
if !success {
|
||||||
/* duplicate */
|
/* duplicate */
|
||||||
|
@ -778,7 +773,7 @@ impl SrcHandler {
|
||||||
let mut state = jb.state.lock().unwrap();
|
let mut state = jb.state.lock().unwrap();
|
||||||
|
|
||||||
let mut discont = false;
|
let mut discont = false;
|
||||||
let (jb_item, _) = state.jbuf.borrow().pop();
|
let (jb_item, _) = state.jbuf.pop();
|
||||||
|
|
||||||
let jb_item = match jb_item {
|
let jb_item = match jb_item {
|
||||||
None => {
|
None => {
|
||||||
|
@ -995,7 +990,7 @@ struct Stats {
|
||||||
|
|
||||||
// Shared state between element, sink and source pad
|
// Shared state between element, sink and source pad
|
||||||
struct State {
|
struct State {
|
||||||
jbuf: glib::SendUniqueCell<RTPJitterBuffer>,
|
jbuf: RTPJitterBuffer,
|
||||||
|
|
||||||
last_res: Result<gst::FlowSuccess, gst::FlowError>,
|
last_res: Result<gst::FlowSuccess, gst::FlowError>,
|
||||||
position: Option<gst::ClockTime>,
|
position: Option<gst::ClockTime>,
|
||||||
|
@ -1023,7 +1018,7 @@ struct State {
|
||||||
impl Default for State {
|
impl Default for State {
|
||||||
fn default() -> State {
|
fn default() -> State {
|
||||||
State {
|
State {
|
||||||
jbuf: glib::SendUniqueCell::new(RTPJitterBuffer::new()).unwrap(),
|
jbuf: RTPJitterBuffer::new(),
|
||||||
|
|
||||||
last_res: Ok(gst::FlowSuccess::Ok),
|
last_res: Ok(gst::FlowSuccess::Ok),
|
||||||
position: None,
|
position: None,
|
||||||
|
@ -1166,7 +1161,7 @@ impl TaskImpl for JitterBufferTask {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let (head_pts, head_seq) = state.jbuf.borrow().peek();
|
let (head_pts, head_seq) = state.jbuf.peek();
|
||||||
|
|
||||||
(head_pts, head_seq)
|
(head_pts, head_seq)
|
||||||
};
|
};
|
||||||
|
@ -1179,7 +1174,7 @@ impl TaskImpl for JitterBufferTask {
|
||||||
state.last_res = res;
|
state.last_res = res;
|
||||||
|
|
||||||
if head_pts == state.earliest_pts && head_seq == state.earliest_seqnum {
|
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_pts = earliest_pts;
|
||||||
state.earliest_seqnum = earliest_seqnum;
|
state.earliest_seqnum = earliest_seqnum;
|
||||||
}
|
}
|
||||||
|
@ -1270,7 +1265,7 @@ impl JitterBuffer {
|
||||||
|
|
||||||
let mut state = self.state.lock().unwrap();
|
let mut state = self.state.lock().unwrap();
|
||||||
state.clock_rate = None;
|
state.clock_rate = None;
|
||||||
state.jbuf.borrow().reset_skew();
|
state.jbuf.reset_skew();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare(&self, element: &super::JitterBuffer) -> Result<(), gst::ErrorMessage> {
|
fn prepare(&self, element: &super::JitterBuffer) -> Result<(), gst::ErrorMessage> {
|
||||||
|
@ -1452,7 +1447,7 @@ impl ObjectImpl for JitterBuffer {
|
||||||
};
|
};
|
||||||
|
|
||||||
let state = self.state.lock().unwrap();
|
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());
|
let _ = obj.post_message(gst::message::Latency::builder().src(obj).build());
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ use std::ptr;
|
||||||
|
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst::glib;
|
use gst::glib;
|
||||||
use gst::prelude::*;
|
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
|
@ -35,11 +34,8 @@ glib::wrapper! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl glib::SendUnique for RTPJitterBuffer {
|
// SAFETY: We ensure that we never get another reference to the jitterbuffer
|
||||||
fn is_unique(&self) -> bool {
|
unsafe impl Send for RTPJitterBuffer {}
|
||||||
self.ref_count() == 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl IntoGlib for RTPJitterBufferMode {
|
impl IntoGlib for RTPJitterBufferMode {
|
||||||
type GlibType = ffi::RTPJitterBufferMode;
|
type GlibType = ffi::RTPJitterBufferMode;
|
||||||
|
|
Loading…
Reference in a new issue