Changeset 3384


Ignore:
Timestamp:
Dec 2, 2010 10:56:27 AM (10 years ago)
Author:
nanang
Message:

Re #1165: fixed SRTP transport to not update the SRTP activation flag, i.e: bypass_srtp, in transport_encode_sdp(), as it shouldn't change the media session states.

File:
1 edited

Legend:

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

    r3376 r3384  
    349349 
    350350 
     351static pj_bool_t srtp_crypto_empty(const pjmedia_srtp_crypto* c) 
     352{ 
     353    return (c->name.slen==0 || c->key.slen==0); 
     354} 
     355 
     356 
    351357PJ_DEF(void) pjmedia_srtp_setting_default(pjmedia_srtp_setting *opt) 
    352358{ 
     
    12231229    PJ_ASSERT_RETURN(tp && sdp_pool && sdp_local, PJ_EINVAL); 
    12241230     
     1231    pj_bzero(&srtp->rx_policy_neg, sizeof(srtp->rx_policy_neg)); 
     1232    pj_bzero(&srtp->tx_policy_neg, sizeof(srtp->tx_policy_neg)); 
     1233 
    12251234    srtp->offerer_side = sdp_remote == NULL; 
    1226     srtp->bypass_srtp = PJ_FALSE; 
    12271235 
    12281236    m_rem = sdp_remote ? sdp_remote->media[media_index] : NULL; 
     
    14361444 
    14371445BYPASS_SRTP: 
    1438     srtp->bypass_srtp = PJ_TRUE; 
     1446    /* Do not update this flag here as actually the media session hasn't been 
     1447     * updated. 
     1448     */ 
     1449    //srtp->bypass_srtp = PJ_TRUE; 
    14391450 
    14401451PROPAGATE_MEDIA_CREATE: 
     
    14571468 
    14581469    PJ_ASSERT_RETURN(tp && pool && sdp_local && sdp_remote, PJ_EINVAL); 
    1459  
    1460     if (srtp->bypass_srtp) 
    1461         goto BYPASS_SRTP; 
    14621470 
    14631471    m_rem = sdp_remote->media[media_index]; 
     
    15561564    } 
    15571565 
     1566    /* Make sure we have the SRTP policies */ 
     1567    if (srtp_crypto_empty(&srtp->tx_policy_neg) ||  
     1568        srtp_crypto_empty(&srtp->rx_policy_neg)) 
     1569    { 
     1570        goto BYPASS_SRTP; 
     1571    } 
     1572 
    15581573    /* Reset probation counts */ 
    15591574    srtp->probation_cnt = PROBATION_CNT_INIT; 
     
    15751590    } 
    15761591 
     1592    srtp->bypass_srtp = PJ_FALSE; 
     1593 
    15771594    goto PROPAGATE_MEDIA_START; 
    15781595 
Note: See TracChangeset for help on using the changeset viewer.