Changeset 1108


Ignore:
Timestamp:
Mar 27, 2007 11:00:38 AM (17 years ago)
Author:
bennylp
Message:

ICE: added media index in pjmedia when handling SDP containing ICE candidates

Location:
pjproject/trunk
Files:
5 edited

Legend:

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

    r1104 r1108  
    6767PJ_DECL(pj_status_t) pjmedia_ice_start_ice(pjmedia_transport *tp, 
    6868                                           pj_pool_t *pool, 
    69                                            pjmedia_sdp_session *rem_sdp); 
     69                                           pjmedia_sdp_session *rem_sdp, 
     70                                           unsigned media_index); 
    7071PJ_DECL(pj_status_t) pjmedia_ice_stop_ice(pjmedia_transport *tp); 
    7172 
  • pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c

    r1106 r1108  
    401401PJ_DEF(pj_status_t) pjmedia_ice_start_ice(pjmedia_transport *tp, 
    402402                                          pj_pool_t *pool, 
    403                                           pjmedia_sdp_session *rem_sdp) 
     403                                          pjmedia_sdp_session *rem_sdp, 
     404                                          unsigned media_index) 
    404405{ 
    405406    struct transport_ice *tp_ice = (struct transport_ice*)tp; 
     
    407408    unsigned i, cand_cnt; 
    408409    pj_ice_cand cand[PJ_ICE_MAX_CAND]; 
     410    pjmedia_sdp_media *sdp_med; 
    409411    pj_str_t uname, pass; 
    410412    pj_status_t status; 
    411413 
    412     /* Find ice-ufrag attribute */ 
     414    PJ_ASSERT_RETURN(tp && pool && rem_sdp, PJ_EINVAL); 
     415    PJ_ASSERT_RETURN(media_index < rem_sdp->media_count, PJ_EINVAL); 
     416 
     417    sdp_med = rem_sdp->media[media_index]; 
     418 
     419    /* Find ice-ufrag attribute in session descriptor */ 
    413420    attr = pjmedia_sdp_attr_find2(rem_sdp->attr_count, rem_sdp->attr, 
    414421                                  "ice-ufrag", NULL); 
    415422    if (attr == NULL) { 
    416         set_no_ice(tp_ice); 
    417         return PJ_SUCCESS; 
     423        /* Find in media descriptor */ 
     424        attr = pjmedia_sdp_attr_find2(sdp_med->attr_count, sdp_med->attr, 
     425                                      "ice-ufrag", NULL); 
     426        if (attr == NULL) { 
     427            set_no_ice(tp_ice); 
     428            return PJ_SUCCESS; 
     429        } 
    418430    } 
    419431    uname = attr->value; 
    420432 
    421     /* Find ice-pwd attribute */ 
     433    /* Find ice-pwd attribute in session descriptor */ 
    422434    attr = pjmedia_sdp_attr_find2(rem_sdp->attr_count, rem_sdp->attr, 
    423435                                  "ice-pwd", NULL); 
    424436    if (attr == NULL) { 
    425         set_no_ice(tp_ice); 
    426         return PJ_SUCCESS; 
     437        /* Not found, find in media descriptor */ 
     438        attr = pjmedia_sdp_attr_find2(sdp_med->attr_count, sdp_med->attr, 
     439                                      "ice-pwd", NULL); 
     440        if (attr == NULL) { 
     441            set_no_ice(tp_ice); 
     442            return PJ_SUCCESS; 
     443        } 
    427444    } 
    428445    pass = attr->value; 
     
    430447    /* Get all candidates */ 
    431448    cand_cnt = 0; 
    432     for (i=0; i<rem_sdp->media[0]->attr_count; ++i) { 
     449    for (i=0; i<sdp_med->attr_count; ++i) { 
    433450        pjmedia_sdp_attr *attr; 
    434451 
    435         attr = rem_sdp->media[0]->attr[i]; 
     452        attr = sdp_med->attr[i]; 
    436453        if (pj_strcmp2(&attr->name, "candidate")!=0) 
    437454            continue; 
  • pjproject/trunk/pjnath/src/pjnath-test/ice_test.c

    r1106 r1108  
    460460    pj_stun_config_init(&stun_cfg, mem, 0, ioqueue, timer_heap); 
    461461 
    462     //pj_log_set_level(4); 
     462#if 1 
     463    pj_log_set_level(5); 
     464#endif 
     465 
     466    goto test; 
    463467 
    464468    /* Basic create/destroy */ 
     
    488492 
    489493    /* Direct communication with two components */ 
     494test: 
    490495    rc = perform_ice_test("With two components (RTP and RTCP)", PJ_TRUE, 2, PJ_TRUE, D1, D2, 0, NULL, 0, NULL); 
    491496    if (rc != 0) 
    492497        goto on_return; 
     498 
     499    goto on_return; 
    493500 
    494501    /* Direct communication with mismatch number of components */ 
     
    502509 
    503510on_return: 
    504     //pj_log_set_level(3); 
     511    pj_log_set_level(3); 
    505512    pj_ioqueue_destroy(stun_cfg.ioqueue); 
    506513    pj_pool_release(pool); 
  • pjproject/trunk/pjnath/src/pjnath-test/test.c

    r1106 r1108  
    5050    mem = &caching_pool.factory; 
    5151 
     52#if 0 
    5253    pj_log_set_level(3); 
    5354    pj_log_set_decor(PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_TIME |  
    5455                     PJ_LOG_HAS_MICRO_SEC); 
     56#endif 
    5557 
    5658    rc = pj_init(); 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r1106 r1108  
    823823        if (pjsua_var.media_cfg.enable_ice) { 
    824824            status = pjmedia_ice_start_ice(call->med_tp, call->inv->pool,  
    825                                            remote_sdp); 
     825                                           remote_sdp, 0); 
    826826            if (status != PJ_SUCCESS) 
    827827                return status; 
Note: See TracChangeset for help on using the changeset viewer.