algesten / str0m

A Sans I/O WebRTC implementation in Rust.
MIT License
317 stars 49 forks source link

Remember max rx SeqNo per SSRC #535

Closed algesten closed 3 months ago

algesten commented 3 months ago

We got code for dynamically discovering SSRC changes. This is detected when a mid/rid or mid/pt header combo starts on one SSRC and then changes to another.

As a special case, it could happen that the sender reuses an SSRC it used previously.

A -> B -> A

The SRTP IV is derived from the extended sequence number. If one IV is reused even once, the encryption is broken. Hence the sender is not allowed to reuse sequence numbers.

That means the above scenario, where we reuse a previously used SSRC, we must remember the old sequence number to be able to restart from the correct ROC.