Changeset 361
- Timestamp:
- Mar 24, 2006 8:44:27 PM (19 years ago)
- Location:
- pjproject/trunk/pjsip-apps
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/build/Samples-vc.mak
r344 r361 40 40 SAMPLES = $(BINDIR)\simpleua.exe $(BINDIR)\playfile.exe $(BINDIR)\playsine.exe \ 41 41 $(BINDIR)\confsample.exe $(BINDIR)\sndinfo.exe \ 42 $(BINDIR)\level.exe 42 $(BINDIR)\level.exe $(BINDIR)\recfile.exe \ 43 $(BINDIR)\resampleplay.exe 44 43 45 44 46 all: $(OBJDIR) $(SAMPLES) 45 47 46 $(SAMPLES): $(SRCDIR)\$(@B).c $(LIBS) Samples-vc.mak48 $(SAMPLES): $(SRCDIR)\$(@B).c $(LIBS) $(SRCDIR)\util.h Samples-vc.mak 47 49 cl -nologo -c $(SRCDIR)\$(@B).c /Fo$(OBJDIR)\$(@B).obj $(CFLAGS) 48 50 cl /nologo $(OBJDIR)\$(@B).obj /Fe$@ /Fm$(OBJDIR)\$(@B).map $(LDFLAGS) -
pjproject/trunk/pjsip-apps/build/Samples.mak
r346 r361 39 39 BINDIR := ../bin/samples 40 40 41 SAMPLES := simpleua playfile playsine confsample sndinfo level 41 SAMPLES := simpleua playfile playsine confsample sndinfo level recfile resampleplay 42 42 43 43 EXES := $(foreach file, $(SAMPLES), $(BINDIR)/$(file)-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(HOST_EXE)) -
pjproject/trunk/pjsip-apps/build/sample_debug.dsp
r336 r361 51 51 LINK32=link.exe 52 52 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 53 # ADD LINK32 ole32.lib user32.lib dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../bin/samples/ debug_vc6.exe"53 # ADD LINK32 ole32.lib user32.lib dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../bin/samples/sampledebug_vc6.exe" 54 54 55 55 !ELSEIF "$(CFG)" == "sample_debug - Win32 Debug" … … 67 67 # PROP Target_Dir "" 68 68 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c 69 # ADD CPP /nologo /MTd /W 3/Gm /GX /ZI /Od /I "../../pjsip/include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjmedia/include" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c69 # ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../../pjsip/include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjmedia/include" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c 70 70 # ADD BASE RSC /l 0x409 /d "_DEBUG" 71 71 # ADD RSC /l 0x409 /d "_DEBUG" … … 75 75 LINK32=link.exe 76 76 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept 77 # ADD LINK32 ole32.lib user32.lib dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/samples/ debug_vc6d.exe" /pdbtype:sept77 # ADD LINK32 ole32.lib user32.lib dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/samples/sampledebug_vc6d.exe" /pdbtype:sept 78 78 79 79 !ENDIF -
pjproject/trunk/pjsip-apps/build/samples.dsp
r350 r361 103 103 # Begin Source File 104 104 105 SOURCE=..\src\samples\recfile.c 106 # End Source File 107 # Begin Source File 108 109 SOURCE=..\src\samples\resampleplay.c 110 # End Source File 111 # Begin Source File 112 105 113 SOURCE=..\src\samples\simpleua.c 106 114 # End Source File -
pjproject/trunk/pjsip-apps/src/pjsip-perf/main.c
r350 r361 18 18 */ 19 19 #include "pjsip_perf.h" 20 #include <pjsua-lib/getopt.h>21 20 #include <stdlib.h> /* atoi */ 22 21 -
pjproject/trunk/pjsip-apps/src/samples/confsample.c
r352 r361 19 19 20 20 #include <pjmedia.h> 21 #include <pjlib-util.h> /* pj_getopt */ 22 #include <pjlib.h> 23 24 #include <stdlib.h> /* atoi() */ 25 #include <stdio.h> 26 27 #include "util.h" 28 29 /* For logging purpose. */ 30 #define THIS_FILE "confsample.c" 31 32 33 /* Shall we put recorder in the conference */ 34 #define RECORDER 1 35 21 36 22 37 static const char *desc = … … 31 46 " USAGE: \n" 32 47 " \n" 33 " confsample [file1.wav] [file2.wav] ... \n" 34 " \n" 35 " where: \n" 48 " confsample [options] [file1.wav] [file2.wav] ... \n" 49 " \n" 50 " options: \n" 51 SND_USAGE 52 " \n" 36 53 " fileN.wav are optional WAV files to be connected to the conference \n" 37 54 " bridge. The WAV files MUST have single channel (mono) and 16 bit PCM \n" … … 46 63 " to slot starting from number one in the bridge. The WAV files can have \n" 47 64 " arbitrary sampling rate; the bridge will convert it to its clock rate. \n" 48 " However, the files MUST have a single audio channel only (i.e. mono). \n"; 49 50 #include <pjmedia.h> 51 #include <pjlib.h> 52 53 #include <stdlib.h> /* atoi() */ 54 #include <stdio.h> 55 56 57 /* For logging purpose. */ 58 #define THIS_FILE "confsample.c" 59 60 /* Constants */ 61 #define CLOCK_RATE 44100 62 #define NSAMPLES (CLOCK_RATE * 20 / 1000) 63 #define NCHANNELS 1 64 #define NBITS 16 65 " However, the files MUST have a single audio channel only (i.e. mono). \n"; 66 65 67 66 68 … … 74 76 /* Display VU meter */ 75 77 static void monitor_level(pjmedia_conf *conf, int slot, int dir, int dur); 76 77 78 /* Util to display the error message for the specified error code */79 static int app_perror( const char *sender, const char *title,80 pj_status_t status)81 {82 char errmsg[PJ_ERR_MSG_SIZE];83 84 pj_strerror(status, errmsg, sizeof(errmsg));85 86 printf("%s: %s [code=%d]\n", title, errmsg, status);87 return 1;88 }89 78 90 79 … … 124 113 int main(int argc, char *argv[]) 125 114 { 115 int dev_id = -1; 116 int clock_rate = CLOCK_RATE; 117 int channel_count = NCHANNELS; 118 int samples_per_frame = NSAMPLES; 119 int bits_per_sample = NBITS; 120 126 121 pj_caching_pool cp; 127 122 pjmedia_endpt *med_endpt; … … 131 126 int i, port_count, file_count; 132 127 pjmedia_port **file_port; /* Array of file ports */ 128 pjmedia_port *rec_port = NULL; /* Wav writer port */ 133 129 134 130 char tmp[10]; 135 131 pj_status_t status; 136 137 138 /* Just in case user needs help */139 if (argc > 1 && (*argv[1]=='-' || *argv[1]=='/' || *argv[1]=='?')) {140 usage();141 return 1;142 }143 132 144 133 … … 146 135 status = pj_init(); 147 136 PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); 137 138 /* Get command line options. */ 139 if (get_snd_options(THIS_FILE, argc, argv, &dev_id, &clock_rate, 140 &channel_count, &samples_per_frame, &bits_per_sample)) 141 { 142 usage(); 143 return 1; 144 } 148 145 149 146 /* Must create a pool factory before we can allocate any memory. */ … … 166 163 167 164 168 file_count = argc -1;169 port_count = file_count + 1 ;165 file_count = argc - pj_optind; 166 port_count = file_count + 1 + RECORDER; 170 167 171 168 /* Create the conference bridge. … … 175 172 status = pjmedia_conf_create( pool, /* pool to use */ 176 173 port_count,/* number of ports */ 177 CLOCK_RATE,/* sampling rate */178 NCHANNELS,/* # of channels. */179 NSAMPLES, /* samples per frame */180 NBITS, /* bits per sample */174 clock_rate, 175 channel_count, 176 samples_per_frame, 177 bits_per_sample, 181 178 0, /* options */ 182 179 &conf /* result */ … … 187 184 } 188 185 186 #if RECORDER 187 status = pjmedia_file_writer_port_create( pool, "confrecord.wav", 188 clock_rate, channel_count, 189 samples_per_frame, 190 bits_per_sample, 0, 0, NULL, 191 &rec_port); 192 if (status != PJ_SUCCESS) { 193 app_perror(THIS_FILE, "Unable to create WAV writer", status); 194 return 1; 195 } 196 197 pjmedia_conf_add_port(conf, pool, rec_port, NULL, NULL); 198 #endif 199 189 200 190 201 /* Create file ports. */ … … 194 205 195 206 /* Load the WAV file to file port. */ 196 status = pjmedia_file_player_port_create( pool, /* pool. */ 197 argv[i+1],/* filename */ 198 0, /* flags */ 199 0, /* buf size */ 200 NULL, /* user data */ 201 &file_port[i] /* result */ 202 ); 207 status = pjmedia_file_player_port_create( 208 pool, /* pool. */ 209 argv[i+pj_optind], /* filename */ 210 0, /* flags */ 211 0, /* buf size */ 212 NULL, /* user data */ 213 &file_port[i] /* result */ 214 ); 203 215 if (status != PJ_SUCCESS) { 204 216 char title[80]; 205 pj_ansi_sprintf(title, "Unable to use %s", argv[i+ 1]);217 pj_ansi_sprintf(title, "Unable to use %s", argv[i+pj_optind]); 206 218 app_perror(THIS_FILE, title, status); 207 219 usage(); … … 214 226 file_port[i], /* port to connect */ 215 227 NULL, /* Use port's name */ 216 NULL /* ptr to receive slot #*/228 NULL /* ptr for slot # */ 217 229 ); 218 230 if (status != PJ_SUCCESS) { … … 229 241 */ 230 242 243 244 /* Dump memory usage */ 245 dump_pool_usage(THIS_FILE, &cp); 231 246 232 247 /* Sleep to allow log messages to flush */ … … 421 436 } 422 437 438 /* Destroy recorder port */ 439 if (rec_port) 440 pjmedia_port_destroy(rec_port); 441 423 442 /* Release application pool */ 424 443 pj_pool_release( pool ); … … 484 503 " Name : %.*s\n" 485 504 " Sampling rate : %d Hz\n" 505 " Samples per frame : %d\n" 486 506 " Frame time : %d ms\n" 487 507 " Signal level adjustment : tx=%d, rx=%d\n" … … 492 512 port_info->name.ptr, 493 513 port_info->clock_rate, 514 port_info->samples_per_frame, 494 515 port_info->samples_per_frame*1000/port_info->clock_rate, 495 516 port_info->tx_adj_level, -
pjproject/trunk/pjsip-apps/src/samples/debug.c
r336 r361 28 28 * #include "playfile.c" 29 29 */ 30 #include " confsample.c"30 #include "resampleplay.c" 31 31 -
pjproject/trunk/pjsip-apps/src/samples/playfile.c
r350 r361 19 19 20 20 #include <pjmedia.h> 21 #include <pjlib-util.h> 22 #include <pjlib.h> 23 #include <stdio.h> 24 #include <stdlib.h> 25 26 #include "util.h" 27 21 28 22 29 /* … … 34 41 */ 35 42 36 #include <pjmedia.h>37 #include <pjlib.h>38 39 #include <stdio.h>40 43 41 44 /* For logging purpose. */ … … 43 46 44 47 45 /* Util to display the error message for the specified error code */ 46 static int app_perror( const char *sender, const char *title, 47 pj_status_t status) 48 { 49 char errmsg[PJ_ERR_MSG_SIZE]; 50 51 pj_strerror(status, errmsg, sizeof(errmsg)); 52 53 printf("%s: %s [code=%d]\n", title, errmsg, status); 54 return 1; 55 } 48 static const char *desc = 49 " FILE \n" 50 " \n" 51 " playfile.c \n" 52 " \n" 53 " PURPOSE \n" 54 " \n" 55 " Demonstrate how to play a WAV file. \n" 56 " \n" 57 " USAGE \n" 58 " \n" 59 " playfile FILE.WAV \n" 60 " \n" 61 " The WAV file could have mono or stereo channels with arbitrary \n" 62 " sampling rate, but MUST contain uncompressed (i.e. 16bit) PCM. \n"; 56 63 57 64 … … 69 76 pj_status_t status; 70 77 71 72 /* Verify cmd line arguments. */73 if (argc != 2) {74 puts("");75 puts("Usage: ");76 puts(" playfile <wav-file>");77 puts("");78 puts("The WAV file could have mono or stereo channels with arbitrary");79 puts("sampling rate, but MUST contain uncompressed (i.e. 16bit) PCM.");80 return 0;81 }82 78 83 79 /* Must init PJLIB first: */ -
pjproject/trunk/pjsip-apps/src/samples/simpleua.c
r350 r361 62 62 #define THIS_FILE "simpleua.c" 63 63 64 #include "util.h" 64 65 65 66 /* … … 125 126 126 127 127 /*128 * Util to display the error message for the specified error code129 */130 static int app_perror( const char *sender, const char *title,131 pj_status_t status)132 {133 char errmsg[PJ_ERR_MSG_SIZE];134 135 pj_strerror(status, errmsg, sizeof(errmsg));136 137 PJ_LOG(1,(sender, "%s: %s [code=%d]", title, errmsg, status));138 return 1;139 }140 141 128 142 129 /* … … 416 403 } 417 404 418 /* On exit, dump memory usage: */ 419 { 420 pj_pool_t *p; 421 unsigned total_alloc = 0; 422 unsigned total_used = 0; 423 424 /* Accumulate memory usage in active list. */ 425 p = cp.used_list.next; 426 while (p != (pj_pool_t*) &cp.used_list) { 427 total_alloc += pj_pool_get_capacity(p); 428 total_used += pj_pool_get_used_size(p); 429 p = p->next; 430 } 431 432 printf("Total pool memory allocated=%d KB, used=%d KB\n", 433 total_alloc / 1000, 434 total_used / 1000); 435 } 405 /* On exit, dump current memory usage: */ 406 dump_pool_usage(THIS_FILE, &cp); 436 407 437 408 return 0; -
pjproject/trunk/pjsip-apps/src/samples/util.h
r328 r361 1 2 /* Include all PJSIP core headers. */3 #include <pjsip.h>4 5 /* Include all PJMEDIA headers. */6 #include <pjmedia.h>7 8 /* Include all PJMEDIA-CODEC headers. */9 #include <pjmedia-codec.h>10 11 /* Include all PJSIP-UA headers */12 #include <pjsip_ua.h>13 14 /* Include all PJSIP-SIMPLE headers */15 #include <pjsip_simple.h>16 17 /* Include all PJLIB-UTIL headers. */18 #include <pjlib-util.h>19 20 /* Include all PJLIB headers. */21 #include <pjlib.h>22 1 23 2 24 /* Global endpoint instance. */ 25 static pjsip_endpoint *g_endpt; 26 27 /* Global caching pool factory. */ 28 static pj_caching_pool cp; 29 30 /* Global media endpoint. */ 31 static pjmedia_endpt *g_med_endpt; 32 33 /* 34 * Show error. 35 */ 3 /* Util to display the error message for the specified error code */ 36 4 static int app_perror( const char *sender, const char *title, 37 5 pj_status_t status) … … 41 9 pj_strerror(status, errmsg, sizeof(errmsg)); 42 10 43 PJ_LOG( 1,(sender, "%s: %s [code=%d]", title, errmsg, status));11 PJ_LOG(3,(sender, "%s: %s [code=%d]", title, errmsg, status)); 44 12 return 1; 45 13 } 46 14 15 16 17 /* Constants */ 18 #define CLOCK_RATE 44100 19 #define NSAMPLES (CLOCK_RATE * 20 / 1000) 20 #define NCHANNELS 1 21 #define NBITS 16 22 47 23 /* 48 * Perform the very basic initialization: 49 * - init PJLIB. 50 * - init memory pool 51 * - create SIP endpoint instance. 24 * Common sound options. 52 25 */ 53 static pj_status_t util_init(void) 26 #define SND_USAGE \ 27 " -d, --dev=NUM Sound device use device id NUM (default=-1) \n"\ 28 " -r, --rate=HZ Set clock rate in samples per sec (default=44100)\n"\ 29 " -c, --channel=NUM Set # of channels (default=1 for mono). \n"\ 30 " -f, --frame=NUM Set # of samples per frame (default equival 20ms)\n"\ 31 " -b, --bit=NUM Set # of bits per sample (default=16) \n" 32 33 34 /* 35 * This utility function parses the command line and look for 36 * common sound options. 37 */ 38 static pj_status_t get_snd_options( const char *app_name, 39 int argc, 40 char *argv[], 41 int *dev_id, 42 int *clock_rate, 43 int *channel_count, 44 int *samples_per_frame, 45 int *bits_per_sample) 54 46 { 55 pj_status_t status; 47 struct pj_getopt_option long_options[] = { 48 { "dev", 1, 0, 'd' }, 49 { "rate", 1, 0, 'r' }, 50 { "channel", 1, 0, 'c' }, 51 { "frame", 1, 0, 'f' }, 52 { "bit", 1, 0, 'b' }, 53 { NULL, 0, 0, 0 }, 54 }; 55 int c; 56 int option_index; 57 long val; 58 char *err; 56 59 57 /* Init PJLIB */ 58 status = pj_init(); 59 if (status != PJ_SUCCESS) { 60 app_perror(THIS_FILE, "pj_init() error", status); 61 return status; 60 *samples_per_frame = 0; 61 62 pj_optind = 0; 63 while((c=pj_getopt_long(argc,argv, "d:r:c:f:b:", 64 long_options, &option_index))!=-1) 65 { 66 67 switch (c) { 68 case 'd': 69 /* device */ 70 val = strtol(pj_optarg, &err, 10); 71 if (*err) { 72 PJ_LOG(3,(app_name, "Error: invalid value for device id")); 73 return PJ_EINVAL; 74 } 75 *dev_id = val; 76 break; 77 78 case 'r': 79 /* rate */ 80 val = strtol(pj_optarg, &err, 10); 81 if (*err) { 82 PJ_LOG(3,(app_name, "Error: invalid value for clock rate")); 83 return PJ_EINVAL; 84 } 85 *clock_rate = val; 86 break; 87 88 case 'c': 89 /* channel count */ 90 val = strtol(pj_optarg, &err, 10); 91 if (*err) { 92 PJ_LOG(3,(app_name, "Error: invalid channel count")); 93 return PJ_EINVAL; 94 } 95 *channel_count = val; 96 break; 97 98 case 'f': 99 /* frame count/samples per frame */ 100 val = strtol(pj_optarg, &err, 10); 101 if (*err) { 102 PJ_LOG(3,(app_name, "Error: invalid samples per frame")); 103 return PJ_EINVAL; 104 } 105 *samples_per_frame = val; 106 break; 107 108 case 'b': 109 /* bit per sample */ 110 val = strtol(pj_optarg, &err, 10); 111 if (*err) { 112 PJ_LOG(3,(app_name, "Error: invalid samples bits per sample")); 113 return PJ_EINVAL; 114 } 115 *bits_per_sample = val; 116 break; 117 118 default: 119 /* Unknown options */ 120 PJ_LOG(3,(app_name, "Error: unknown options '%c'", pj_optopt)); 121 return PJ_EINVAL; 122 } 123 62 124 } 63 125 64 /* Init PJLIB-UTIL: */ 65 status = pjlib_util_init(); 66 if (status != PJ_SUCCESS) { 67 app_perror(THIS_FILE, "pjlib_util_init() error", status); 68 return status; 126 if (*samples_per_frame == 0) { 127 *samples_per_frame = *clock_rate * *channel_count * 20 / 1000; 69 128 } 70 129 71 /* Init memory pool: */ 130 return 0; 131 } 72 132 73 /* Init caching pool. */74 pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);75 133 76 /* Create global endpoint: */ 134 /* Dump memory pool usage. */ 135 static void dump_pool_usage( const char *app_name, pj_caching_pool *cp ) 136 { 137 pj_pool_t *p; 138 unsigned total_alloc = 0; 139 unsigned total_used = 0; 77 140 78 { 79 const pj_str_t *hostname; 80 const char *endpt_name; 81 82 /* Endpoint MUST be assigned a globally unique name. 83 * The name will be used as the hostname in Warning header. 84 */ 85 86 /* For this implementation, we'll use hostname for simplicity */ 87 hostname = pj_gethostname(); 88 endpt_name = hostname->ptr; 89 90 /* Create the endpoint: */ 91 92 status = pjsip_endpt_create(&cp.factory, endpt_name, 93 &g_endpt); 94 if (status != PJ_SUCCESS) { 95 app_perror(THIS_FILE, "Unable to create SIP endpoint", status); 96 return status; 97 } 141 /* Accumulate memory usage in active list. */ 142 p = cp->used_list.next; 143 while (p != (pj_pool_t*) &cp->used_list) { 144 total_alloc += pj_pool_get_capacity(p); 145 total_used += pj_pool_get_used_size(p); 146 p = p->next; 98 147 } 99 148 100 return PJ_SUCCESS; 149 PJ_LOG(3, (app_name, "Total pool memory allocated=%d KB, used=%d KB", 150 total_alloc / 1000, 151 total_used / 1000)); 101 152 } 102 103 /*104 * Add UDP transport to endpoint.105 */106 static pj_status_t util_add_udp_transport(int port)107 {108 pj_sockaddr_in addr;109 pj_status_t status;110 111 addr.sin_family = PJ_AF_INET;112 addr.sin_addr.s_addr = 0;113 addr.sin_port = port;114 115 status = pjsip_udp_transport_start( g_endpt, &addr, NULL, 1, NULL);116 if (status != PJ_SUCCESS) {117 app_perror(THIS_FILE, "Unable to start UDP transport", status);118 return status;119 }120 121 return status;122 }123
Note: See TracChangeset
for help on using the changeset viewer.