Changeset 1140 for pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c
- Timestamp:
- Apr 3, 2007 6:01:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/transport_ice.c
r1126 r1140 435 435 pj_bool_t remote_is_lite = PJ_FALSE; 436 436 pj_bool_t ice_mismatch = PJ_FALSE; 437 pjmedia_sdp_conn *conn = NULL; 438 pj_sockaddr conn_addr; 439 pj_bool_t conn_found_in_candidate = PJ_FALSE; 437 440 const pj_str_t STR_CANDIDATE = {"candidate", 9}; 438 441 const pj_str_t STR_ICE_LITE = {"ice-lite", 8}; … … 445 448 446 449 sdp_med = rem_sdp->media[media_index]; 450 451 /* Get the SDP connection for the media stream. 452 * We'll verify later if the SDP connection address is specified 453 * as one of the candidate. 454 */ 455 conn = sdp_med->conn; 456 if (conn == NULL) 457 conn = rem_sdp->conn; 458 459 if (conn == NULL) { 460 /* Unable to find SDP connection */ 461 return PJMEDIA_SDP_EMISSINGCONN; 462 } 463 464 pj_sockaddr_in_init(&conn_addr.ipv4, &conn->addr, 465 (pj_uint16_t)sdp_med->desc.port); 447 466 448 467 /* Find ice-ufrag attribute in session descriptor */ … … 481 500 attr = sdp_med->attr[i]; 482 501 502 /* Detect if remote is ICE lite */ 483 503 if (pj_strcmp(&attr->name, &STR_ICE_LITE)==0) { 484 504 remote_is_lite = PJ_TRUE; … … 486 506 } 487 507 508 /* Detect if remote has reported ICE mismatch */ 488 509 if (pj_strcmp(&attr->name, &STR_ICE_MISMATCH)==0) { 489 510 ice_mismatch = PJ_TRUE; … … 494 515 continue; 495 516 517 /* Parse candidate */ 496 518 status = parse_cand(pool, &attr->value, &cand[cand_cnt]); 497 519 if (status != PJ_SUCCESS) 498 520 return status; 499 521 522 /* Check if this candidate is equal to the connection line */ 523 if (!conn_found_in_candidate && 524 pj_memcmp(&conn_addr.ipv4, &cand[cand_cnt].addr.ipv4, 525 sizeof(pj_sockaddr_in))==0) 526 { 527 conn_found_in_candidate = PJ_TRUE; 528 } 529 500 530 cand_cnt++; 501 531 } … … 503 533 /* Handle ice-mismatch case */ 504 534 if (ice_mismatch) { 505 set_no_ice(tp_ice, "ice-mismatch detected"); 535 set_no_ice(tp_ice, "remote reported ice-mismatch"); 536 return PJ_SUCCESS; 537 } 538 539 /* Handle case where SDP connection address is not specified as 540 * one of the candidate. 541 */ 542 if (!conn_found_in_candidate) { 543 set_no_ice(tp_ice, "local reported ice-mismatch"); 506 544 return PJ_SUCCESS; 507 545 } … … 658 696 char dst_addr[32]; 659 697 698 pj_gettimeofday(&end_ice); 699 PJ_TIME_VAL_SUB(end_ice, tp_ice->start_ice); 700 660 701 if (status != PJ_SUCCESS) { 661 702 char errmsg[PJ_ERR_MSG_SIZE]; 662 703 pj_strerror(status, errmsg, sizeof(errmsg)); 663 PJ_LOG(1,(ice_st->obj_name, "ICE negotiation failed: %s", errmsg)); 704 PJ_LOG(1,(ice_st->obj_name, 705 "ICE negotiation failed after %d:%03ds: %s", 706 (int)end_ice.sec, (int)end_ice.msec, 707 errmsg)); 664 708 return; 665 709 } 666 667 pj_gettimeofday(&end_ice);668 PJ_TIME_VAL_SUB(end_ice, tp_ice->start_ice);669 710 670 711 check = &ice_st->ice->valid_list.checks[0];
Note: See TracChangeset
for help on using the changeset viewer.