Skip to content

srtp: make the ROC and SRTCP index accessors public (v0.17.x) - #960

Open
ggiesen wants to merge 1 commit into
webrtc-rs:v0.17.xfrom
ggiesen:srtp-public-roc
Open

ggiesen wants to merge 1 commit into
webrtc-rs:v0.17.xfrom
ggiesen:srtp-public-roc

Conversation

@ggiesen

@ggiesen ggiesen commented Nov 24, 2026

Copy link
Copy Markdown

Target branch: v0.17.x. rtc-srtp on master has the same four functions private; I can send the same change there.

Context::get_roc, set_roc, get_index and set_index are private, so a user of the crate cannot read a stream's rollover counter or SRTCP index, or restore them in a new context. Pion exports the same four (ROC, SetROC, Index, SetIndex).

I need them to carry SRTP-terminated calls over to a standby process when a SIP B2BUA's active process fails. The keys are not enough: a new context starts at ROC 0, so it stops decrypting a stream once that has rolled over (65,536 packets, about 22 minutes at 50 packets/s). A ROC signalled out of band needs them too.

This makes the four public and documents what set_roc and set_index do. The new test test_rtp_carried_on_with_set_roc carries a stream past a rollover over to new contexts and checks that they encrypt and decrypt as the old ones.

  • cargo test -p webrtc-srtp: 39 passed.
  • cargo clippy -p webrtc-srtp --all-targets -- -D warnings, cargo fmt --all -- --check: clean. The openssl features were not built (no OpenSSL headers here); the change does not touch that code.

Context::get_roc, set_roc, get_index and set_index were private, so a
user of the crate could not read a stream's rollover counter or SRTCP
index, or restore them in a new context. Pion exports the same four
(ROC, SetROC, Index, SetIndex).

Document what set_roc and set_index do, and add a test that carries a
stream past a rollover over to new contexts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant