- Timestamp:
- May 20, 2006 1:01:07 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/siprtp.c
r454 r460 81 81 #define THIS_FILE "siprtp.c" 82 82 #define MAX_CALLS 1024 83 #define RTP_START_PORT 4 410083 #define RTP_START_PORT 4000 84 84 85 85 … … 368 368 app.sip_endpt = NULL; 369 369 } 370 371 if (app.pool) {372 pj_pool_release(app.pool);373 app.pool = NULL;374 pj_caching_pool_destroy(&app.cp);375 }376 370 } 377 371 … … 431 425 */ 432 426 retry = 0; 433 do { 427 status = -1; 428 for (retry=0; status!=PJ_SUCCESS && retry<100; ++retry,rtp_port+=2) { 434 429 struct media_stream *m = &app.call[i].media[0]; 435 430 436 ++retry;437 rtp_port += 2;438 431 m->port = rtp_port; 439 432 … … 466 459 } 467 460 468 } while (status != PJ_SUCCESS && retry < 100);461 } 469 462 470 463 if (status != PJ_SUCCESS) … … 869 862 app.thread_count = 1; 870 863 app.sip_port = 5060; 871 app.rtp_start_port = 4000;864 app.rtp_start_port = RTP_START_PORT; 872 865 app.local_addr = ip_addr; 873 866 app.log_level = 5; … … 1062 1055 1063 1056 1057 #if defined(PJ_WIN32) && PJ_WIN32 != 0 1058 #include <windows.h> 1059 static void boost_priority(void) 1060 { 1061 SetPriorityClass( GetCurrentProcess(), REALTIME_PRIORITY_CLASS); 1062 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); 1063 } 1064 1065 #else 1066 # define boost_priority() 1067 #endif 1068 1064 1069 /* 1065 1070 * Media thread … … 1074 1079 unsigned msec_interval; 1075 1080 pj_timestamp freq, next_rtp, next_rtcp; 1081 1082 1083 /* Boost thread priority if necessary */ 1084 boost_priority(); 1085 1076 1086 1077 1087 msec_interval = strm->samples_per_frame * 1000 / strm->clock_rate; … … 1117 1127 rc = pj_sock_select(FD_SETSIZE, &set, NULL, NULL, &timeout); 1118 1128 1129 if (rc < 0) { 1130 pj_thread_sleep(10); 1131 continue; 1132 } 1133 1119 1134 if (rc > 0 && PJ_FD_ISSET(strm->rtp_sock, &set)) { 1120 1135 … … 1132 1147 if (status != PJ_SUCCESS) { 1133 1148 app_perror(THIS_FILE, "RTP recv() error", status); 1149 pj_thread_sleep(10); 1134 1150 continue; 1135 1151 } … … 1164 1180 size = sizeof(packet); 1165 1181 status = pj_sock_recv( strm->rtcp_sock, packet, &size, 0); 1166 if (status != PJ_SUCCESS) 1182 if (status != PJ_SUCCESS) { 1167 1183 app_perror(THIS_FILE, "Error receiving RTCP packet", status); 1168 else 1184 pj_thread_sleep(10); 1185 } else 1169 1186 pjmedia_rtcp_rx_rtcp(&strm->rtcp, packet, size); 1170 1187 } … … 1705 1722 1706 1723 /* Shutting down... */ 1724 destroy_sip(); 1707 1725 destroy_media(); 1708 destroy_sip(); 1726 1727 if (app.pool) { 1728 pj_pool_release(app.pool); 1729 app.pool = NULL; 1730 pj_caching_pool_destroy(&app.cp); 1731 } 1732 1709 1733 app_logging_shutdown(); 1710 1734
Note: See TracChangeset
for help on using the changeset viewer.