Changeset 371 for pjproject/trunk/pjsip-apps/src/samples/sndinfo.c
- Timestamp:
- Apr 3, 2006 9:43:36 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/sndinfo.c
r353 r371 76 76 static int play_counter; 77 77 static int rec_counter; 78 static int min_delay = 0xFFFF, max_delay; 79 static char play_delays[1000]; 78 80 79 81 static pj_status_t play_cb(void *user_data, pj_uint32_t timestamp, 80 82 void *output, unsigned size) 81 83 { 84 static pj_time_val last_cb; 85 82 86 ++play_counter; 87 88 if (last_cb.sec == 0 && last_cb.msec == 0) { 89 pj_gettimeofday(&last_cb); 90 } else { 91 pj_time_val now, saved; 92 int delay; 93 94 pj_gettimeofday(&now); 95 saved = now; 96 PJ_TIME_VAL_SUB(now, last_cb); 97 delay = PJ_TIME_VAL_MSEC(now); 98 99 if (delay < min_delay) 100 min_delay = delay; 101 if (delay > max_delay) 102 max_delay = delay; 103 104 last_cb = saved; 105 106 play_delays[play_counter-1] = delay; 107 } 108 83 109 return PJ_SUCCESS; 84 110 } … … 99 125 title, errmsg, status); 100 126 } 101 127 102 128 static int open_device(int dev_id, pjmedia_dir dir, 103 129 int clock_rate, int nchannel, int bits) … … 107 133 pjmedia_snd_stream *strm; 108 134 const char *dirtype; 135 unsigned i; 109 136 110 137 switch (dir) { … … 166 193 167 194 puts("Success."); 195 196 printf("Delay: "); 197 for (i=0; i<play_counter; ++i) 198 printf("%d ", play_delays[i]); 199 200 puts(""); 201 if (dir & PJMEDIA_DIR_PLAYBACK) { 202 printf("Callback interval: min interval=%d ms, max interval=%d ms\n", 203 min_delay, max_delay); 204 } 205 206 168 207 return 0; 169 208 }
Note: See TracChangeset
for help on using the changeset viewer.