Changeset 1065
- Timestamp:
- Mar 15, 2007 10:23:15 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/pjproject-0.5-stable/pjsip/src/pjsua-lib/pjsua_media.c
r974 r1065 27 27 #define DEFAULT_RTP_PORT 4000 28 28 29 /* Next RTP port to be used */ 30 static pj_uint16_t next_rtp_port; 29 31 30 32 /* Close existing sound device */ … … 209 211 }; 210 212 int i; 211 static pj_uint16_t rtp_port;212 213 pj_sockaddr_in bound_addr; 213 214 pj_sockaddr_in mapped_addr[2]; … … 215 216 pj_sock_t sock[2]; 216 217 217 if ( rtp_port == 0)218 rtp_port = (pj_uint16_t)cfg->port;218 if (next_rtp_port == 0) 219 next_rtp_port = (pj_uint16_t)cfg->port; 219 220 220 221 for (i=0; i<2; ++i) … … 232 233 233 234 /* Loop retry to bind RTP and RTCP sockets. */ 234 for (i=0; i<RTP_RETRY; ++i, rtp_port += 2) {235 for (i=0; i<RTP_RETRY; ++i, next_rtp_port += 2) { 235 236 236 237 /* Create and bind RTP socket. */ … … 242 243 243 244 status = pj_sock_bind_in(sock[0], bound_addr.sin_addr.s_addr, 244 rtp_port);245 next_rtp_port); 245 246 if (status != PJ_SUCCESS) { 246 247 pj_sock_close(sock[0]); … … 258 259 259 260 status = pj_sock_bind_in(sock[1], bound_addr.sin_addr.s_addr, 260 (pj_uint16_t)( rtp_port+1));261 (pj_uint16_t)(next_rtp_port+1)); 261 262 if (status != PJ_SUCCESS) { 262 263 pj_sock_close(sock[0]); … … 300 301 301 302 status = pj_sockaddr_in_init(&mapped_addr[0], &cfg->public_addr, 302 (pj_uint16_t) rtp_port);303 (pj_uint16_t)next_rtp_port); 303 304 if (status != PJ_SUCCESS) 304 305 goto on_error; 305 306 306 307 status = pj_sockaddr_in_init(&mapped_addr[1], &cfg->public_addr, 307 (pj_uint16_t)( rtp_port+1));308 (pj_uint16_t)(next_rtp_port+1)); 308 309 if (status != PJ_SUCCESS) 309 310 goto on_error; … … 322 323 mapped_addr[i].sin_addr = addr; 323 324 324 mapped_addr[0].sin_port=pj_htons((pj_uint16_t) rtp_port);325 mapped_addr[1].sin_port=pj_htons((pj_uint16_t)( rtp_port+1));325 mapped_addr[0].sin_port=pj_htons((pj_uint16_t)next_rtp_port); 326 mapped_addr[1].sin_port=pj_htons((pj_uint16_t)(next_rtp_port+1)); 326 327 break; 327 328 } … … 350 351 pj_ntohs(skinfo->rtcp_addr_name.sin_port))); 351 352 352 rtp_port += 2;353 next_rtp_port += 2; 353 354 return PJ_SUCCESS; 354 355 … … 480 481 /* Deinitialize sound subsystem */ 481 482 pjmedia_snd_deinit(); 483 484 /* Reset RTP port */ 485 next_rtp_port = 0; 482 486 483 487 return PJ_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.