Changeset 5989 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
- Timestamp:
- May 15, 2019 12:09:57 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r5979 r5989 630 630 if (status != PJ_SUCCESS) { 631 631 pjsua_perror(THIS_FILE, "Unable to create media transport", 632 status); 633 goto on_error; 634 } 635 636 pjmedia_transport_simulate_lost(call_med->tp, PJMEDIA_DIR_ENCODING, 637 pjsua_var.media_cfg.tx_drop_pct); 638 639 pjmedia_transport_simulate_lost(call_med->tp, PJMEDIA_DIR_DECODING, 640 pjsua_var.media_cfg.rx_drop_pct); 641 642 call_med->tp_ready = PJ_SUCCESS; 643 644 return PJ_SUCCESS; 645 646 on_error: 647 if (call_med->tp) 648 pjmedia_transport_close(call_med->tp); 649 650 return status; 651 } 652 653 /* Create loop media transport */ 654 static pj_status_t create_loop_media_transport( 655 const pjsua_transport_config *cfg, 656 pjsua_call_media *call_med) 657 { 658 pj_status_t status; 659 pjmedia_loop_tp_setting opt; 660 pj_bool_t use_ipv6, use_nat64; 661 int af; 662 pjsua_acc *acc = &pjsua_var.acc[call_med->call->acc_id]; 663 664 use_ipv6 = (acc->cfg.ipv6_media_use != PJSUA_IPV6_DISABLED); 665 use_nat64 = (acc->cfg.nat64_opt != PJSUA_NAT64_DISABLED); 666 af = (use_ipv6 || use_nat64) ? pj_AF_INET6() : pj_AF_INET(); 667 668 pjmedia_loop_tp_setting_default(&opt); 669 opt.af = af; 670 if (cfg->bound_addr.slen) 671 opt.addr = cfg->bound_addr; 672 opt.port = cfg->port; 673 opt.disable_rx=!pjsua_var.acc[call_med->call->acc_id].cfg.enable_loopback; 674 status = pjmedia_transport_loop_create2(pjsua_var.med_endpt, &opt, 675 &call_med->tp); 676 if (status != PJ_SUCCESS) { 677 pjsua_perror(THIS_FILE, "Unable to create loop media transport", 632 678 status); 633 679 goto on_error; … … 1755 1801 */ 1756 1802 if (call_med->tp == NULL) { 1803 pjsua_acc *acc = &pjsua_var.acc[call_med->call->acc_id]; 1804 1757 1805 /* Initializations. If media transport creation completes immediately, 1758 1806 * we don't need to call the callbacks. … … 1772 1820 pjsua_set_media_tp_state(call_med, PJSUA_MED_TP_CREATING); 1773 1821 1774 if (pjsua_var.acc[call_med->call->acc_id].cfg.ice_cfg.enable_ice) { 1822 if (acc->cfg.use_loop_med_tp) { 1823 status = create_loop_media_transport(tcfg, call_med); 1824 } else if (acc->cfg.ice_cfg.enable_ice) { 1775 1825 status = create_ice_media_transport(tcfg, call_med, async); 1776 1826 if (async && status == PJ_EPENDING) { … … 3302 3352 goto on_check_med_status; 3303 3353 } 3354 3355 if (pjmedia_transport_info_get_spc_info( 3356 &tp_info, PJMEDIA_TRANSPORT_TYPE_LOOP)) 3357 { 3358 pjmedia_transport_loop_disable_rx( 3359 call_med->tp, call_med->strm.a.stream, 3360 !acc->cfg.enable_loopback); 3361 } 3304 3362 } 3305 3363 }
Note: See TracChangeset
for help on using the changeset viewer.