diff options
author | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2017-05-02 19:39:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-02 19:39:23 +0200 |
commit | 9dd09211bb52d85ccf7cc78e7e818ad0663f5d9a (patch) | |
tree | 574031af192e3f93d39cf1eb6930aaeb3a357165 /modules | |
parent | 893ba0894236eecf497e1d013bda364cc88569ee (diff) |
attempt to fix SRTP for early-media (ref #229) (#243)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/srtp/srtp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/srtp/srtp.c b/modules/srtp/srtp.c index b327154..217e5bf 100644 --- a/modules/srtp/srtp.c +++ b/modules/srtp/srtp.c @@ -34,6 +34,7 @@ struct menc_st { uint8_t key_rx[32]; struct srtp *srtp_tx, *srtp_rx; bool use_srtp; + bool got_sdp; char *crypto_suite; void *rtpsock; @@ -194,6 +195,9 @@ static bool recv_handler(struct sa *src, struct mbuf *mb, void *arg) int err = 0; (void)src; + if (!st->got_sdp) + return true; /* drop the packet */ + if (!st->use_srtp || !is_rtp_or_rtcp(mb)) return false; @@ -347,6 +351,9 @@ static int alloc(struct menc_media **stp, struct menc_sess *sess, /* SDP handling */ + if (sdp_media_rport(sdpm)) + st->got_sdp = true; + if (sdp_media_rattr(st->sdpm, "crypto")) { rattr = sdp_media_rattr_apply(st->sdpm, "crypto", |