Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2020-04-14 21:53:01 +0300
committerMathieu Duponchelle <mduponchelle1@gmail.com>2020-04-22 15:40:23 +0300
commitbdfb24abbd4beb46469d6bac063c7083263857a2 (patch)
tree59a6bc9576cccc850f219b9d3d3229905e66ce40 /generic
parentd08268627e780cedface22f169482240defbe063 (diff)
jitterbuffer: release state lock when requesting pt map
This is similar to what the standard jitterbuffer does, and is necessary to avoid deadlocks with the rtpbin session lock, if the user calls onto any API that requires us to take the state lock at the wrong time (eg setting the latency property, clearing the pt map)
Diffstat (limited to 'generic')
-rw-r--r--generic/threadshare/src/jitterbuffer/jitterbuffer.rs27
1 files changed, 17 insertions, 10 deletions
diff --git a/generic/threadshare/src/jitterbuffer/jitterbuffer.rs b/generic/threadshare/src/jitterbuffer/jitterbuffer.rs
index 07ece7952..273cba426 100644
--- a/generic/threadshare/src/jitterbuffer/jitterbuffer.rs
+++ b/generic/threadshare/src/jitterbuffer/jitterbuffer.rs
@@ -450,16 +450,23 @@ impl SinkHandler {
}
}
- if state.clock_rate.is_none() {
- let caps = element
- .emit("request-pt-map", &[&(pt as u32)])
- .map_err(|_| gst::FlowError::Error)?
- .ok_or(gst::FlowError::Error)?
- .get::<gst::Caps>()
- .map_err(|_| gst::FlowError::Error)?
- .ok_or(gst::FlowError::Error)?;
- self.parse_caps(inner, &mut state, element, &caps, pt)?;
- }
+ let mut state = {
+ if state.clock_rate.is_none() {
+ drop(state);
+ let caps = element
+ .emit("request-pt-map", &[&(pt as u32)])
+ .map_err(|_| gst::FlowError::Error)?
+ .ok_or(gst::FlowError::Error)?
+ .get::<gst::Caps>()
+ .map_err(|_| gst::FlowError::Error)?
+ .ok_or(gst::FlowError::Error)?;
+ let mut state = jb.state.lock().unwrap();
+ self.parse_caps(inner, &mut state, element, &caps, pt)?;
+ state
+ } else {
+ state
+ }
+ };
inner.packet_rate_ctx.update(seq, rtptime);