Changeset 442 for pjproject/trunk/pjmedia/src/pjmedia/jbuf.c
- Timestamp:
- May 14, 2006 6:23:34 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/jbuf.c
r438 r442 51 51 jb_framelist jb_framelist; 52 52 pj_size_t jb_frame_size; // frame size 53 unsigned jb_frame_ptime; // frame duration. 53 54 pj_size_t jb_max_count; // max frames in the jitter framelist->flist_buffer 54 55 … … 81 82 82 83 84 /* Enabling this would log the jitter buffer state about once per 85 * second. 86 */ 87 #if 0 88 # define TRACE__(args) PJ_LOG(4,args) 89 #else 90 # define TRACE__(args) 91 #endif 92 83 93 84 94 static pj_status_t jb_framelist_init( pj_pool_t *pool, … … 268 278 const pj_str_t *name, 269 279 unsigned frame_size, 280 unsigned ptime, 270 281 unsigned max_count, 271 282 pjmedia_jbuf **p_jb) … … 282 293 pj_strdup_with_null(pool, &jb->name, name); 283 294 jb->jb_frame_size = frame_size; 295 jb->jb_frame_ptime = ptime; 284 296 jb->jb_last_seq_no = -1; 285 297 jb->jb_level = 0; … … 368 380 static void jbuf_calculate_jitter(pjmedia_jbuf *jb) 369 381 { 370 enum { STABLE_HISTORY_LIMIT = (100*2) }; 382 unsigned stable_history_limit; 383 384 stable_history_limit = 1000 / jb->jb_frame_ptime; 371 385 372 386 jb->jb_last_jitter = PJ_ABS(jb->jb_level-jb->jb_last_level); … … 377 391 if (jb->jb_last_jitter < jb->jb_prefetch) { 378 392 jb->jb_stable_hist += jb->jb_last_jitter; 379 if (jb->jb_stable_hist > STABLE_HISTORY_LIMIT) {393 if (jb->jb_stable_hist > (int)stable_history_limit) { 380 394 int seq_diff = (jb->jb_prefetch - jb->jb_max_hist_jitter)/3; 381 395 if (seq_diff<1) seq_diff = 1; … … 388 402 jb->jb_max_hist_jitter = 0; 389 403 390 if (jb->jb_op_count >= STABLE_HISTORY_LIMIT*2 && 404 TRACE__((THIS_FILE,"jb updated(1), prefetch=%d, size=%d", 405 jb->jb_prefetch, jb_framelist_size(&jb->jb_framelist))); 406 407 /* These code is used to shorten the delay in the jitter buffer. 408 409 if (jb->jb_op_count >= stable_history_limit*2 && 391 410 (int)jb_framelist_size(&jb->jb_framelist) > jb->jb_prefetch+2) 392 411 { … … 399 418 jb->jb_op_count = 0; 400 419 } 420 */ 401 421 402 422 } … … 409 429 jb->jb_max_hist_jitter = 0; 410 430 411 if (jb->jb_op_count >= STABLE_HISTORY_LIMIT * 2) { 431 TRACE__((THIS_FILE,"jb updated(2), prefetch=%d, size=%d", 432 jb->jb_prefetch, jb_framelist_size(&jb->jb_framelist))); 433 434 /* These code is used to shorten the delay in the jitter buffer 435 when the current size is larger than the prefetch. But it does 436 not really work when the stream supports multiple frames, since 437 the size may grow only temporarily. 438 439 if (jb->jb_op_count >= stable_history_limit * 2) { 412 440 if ((int)jb_framelist_size(&jb->jb_framelist) > jb->jb_prefetch+2) 413 441 { … … 422 450 jb->jb_op_count = 0; 423 451 } 452 */ 424 453 } 425 454 }
Note: See TracChangeset
for help on using the changeset viewer.