Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: connection failed with some cctv #106

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/client/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,9 @@ pub(crate) fn parse_setup(response: &rtsp_types::Response<Bytes>) -> Result<Setu
},
Some((id, timeout_str)) => {
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.
Expand Down
5 changes: 5 additions & 0 deletions src/client/rtp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ impl InorderParser {
stream_id: usize,
data: Bytes,
) -> Result<Option<PacketItem>, 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,
Expand Down