Changeset 1873


Ignore:
Timestamp:
Mar 17, 2008 4:05:35 PM (17 years ago)
Author:
bennylp
Message:

More ticket #479: bug in pjmedia_transport_get_info(), the info should be initialized by caller

Location:
pjproject/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/transport.h

    r1860 r1873  
    406406 
    407407/** 
    408  * This structure describes buffer storage of transport specific info. 
     408 * This structure describes storage buffer of transport specific info. 
    409409 * The actual transport specific info contents will be defined by transport 
    410410 * implementation. Note that some transport implementations do not need to 
     
    457457 
    458458/** 
    459  * Get media socket info from the specified transport. The socket info 
    460  * contains information about the local address of this transport, and 
    461  * would be needed for example to fill in the "c=" and "m=" line of local  
    462  * SDP. 
     459 * Initialize transport info. 
     460 * 
     461 * @param info      Transport info to be initialized. 
     462 */ 
     463PJ_INLINE(void) pjmedia_transport_info_init(pjmedia_transport_info *info) 
     464{ 
     465    pj_bzero(&info->sock_info, sizeof(pjmedia_sock_info)); 
     466    info->sock_info.rtp_sock = info->sock_info.rtcp_sock = PJ_INVALID_SOCKET; 
     467    info->specific_info_cnt = 0; 
     468} 
     469 
     470 
     471/** 
     472 * Get media transport info from the specified transport and all underlying  
     473 * transports if any. The transport also contains information about socket info 
     474 * which describes the local address of the transport, and would be needed 
     475 * for example to fill in the "c=" and "m=" line of local SDP. 
    463476 * 
    464477 * @param tp        The transport. 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c

    r1860 r1873  
    701701    } 
    702702 
    703     info->specific_info_cnt = 0; 
    704  
    705703    return PJ_SUCCESS; 
    706704} 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c

    r1860 r1873  
    565565                     PJMEDIA_TRANSPORT_SPECIFIC_INFO_MAXSIZE, PJ_ENOMEM); 
    566566 
    567     status = pjmedia_transport_get_info(srtp->real_tp, info); 
    568     if (status != PJ_SUCCESS) 
    569         return status; 
    570  
    571567    srtp_info.active = srtp->session_inited; 
    572568    srtp_info.rx_policy = srtp->rx_policy; 
     
    579575              sizeof(srtp_info)); 
    580576 
    581     return PJ_SUCCESS; 
     577    return pjmedia_transport_get_info(srtp->real_tp, info); 
    582578} 
    583579 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c

    r1860 r1873  
    594594    info->sock_info.rtcp_sock = udp->rtcp_sock; 
    595595    info->sock_info.rtcp_addr_name = udp->rtcp_addr_name; 
    596     info->specific_info_cnt = 0; 
    597596 
    598597    return PJ_SUCCESS; 
  • pjproject/trunk/pjsip-apps/src/samples/simpleua.c

    r1860 r1873  
    302302     * the SDP). 
    303303     */ 
     304    pjmedia_transport_info_init(&g_med_tpinfo); 
    304305    pjmedia_transport_get_info(g_med_transport, &g_med_tpinfo); 
    305306 
  • pjproject/trunk/pjsip-apps/src/samples/siprtp.c

    r1860 r1873  
    10131013 
    10141014    /* Get transport info */ 
    1015     pj_bzero(&tpinfo, sizeof(tpinfo)); 
     1015    pjmedia_transport_info_init(&tpinfo); 
    10161016    pjmedia_transport_get_info(audio->transport, &tpinfo); 
    10171017 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r1860 r1873  
    22612261 
    22622262    /* Get SRTP status */ 
     2263    pjmedia_transport_info_init(&tp_info); 
    22632264    pjmedia_transport_get_info(call->med_tp, &tp_info); 
    22642265    if (tp_info.specific_info_cnt > 0) { 
     
    24712472        pjmedia_transport_info ti; 
    24722473 
     2474        pjmedia_transport_info_init(&ti); 
    24732475        pjmedia_transport_get_info(call->med_tp, &ti); 
    24742476        status = pjmedia_endpt_create_sdp(pjsua_var.med_endpt, tdata->pool,  
     
    25822584 
    25832585    /* Get media socket info */ 
     2586    pjmedia_transport_info_init(&tp_info); 
    25842587    pjmedia_transport_get_info(call->med_tp, &tp_info); 
    25852588 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r1860 r1873  
    321321 
    322322    /* Get media socket info */ 
     323    pjmedia_transport_info_init(&tpinfo); 
    323324    pjmedia_transport_get_info(pjsua_var.calls[0].med_tp, &tpinfo); 
    324325 
     
    20652066 
    20662067        /* MSVC complains about tpinfo not being initialized */ 
    2067         pj_bzero(&tpinfo, sizeof(tpinfo)); 
    2068  
     2068        //pj_bzero(&tpinfo, sizeof(tpinfo)); 
     2069 
     2070        pjmedia_transport_info_init(&tpinfo); 
    20692071        pjmedia_transport_get_info(call->med_tp, &tpinfo); 
    20702072 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r1870 r1873  
    840840 
    841841    /* Get media socket info */ 
     842    pjmedia_transport_info_init(&tpinfo); 
    842843    pjmedia_transport_get_info(call->med_tp, &tpinfo); 
    843844 
Note: See TracChangeset for help on using the changeset viewer.