Ignore:
Timestamp:
Jun 24, 2010 8:46:12 AM (14 years ago)
Author:
nanang
Message:

Fix #1075:

  • Fixed SRTP transport to only (re)start the SRTP state when the SRTP crypto settings are updated.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c

    r3219 r3221  
    313313} 
    314314 
     315 
    315316static int get_crypto_idx(const pj_str_t* crypto_name) 
    316317{ 
     
    329330    return -1; 
    330331} 
     332 
     333 
     334static int srtp_crypto_cmp(const pjmedia_srtp_crypto* c1, 
     335                           const pjmedia_srtp_crypto* c2) 
     336{ 
     337    int r; 
     338 
     339    r = pj_strcmp(&c1->key, &c2->key); 
     340    if (r != 0) 
     341        return r; 
     342 
     343    r = pj_stricmp(&c1->name, &c2->name); 
     344    if (r != 0) 
     345        return r; 
     346 
     347    return (c1->flags != c2->flags); 
     348} 
     349 
    331350 
    332351PJ_DEF(void) pjmedia_srtp_setting_default(pjmedia_srtp_setting *opt) 
     
    14911510 
    14921511    /* Got policy_local & policy_remote, let's initalize the SRTP */ 
    1493     status = pjmedia_transport_srtp_start(tp, &srtp->tx_policy_neg, &srtp->rx_policy_neg); 
    1494     if (status != PJ_SUCCESS) 
    1495         return status; 
     1512 
     1513    /* Ticket #1075: media_start() is called whenever media description 
     1514     * gets updated, e.g: call hold, however we should restart SRTP only 
     1515     * when the SRTP policy settings are updated. 
     1516     */ 
     1517    if (srtp_crypto_cmp(&srtp->tx_policy_neg, &srtp->tx_policy) || 
     1518        srtp_crypto_cmp(&srtp->rx_policy_neg, &srtp->rx_policy)) 
     1519    { 
     1520        status = pjmedia_transport_srtp_start(tp, 
     1521                                              &srtp->tx_policy_neg, 
     1522                                              &srtp->rx_policy_neg); 
     1523        if (status != PJ_SUCCESS) 
     1524            return status; 
     1525    } 
    14961526 
    14971527    goto PROPAGATE_MEDIA_START; 
Note: See TracChangeset for help on using the changeset viewer.