rtpbin2: sync: fix race condition

Under some circumstances, the `ssrc` could be added to the `ssrcs` map without
the `clock_rate` being defined. When `rtprecv` would check wether the ssrc
`has_clock_rate()`, it would return `true` spuriously, which would then cause a
panic in `calculate_pts()`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2337>
This commit is contained in:
François Laignel 2025-07-02 13:33:34 +02:00
parent 594a0152ba
commit 096987a31c

View file

@ -119,7 +119,9 @@ impl Context {
}
pub fn has_clock_rate(&self, ssrc_val: u32) -> bool {
self.ssrcs.contains_key(&ssrc_val)
self.ssrcs
.get(&ssrc_val)
.is_some_and(|ssrc| ssrc.clock_rate.is_some())
}
fn disassociate(&mut self, ssrc_val: u32, cname: &str) {