Changeset 3804 for pjproject/branches/1.x/pjsip-apps/src/pjsua/pjsua_app.c
- Timestamp:
- Oct 9, 2011 10:58:38 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.x/pjsip-apps/src/pjsua/pjsua_app.c
r3570 r3804 141 141 #ifdef STEREO_DEMO 142 142 static void stereo_demo(); 143 #endif144 #ifdef TRANSPORT_ADAPTER_SAMPLE145 static pj_status_t transport_adapter_sample(void);146 143 #endif 147 144 static pj_status_t create_ipv6_media_transports(void); … … 3052 3049 } 3053 3050 3051 #ifdef TRANSPORT_ADAPTER_SAMPLE 3052 /* 3053 * This callback is called when media transport needs to be created. 3054 */ 3055 static pjmedia_transport* on_create_media_transport(pjsua_call_id call_id, 3056 unsigned media_idx, 3057 pjmedia_transport *base_tp, 3058 unsigned flags) 3059 { 3060 pjmedia_transport *adapter; 3061 pj_status_t status; 3062 3063 /* Create the adapter */ 3064 status = pjmedia_tp_adapter_create(pjsua_get_pjmedia_endpt(), 3065 NULL, base_tp, 3066 (flags & PJSUA_MED_TP_CLOSE_MEMBER), 3067 &adapter); 3068 if (status != PJ_SUCCESS) { 3069 PJ_PERROR(1,(THIS_FILE, status, "Error creating adapter")); 3070 return NULL; 3071 } 3072 3073 PJ_LOG(3,(THIS_FILE, "Media transport is created for call %d media %d", 3074 call_id, media_idx)); 3075 3076 return adapter; 3077 } 3078 #endif 3079 3054 3080 /* 3055 3081 * Print buddy list. … … 4652 4678 app_config.cfg.cb.on_transport_state = &on_transport_state; 4653 4679 app_config.cfg.cb.on_ice_transport_error = &on_ice_transport_error; 4680 #ifdef TRANSPORT_ADAPTER_SAMPLE 4681 app_config.cfg.cb.on_create_media_transport = &on_create_media_transport; 4682 #endif 4654 4683 app_config.log_cfg.cb = log_cb; 4655 4684 … … 4930 4959 /* Add accounts */ 4931 4960 for (i=0; i<app_config.acc_cnt; ++i) { 4961 app_config.acc_cfg[i].reg_retry_interval = 300; 4962 app_config.acc_cfg[i].reg_first_retry_interval = 60; 4963 4932 4964 status = pjsua_acc_add(&app_config.acc_cfg[i], PJ_TRUE, NULL); 4933 4965 if (status != PJ_SUCCESS) … … 4955 4987 4956 4988 /* Add RTP transports */ 4957 #ifdef TRANSPORT_ADAPTER_SAMPLE4958 status = transport_adapter_sample();4959 4960 #else4961 4989 if (app_config.ipv6) 4962 4990 status = create_ipv6_media_transports(); 4963 4991 else 4964 4992 status = pjsua_media_transports_create(&app_config.rtp_cfg); 4965 #endif 4993 4966 4994 if (status != PJ_SUCCESS) 4967 4995 goto on_error; … … 5172 5200 #endif 5173 5201 5174 #ifdef TRANSPORT_ADAPTER_SAMPLE5175 static pj_status_t create_transport_adapter(pjmedia_endpt *med_endpt, int port,5176 pjmedia_transport **p_tp)5177 {5178 pjmedia_transport *udp;5179 pj_status_t status;5180 5181 /* Create the UDP media transport */5182 status = pjmedia_transport_udp_create(med_endpt, NULL, port, 0, &udp);5183 if (status != PJ_SUCCESS)5184 return status;5185 5186 /* Create the adapter */5187 status = pjmedia_tp_adapter_create(med_endpt, NULL, udp, p_tp);5188 if (status != PJ_SUCCESS) {5189 pjmedia_transport_close(udp);5190 return status;5191 }5192 5193 return PJ_SUCCESS;5194 }5195 5196 static pj_status_t transport_adapter_sample(void)5197 {5198 pjsua_media_transport tp[PJSUA_MAX_CALLS];5199 pj_status_t status;5200 int port = 7000;5201 unsigned i;5202 5203 for (i=0; i<app_config.cfg.max_calls; ++i) {5204 status = create_transport_adapter(pjsua_get_pjmedia_endpt(),5205 port + i*10,5206 &tp[i].transport);5207 if (status != PJ_SUCCESS)5208 return status;5209 }5210 5211 return pjsua_media_transports_attach(tp, i, PJ_TRUE);5212 }5213 #endif5214 5215 5202 static pj_status_t create_ipv6_media_transports(void) 5216 5203 {
Note: See TracChangeset
for help on using the changeset viewer.