reset SRTP ROC to zero when SSRC changes

workaround as per issue #102 for broken audio after SSRC change by
hold/unhold. workaround before full multi-SSRC support is available.
pull/107/head
Richard Fuchs 11 years ago
parent e7868da867
commit 39a305f4ba

@ -73,6 +73,7 @@ struct crypto_context {
char session_salt[SRTP_MAX_SESSION_SALT_LEN]; /* k_s */
char session_auth_key[SRTP_MAX_SESSION_AUTH_LEN];
u_int32_t ssrc;
u_int64_t last_index;
/* XXX replay list */
/* <from, to>? */
@ -138,6 +139,7 @@ INLINE void crypto_cleanup(struct crypto_context *c) {
INLINE void crypto_reset(struct crypto_context *c) {
crypto_cleanup(c);
c->last_index = 0;
c->ssrc = 0;
}
INLINE void crypto_params_copy(struct crypto_params *o, const struct crypto_params *i) {
crypto_params_cleanup(o);

@ -189,6 +189,14 @@ int rtp_avp2savp(str *s, struct crypto_context *c) {
if (check_session_keys(c))
return -1;
/* SSRC is part of the crypto context and ROC must be reset when it changes */
if (G_UNLIKELY(!c->ssrc))
c->ssrc = rtp->ssrc;
else if (G_UNLIKELY(c->ssrc != rtp->ssrc)) {
c->last_index = 0;
c->ssrc = rtp->ssrc;
}
index = packet_index(c, rtp);
/* rfc 3711 section 3.1 */

Loading…
Cancel
Save