Changeset 1126 for pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c
- Timestamp:
- Apr 2, 2007 11:30:14 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c
r1114 r1126 89 89 90 90 91 91 /* 92 * Create ICE media transport. 93 */ 92 94 PJ_DEF(pj_status_t) pjmedia_ice_create(pjmedia_endpt *endpt, 93 95 const char *name, … … 132 134 133 135 136 /* 137 * Destroy ICE media transport. 138 */ 134 139 PJ_DEF(pj_status_t) pjmedia_ice_destroy(pjmedia_transport *tp) 135 140 { … … 138 143 if (tp_ice->ice_st) { 139 144 pj_ice_strans_destroy(tp_ice->ice_st); 140 //Must not touch tp_ice after ice_st is destroyed! 141 //(it has the pool) 142 //tp_ice->ice_st = NULL; 145 /*Must not touch tp_ice after ice_st is destroyed! 146 (it has the pool) 147 tp_ice->ice_st = NULL; 148 */ 143 149 } 144 150 … … 147 153 148 154 155 /* 156 * Start media transport initialization. 157 */ 149 158 PJ_DEF(pj_status_t) pjmedia_ice_start_init( pjmedia_transport *tp, 150 159 unsigned options, … … 186 195 187 196 197 /* 198 * Get the status of media transport initialization. 199 */ 188 200 PJ_DEF(pj_status_t) pjmedia_ice_get_init_status(pjmedia_transport *tp) 189 201 { … … 193 205 194 206 207 /* 208 * Get the component for the specified component ID. 209 */ 195 210 PJ_DEF(pj_status_t) pjmedia_ice_get_comp( pjmedia_transport *tp, 196 211 unsigned comp_id, … … 205 220 } 206 221 207 PJ_DEF(pj_ice_strans*) pjmedia_ice_get_ice_st(pjmedia_transport *tp) 208 { 209 struct transport_ice *tp_ice = (struct transport_ice*)tp; 210 return tp_ice->ice_st; 211 } 212 213 222 223 /* 224 * Create ICE! This happens when: 225 * - UAC is ready to send offer 226 * - UAS have just received an offer. 227 */ 214 228 PJ_DEF(pj_status_t) pjmedia_ice_init_ice(pjmedia_transport *tp, 215 229 pj_ice_sess_role role, … … 222 236 223 237 238 /* 239 * For both UAC and UAS, pass in the SDP before sending it to remote. 240 * This will add ICE attributes to the SDP. 241 */ 224 242 PJ_DEF(pj_status_t) pjmedia_ice_modify_sdp(pjmedia_transport *tp, 225 243 pj_pool_t *pool, … … 306 324 307 325 326 /* Parse a=candidate line */ 308 327 static pj_status_t parse_cand(pj_pool_t *pool, 309 328 const pj_str_t *orig_input, … … 391 410 } 392 411 393 static void set_no_ice(struct transport_ice *tp_ice) 412 413 /* Disable ICE when SDP from remote doesn't contain a=candidate line */ 414 static void set_no_ice(struct transport_ice *tp_ice, const char *reason) 394 415 { 395 416 PJ_LOG(4,(tp_ice->ice_st->obj_name, 396 " Remote does not support ICE, disabling local ICE"));417 "Disabling local ICE, reason=%s", reason)); 397 418 pjmedia_ice_stop_ice(&tp_ice->base); 398 419 } 399 420 400 421 422 /* 423 * Start ICE checks when both offer and answer are available. 424 */ 401 425 PJ_DEF(pj_status_t) pjmedia_ice_start_ice(pjmedia_transport *tp, 402 426 pj_pool_t *pool, … … 410 434 const pjmedia_sdp_media *sdp_med; 411 435 pj_bool_t remote_is_lite = PJ_FALSE; 436 pj_bool_t ice_mismatch = PJ_FALSE; 412 437 const pj_str_t STR_CANDIDATE = {"candidate", 9}; 413 438 const pj_str_t STR_ICE_LITE = {"ice-lite", 8}; 439 const pj_str_t STR_ICE_MISMATCH = {"ice-mismatch", 12}; 414 440 pj_str_t uname, pass; 415 441 pj_status_t status; … … 428 454 "ice-ufrag", NULL); 429 455 if (attr == NULL) { 430 set_no_ice(tp_ice );456 set_no_ice(tp_ice, "ice-ufrag attribute not found"); 431 457 return PJ_SUCCESS; 432 458 } … … 442 468 "ice-pwd", NULL); 443 469 if (attr == NULL) { 444 set_no_ice(tp_ice );470 set_no_ice(tp_ice, "ice-pwd attribute not found"); 445 471 return PJ_SUCCESS; 446 472 } … … 455 481 attr = sdp_med->attr[i]; 456 482 457 if (pj_strcmp(&attr->name, &STR_ICE_LITE)==0) 483 if (pj_strcmp(&attr->name, &STR_ICE_LITE)==0) { 458 484 remote_is_lite = PJ_TRUE; 485 continue; 486 } 487 488 if (pj_strcmp(&attr->name, &STR_ICE_MISMATCH)==0) { 489 ice_mismatch = PJ_TRUE; 490 continue; 491 } 459 492 460 493 if (pj_strcmp(&attr->name, &STR_CANDIDATE)!=0) … … 466 499 467 500 cand_cnt++; 501 } 502 503 /* Handle ice-mismatch case */ 504 if (ice_mismatch) { 505 set_no_ice(tp_ice, "ice-mismatch detected"); 506 return PJ_SUCCESS; 468 507 } 469 508
Note: See TracChangeset
for help on using the changeset viewer.