Changeset 410
- Timestamp:
- Apr 25, 2006 10:02:40 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/sndinfo.c
r373 r410 74 74 } 75 75 76 static int clock_rate; 76 77 static int play_counter; 77 78 static int rec_counter; 78 79 static int min_delay = 0xFFFF, max_delay; 79 80 static char play_delays[1000]; 81 static pj_uint32_t last_play_timestamp, last_rec_timestamp; 80 82 81 83 static pj_status_t play_cb(void *user_data, pj_uint32_t timestamp, … … 85 87 86 88 ++play_counter; 89 last_play_timestamp = timestamp; 87 90 88 91 if (last_cb.u64 == 0) { 89 92 pj_get_timestamp(&last_cb); 90 } else {93 } else if (play_counter <= PJ_ARRAY_SIZE(play_delays)) { 91 94 pj_timestamp now; 92 95 int delay; … … 112 115 { 113 116 ++rec_counter; 117 118 if (timestamp - last_rec_timestamp >= clock_rate) { 119 int diff; 120 diff = last_play_timestamp - timestamp; 121 printf("Play timestamp=%u, capture timestamp=%u, diff=%d\n", 122 last_play_timestamp, timestamp, diff); 123 last_rec_timestamp = timestamp; 124 } 114 125 return PJ_SUCCESS; 115 126 } … … 125 136 126 137 static int open_device(int dev_id, pjmedia_dir dir, 127 int clock_rate, intnchannel, int bits)138 int nchannel, int bits) 128 139 { 129 140 pj_status_t status = PJ_SUCCESS; … … 131 142 pjmedia_snd_stream *strm; 132 143 const char *dirtype; 144 char tmp[10]; 133 145 unsigned i; 134 146 … … 176 188 177 189 /* Let playback/capture runs for a while */ 178 pj_thread_sleep(1000); 190 //pj_thread_sleep(1000); 191 puts("Press <ENTER> to stop"); 192 fgets(tmp, sizeof(tmp), stdin); 193 179 194 180 195 pjmedia_snd_stream_close(strm); … … 235 250 int dev_id; 236 251 pjmedia_dir dir; 237 int clock_rate;238 252 int nchannel; 239 253 int bits; … … 252 266 bits = atoi(argv[5]); 253 267 254 return open_device(dev_id, dir, clock_rate,nchannel, bits);268 return open_device(dev_id, dir, nchannel, bits); 255 269 256 270 } else {
Note: See TracChangeset
for help on using the changeset viewer.