Changeset 471 for pjproject/trunk
- Timestamp:
- May 22, 2006 10:48:11 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/sndtest.c
r469 r471 253 253 { 254 254 unsigned i, dur; 255 int ptime; 255 256 unsigned min_jitter, max_jitter, sum_jitter, avg_jitter=0; 256 257 … … 298 299 } 299 300 301 /* Calculate frame ptime in usec */ 302 ptime = test_data->samples_per_frame * 1000000 / 303 test_data->clock_rate; 304 300 305 /* Calculate jitter */ 301 306 min_jitter = 0xFFFFF; … … 304 309 305 310 for (i=1; i<strm_data->counter; ++i) { 306 int jitter; 307 jitter = strm_data->delay[i] - strm_data->delay[i-1]; 308 if (jitter < 0) jitter = -jitter; 311 int jitter1, jitter2, jitter; 312 313 /* jitter1 is interarrival difference */ 314 jitter1 = strm_data->delay[i] - strm_data->delay[i-1]; 315 if (jitter1 < 0) jitter1 = -jitter1; 309 316 317 /* jitter2 is difference between actual and scheduled arrival. 318 * This is intended to capture situation when frames are coming 319 * instantaneously, which will calculate as zero jitter with 320 * jitter1 calculation. 321 */ 322 jitter2 = ptime - strm_data->delay[i]; 323 if (jitter2 < 0) jitter2 = -jitter2; 324 325 /* Set jitter as the maximum of the two jitter calculations. 326 * This is intended to show the worst result. 327 */ 328 jitter = (jitter1>jitter2) ? jitter1 : jitter2; 329 330 /* Calculate min, max, avg jitter */ 310 331 if (jitter < (int)min_jitter) min_jitter = jitter; 311 332 if (jitter > (int)max_jitter) max_jitter = jitter;
Note: See TracChangeset
for help on using the changeset viewer.