rtprecv: Drop packets for which we have no clock-rate instead of panicking

Panicking if some spurious packet with an unknown payload type is
received is not good behaviour.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2364>
This commit is contained in:
Sebastian Dröge 2025-07-11 19:57:50 +03:00
parent 72677a6825
commit ae2e823340

View file

@ -712,10 +712,16 @@ impl RtpRecv {
let mut sync_context = self.sync_context.lock().unwrap();
let sync_context = sync_context.as_mut().unwrap();
if !sync_context.has_clock_rate(rtp.ssrc()) {
let clock_rate = session_inner
.session
.clock_rate_from_pt(rtp.payload_type())
.unwrap();
let Some(clock_rate) = session_inner.session.clock_rate_from_pt(rtp.payload_type())
else {
gst::warning!(
CAT,
imp = self,
"Have no clock-rate for payload type {}",
rtp.payload_type()
);
return Ok(RecvRtpBuffer::Drop);
};
sync_context.set_clock_rate(rtp.ssrc(), clock_rate);
}