Skip to content

Commit

Permalink
Increase packet lifetime to 3 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
rashad-signal authored Feb 22, 2024
1 parent cbc5146 commit 551574f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions backend/src/pacer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,26 +540,26 @@ mod tests {
assert_eq!(0, media_sent_times_ms.len());
assert_eq!(0, padding_sent_times_ms.len());

// Re-enable sending a little before 1 second out
pacer.configure(1000, 500, Some(padding_ssrc), 990);
// Re-enable sending a little before 3 seconds out
pacer.configure(1000, 500, Some(padding_ssrc), 2990);
let (media_sent_times_ms, padding_sent_times_ms) =
pacer.send(&[(26, 990), (27, 990)], &media, &padding);
pacer.send(&[(26, 2990), (27, 2990)], &media, &padding);

assert_eq!(0, padding_sent_times_ms.len());
assert_eq!(0, media_sent_times_ms.len());

let mut media_sent_times_ms = Vec::new();
let mut padding_sent_times_ms = Vec::new();
pacer.dequeue_until(
1021,
3021,
&padding,
&mut media_sent_times_ms,
&mut padding_sent_times_ms,
);

// pacer will discard packets over 1 second old, so packet 27 doesn't get sent at 1010
// padding will be timed from the last send (1000)
assert_eq!(vec![(25, 990), (26, 1000)], media_sent_times_ms);
assert_eq!(vec![1020], padding_sent_times_ms);
// pacer will discard packets over 3 seconds old, so packet 27 doesn't get sent at 3010
// padding will be timed from the last send (3000)
assert_eq!(vec![(25, 2990), (26, 3000)], media_sent_times_ms);
assert_eq!(vec![3020], padding_sent_times_ms);
}
}
4 changes: 2 additions & 2 deletions backend/src/rtp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ const RTX_PAYLOAD_TYPE_OFFSET: PayloadType = 10;
const RTX_SSRC_OFFSET: Ssrc = 1;

// Discard outgoing packets after this time.
// 1 second lifteime matches WebRTC's RTX history
const PACKET_LIFETIME: Duration = Duration::from_secs(1);
// 3 second lifetime matches WebRTC's RTX history
const PACKET_LIFETIME: Duration = Duration::from_secs(3);

pub type Key = Zeroizing<[u8; SRTP_KEY_LEN]>;
pub type Salt = [u8; SRTP_SALT_LEN];
Expand Down

0 comments on commit 551574f

Please sign in to comment.