Changeset 4542 for pjproject/trunk
- Timestamp:
- Jun 21, 2013 7:47:41 AM (11 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r4342 r4542 264 264 pjsip_evsub *mwi_sub; /**< MWI client subscription */ 265 265 pjsip_dialog *mwi_dlg; /**< Dialog for MWI sub. */ 266 267 pj_uint16_t next_rtp_port; /**< Next RTP port to be used. */ 266 268 } pjsua_acc; 267 269 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r4537 r4542 653 653 pj_bzero(&acc->via_addr, sizeof(acc->via_addr)); 654 654 acc->via_tp = NULL; 655 acc->next_rtp_port = 0; 655 656 656 657 /* Remove from array */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r4539 r4542 30 30 #endif 31 31 32 /* Next RTP port to be used */33 static pj_uint16_t next_rtp_port;34 35 32 static void pjsua_media_config_dup(pj_pool_t *pool, 36 33 pjsua_media_config *dst, … … 220 217 } 221 218 222 /* Reset RTP port */223 next_rtp_port = 0;224 225 219 pj_log_pop_indent(); 226 220 … … 247 241 char addr_buf[PJ_INET6_ADDRSTRLEN+10]; 248 242 pj_sock_t sock[2]; 249 250 use_ipv6 = (pjsua_var.acc[call_med->call->acc_id].cfg.ipv6_media_use != 251 243 pjsua_acc *acc = &pjsua_var.acc[call_med->call->acc_id]; 244 245 use_ipv6 = (acc->cfg.ipv6_media_use != PJSUA_IPV6_DISABLED); 252 246 af = use_ipv6 ? pj_AF_INET6() : pj_AF_INET(); 253 247 … … 261 255 } 262 256 263 if ( next_rtp_port == 0)264 next_rtp_port = (pj_uint16_t)cfg->port;265 266 if ( next_rtp_port == 0)267 next_rtp_port = (pj_uint16_t)40000;257 if (acc->next_rtp_port == 0) 258 acc->next_rtp_port = (pj_uint16_t)cfg->port; 259 260 if (acc->next_rtp_port == 0) 261 acc->next_rtp_port = (pj_uint16_t)DEFAULT_RTP_PORT; 268 262 269 263 for (i=0; i<2; ++i) … … 281 275 282 276 /* Loop retry to bind RTP and RTCP sockets. */ 283 for (i=0; i<RTP_RETRY; ++i, next_rtp_port += 2) {277 for (i=0; i<RTP_RETRY; ++i, acc->next_rtp_port += 2) { 284 278 285 279 if (cfg->port > 0 && cfg->port_range > 0 && 286 next_rtp_port > cfg->port + cfg->port_range) 280 (acc->next_rtp_port > cfg->port + cfg->port_range || 281 acc->next_rtp_port < cfg->port)) 287 282 { 288 next_rtp_port = (pj_uint16_t)cfg->port;283 acc->next_rtp_port = (pj_uint16_t)cfg->port; 289 284 } 290 285 … … 302 297 303 298 /* Bind RTP socket */ 304 pj_sockaddr_set_port(&bound_addr, next_rtp_port);299 pj_sockaddr_set_port(&bound_addr, acc->next_rtp_port); 305 300 status=pj_sock_bind(sock[0], &bound_addr, 306 301 pj_sockaddr_get_len(&bound_addr)); … … 325 320 326 321 /* Bind RTCP socket */ 327 pj_sockaddr_set_port(&bound_addr, (pj_uint16_t)( next_rtp_port+1));322 pj_sockaddr_set_port(&bound_addr, (pj_uint16_t)(acc->next_rtp_port+1)); 328 323 status=pj_sock_bind(sock[1], &bound_addr, 329 324 pj_sockaddr_get_len(&bound_addr)); … … 417 412 418 413 status = pj_sockaddr_init(af, &mapped_addr[0], &cfg->public_addr, 419 (pj_uint16_t) next_rtp_port);414 (pj_uint16_t)acc->next_rtp_port); 420 415 if (status != PJ_SUCCESS) 421 416 goto on_error; 422 417 423 418 status = pj_sockaddr_init(af, &mapped_addr[1], &cfg->public_addr, 424 (pj_uint16_t)( next_rtp_port+1));419 (pj_uint16_t)(acc->next_rtp_port+1)); 425 420 if (status != PJ_SUCCESS) 426 421 goto on_error; … … 445 440 pj_sockaddr_copy_addr(&mapped_addr[i], &bound_addr); 446 441 pj_sockaddr_set_port(&mapped_addr[i], 447 (pj_uint16_t)( next_rtp_port+i));442 (pj_uint16_t)(acc->next_rtp_port+i)); 448 443 } 449 444 … … 472 467 sizeof(addr_buf), 3))); 473 468 474 next_rtp_port += 2;469 acc->next_rtp_port += 2; 475 470 return PJ_SUCCESS; 476 471
Note: See TracChangeset
for help on using the changeset viewer.