Changeset 4728 for pjproject/trunk/pjmedia/src/test/jbuf_test.c
- Timestamp:
- Feb 4, 2014 10:13:56 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/test/jbuf_test.c
r3841 r4728 1 1 /* $Id$ */ 2 /* 2 /* 3 3 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) 4 4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> … … 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 #include <stdio.h> … … 48 48 } test_cond_t; 49 49 50 static pj_bool_t parse_test_headers(char *line, test_param_t *param, 50 static pj_bool_t parse_test_headers(char *line, test_param_t *param, 51 51 test_cond_t *cond) 52 52 { … … 57 57 char mode_st[16]; 58 58 59 sscanf(p+1, "%s %u %u %u", mode_st, ¶m->init_prefetch, 59 sscanf(p+1, "%s %u %u %u", mode_st, ¶m->init_prefetch, 60 60 ¶m->min_prefetch, ¶m->max_prefetch); 61 61 param->adaptive = (pj_ansi_stricmp(mode_st, "adaptive") == 0); … … 103 103 } 104 104 105 static pj_bool_t process_test_data(char data, pjmedia_jbuf *jb, 105 static pj_bool_t process_test_data(char data, pjmedia_jbuf *jb, 106 106 pj_uint16_t *seq, pj_uint16_t *last_seq) 107 107 { … … 156 156 157 157 pjmedia_jbuf_get_state(jb, &state); 158 printf("seq=%d\t%c\tsize=%d\tprefetch=%d\n", 158 printf("seq=%d\t%c\tsize=%d\tprefetch=%d\n", 159 159 *last_seq, toupper(data), state.size, state.prefetch); 160 160 } 161 #else 162 PJ_UNUSED_ARG(print_state); /* Warning about variable set but unused */ 161 163 #endif 162 164 … … 171 173 int rc = 0; 172 174 const char* input_filename = "Jbtest.dat"; 173 const char* input_search_path[] = { 175 const char* input_search_path[] = { 174 176 "../build", 175 177 "pjmedia/build", … … 192 194 } 193 195 } 194 196 195 197 /* Failed to open test data file. */ 196 198 if (input == NULL) { … … 245 247 246 248 if (param.adaptive) { 247 pjmedia_jbuf_set_adaptive(jb, 248 param.init_prefetch, 249 pjmedia_jbuf_set_adaptive(jb, 250 param.init_prefetch, 249 251 param.min_prefetch, 250 252 param.max_prefetch); … … 255 257 #ifdef REPORT 256 258 pjmedia_jbuf_get_state(jb, &state); 257 printf("Initial\tsize=%d\tprefetch=%d\tmin.pftch=%d\tmax.pftch=%d\n", 258 state.size, state.prefetch, state.min_prefetch, 259 printf("Initial\tsize=%d\tprefetch=%d\tmin.pftch=%d\tmax.pftch=%d\n", 260 state.size, state.prefetch, state.min_prefetch, 259 261 state.max_prefetch); 260 262 #endif … … 264 266 while (1) { 265 267 char c; 266 268 267 269 /* Get next line of test data */ 268 270 if (!p || *p == 0) { … … 302 304 printf(" size=%d prefetch=%d\n", state.size, state.prefetch); 303 305 printf(" delay (min/max/avg/dev)=%d/%d/%d/%d ms\n", 304 state.min_delay, state.max_delay, state.avg_delay, 306 state.min_delay, state.max_delay, state.avg_delay, 305 307 state.dev_delay); 306 printf(" lost=%d discard=%d empty=%d burst(avg)=%d\n", 308 printf(" lost=%d discard=%d empty=%d burst(avg)=%d\n", 307 309 state.lost, state.discard, state.empty, state.avg_burst); 308 310 309 311 /* Evaluate test session */ 310 312 if (cond.burst >= 0 && (int)state.avg_burst > cond.burst) { 311 printf("! 'Burst' should be %d, it is %d\n", 313 printf("! 'Burst' should be %d, it is %d\n", 312 314 cond.burst, state.avg_burst); 313 315 rc |= 1; 314 316 } 315 317 if (cond.delay >= 0 && (int)state.avg_delay/JB_PTIME > cond.delay) { 316 printf("! 'Delay' should be %d, it is %d\n", 318 printf("! 'Delay' should be %d, it is %d\n", 317 319 cond.delay, state.avg_delay/JB_PTIME); 318 320 rc |= 2; 319 321 } 320 322 if (cond.delay_min >= 0 && (int)state.min_delay/JB_PTIME > cond.delay_min) { 321 printf("! 'Minimum delay' should be %d, it is %d\n", 323 printf("! 'Minimum delay' should be %d, it is %d\n", 322 324 cond.delay_min, state.min_delay/JB_PTIME); 323 325 rc |= 32; … … 329 331 } 330 332 if (cond.empty >= 0 && (int)state.empty > cond.empty) { 331 printf("! 'Empty' should be %d, it is %d\n", 333 printf("! 'Empty' should be %d, it is %d\n", 332 334 cond.empty, state.empty); 333 335 rc |= 8; 334 336 } 335 337 if (cond.lost >= 0 && (int)state.lost > cond.lost) { 336 printf("! 'Lost' should be %d, it is %d\n", 338 printf("! 'Lost' should be %d, it is %d\n", 337 339 cond.lost, state.lost); 338 340 rc |= 16;
Note: See TracChangeset
for help on using the changeset viewer.