diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2012-02-28 10:38:32 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2012-02-28 10:38:32 +0000 |
commit | 3110b10b458935b951ff351a309b54f451ff7d22 (patch) | |
tree | 12e67dcd59f2618bfd3321f90ea570d7631b01e0 /pjmedia/src | |
parent | 43a425f06f2e69ea5b6c5c27da7b24cdc1036a10 (diff) |
Fix #1456: don't use SRTP internal state (tx_policy/rx_policy) directly for calling pjmedia_transport_srtp_start() in restarting SRTP after getting replay error.
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3961 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src')
-rw-r--r-- | pjmedia/src/pjmedia/transport_srtp.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/pjmedia/src/pjmedia/transport_srtp.c b/pjmedia/src/pjmedia/transport_srtp.c index 85ee70e9..b37fd79b 100644 --- a/pjmedia/src/pjmedia/transport_srtp.c +++ b/pjmedia/src/pjmedia/transport_srtp.c @@ -907,19 +907,22 @@ static void srtp_rtp_cb( void *user_data, void *pkt, pj_ssize_t size) (err == err_status_replay_old || err == err_status_replay_fail)) { /* Handle such condition that stream is updated (RTP seq is reinited - * & SRTP is restarted), but some old packets are still coming - * so SRTP is learning wrong RTP seq. While the newly inited RTP seq - * comes, SRTP thinks the RTP seq is replayed, so srtp_unprotect() - * will returning err_status_replay_*. Restarting SRTP can resolve - * this. - */ - if (pjmedia_transport_srtp_start((pjmedia_transport*)srtp, - &srtp->tx_policy, &srtp->rx_policy) - != PJ_SUCCESS) - { + * & SRTP is restarted), but some old packets are still coming + * so SRTP is learning wrong RTP seq. While the newly inited RTP seq + * comes, SRTP thinks the RTP seq is replayed, so srtp_unprotect() + * will return err_status_replay_*. Restarting SRTP can resolve this. + */ + pjmedia_srtp_crypto tx, rx; + pj_status_t status; + + tx = srtp->tx_policy; + rx = srtp->rx_policy; + status = pjmedia_transport_srtp_start((pjmedia_transport*)srtp, + &tx, &rx); + if (status != PJ_SUCCESS) { PJ_LOG(5,(srtp->pool->obj_name, "Failed to restart SRTP, err=%s", get_libsrtp_errstr(err))); - } else { + } else if (!srtp->bypass_srtp) { err = srtp_unprotect(srtp->srtp_rx_ctx, (pj_uint8_t*)pkt, &len); } } |