Changeset 3961


Ignore:
Timestamp:
Feb 28, 2012 10:38:32 AM (7 years ago)
Author:
nanang
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x/pjmedia/src/pjmedia/transport_srtp.c

    r3553 r3961  
    908908    { 
    909909        /* Handle such condition that stream is updated (RTP seq is reinited 
    910         * & SRTP is restarted), but some old packets are still coming  
    911         * so SRTP is learning wrong RTP seq. While the newly inited RTP seq 
    912         * comes, SRTP thinks the RTP seq is replayed, so srtp_unprotect()  
    913         * will returning err_status_replay_*. Restarting SRTP can resolve  
    914         * this. 
    915         */ 
    916         if (pjmedia_transport_srtp_start((pjmedia_transport*)srtp,  
    917                                          &srtp->tx_policy, &srtp->rx_policy)  
    918                                          != PJ_SUCCESS) 
    919         { 
     910         * & SRTP is restarted), but some old packets are still coming  
     911         * so SRTP is learning wrong RTP seq. While the newly inited RTP seq 
     912         * comes, SRTP thinks the RTP seq is replayed, so srtp_unprotect()  
     913         * will return err_status_replay_*. Restarting SRTP can resolve this. 
     914         */ 
     915        pjmedia_srtp_crypto tx, rx; 
     916        pj_status_t status; 
     917 
     918        tx = srtp->tx_policy; 
     919        rx = srtp->rx_policy; 
     920        status = pjmedia_transport_srtp_start((pjmedia_transport*)srtp, 
     921                                              &tx, &rx); 
     922        if (status != PJ_SUCCESS) { 
    920923            PJ_LOG(5,(srtp->pool->obj_name, "Failed to restart SRTP, err=%s",  
    921924                      get_libsrtp_errstr(err))); 
    922         } else { 
     925        } else if (!srtp->bypass_srtp) { 
    923926            err = srtp_unprotect(srtp->srtp_rx_ctx, (pj_uint8_t*)pkt, &len); 
    924927        } 
Note: See TracChangeset for help on using the changeset viewer.