- Timestamp:
- Nov 19, 2008 2:48:48 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/level.c
r2039 r2369 73 73 int main(int argc, char *argv[]) 74 74 { 75 enum { NSAMPLES = 160, COUNT=100 };75 enum { NSAMPLES = 640, COUNT=100 }; 76 76 pj_caching_pool cp; 77 77 pjmedia_endpt *med_endpt; … … 124 124 } 125 125 126 if (file_port->info.samples_per_frame > NSAMPLES) { 127 app_perror(THIS_FILE, "WAV clock rate is too big", PJ_EINVAL); 128 return 1; 129 } 130 131 puts("Time\tPCMU\tLinear"); 132 puts("------------------------"); 133 126 134 for (i=0; i<COUNT; ++i) { 127 135 pj_int16_t framebuf[NSAMPLES]; 128 136 pjmedia_frame frm; 129 137 pj_int32_t level32; 138 unsigned ms; 130 139 int level; 131 140 … … 135 144 pjmedia_port_get_frame(file_port, &frm); 136 145 137 level32 = pjmedia_calc_avg_signal( framebuf, NSAMPLES ); 146 level32 = pjmedia_calc_avg_signal(framebuf, 147 file_port->info.samples_per_frame); 138 148 level = pjmedia_linear2ulaw(level32) ^ 0xFF; 139 149 140 printf("%d ", level); 150 ms = i * 1000 * file_port->info.samples_per_frame / 151 file_port->info.clock_rate; 152 printf("%03d.%03d\t%7d\t%7d\n", 153 ms/1000, ms%1000, level, level32); 141 154 } 142 155 puts("");
Note: See TracChangeset
for help on using the changeset viewer.