diff --git a/src/client/parse.rs b/src/client/parse.rs index 98dc483..d0f345d 100644 --- a/src/client/parse.rs +++ b/src/client/parse.rs @@ -547,8 +547,9 @@ pub(crate) fn parse_setup(response: &rtsp_types::Response) -> Result { if let Some(v) = timeout_str.trim().strip_prefix("timeout=") { + let v = v.strip_suffix(";").unwrap_or(v); let timeout_sec = - u32::from_str_radix(v, 10).map_err(|_| format!("Unparseable timeout {v}"))?; + u32::from_str_radix(v, 10).map_err(|_| format!("Unparseable timeout [{v}]"))?; if timeout_sec == 0 { // This would make Retina send keepalives at an absurd rate; reject. diff --git a/src/client/rtp.rs b/src/client/rtp.rs index 935e4d4..519510c 100644 --- a/src/client/rtp.rs +++ b/src/client/rtp.rs @@ -135,6 +135,11 @@ impl InorderParser { stream_id: usize, data: Bytes, ) -> Result, Error> { + if !(data.len() >= 12 && data[0] > 127 && data[0] < 192) { + //this is for rtcp + debug!("skip invalid rtp pkt, maybe it is rtcp"); + return Ok(None); + } let (raw, payload_range) = RawPacket::new(data).map_err(|e| { wrap!(ErrorInt::PacketError { conn_ctx: *conn_ctx,