Changeset 2317 for pjproject/trunk
- Timestamp:
- Sep 24, 2008 5:27:46 PM (16 years ago)
- Location:
- pjproject/trunk/pjmedia
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/jbuf.h
r2039 r2317 150 150 * 151 151 * @param jb The jitter buffer. 152 * @param prefetch The prefetch value to be applied to the jitter 153 * buffer. 152 * @param prefetch The initial prefetch value to be applied to the 153 * jitter buffer. Setting this to other than 0 will 154 * activate prefetch buffering, a jitter buffer feature 155 * that each time it gets empty, it won't return a 156 * normal frame until its size reaches the number 157 * specified here. 154 158 * @param min_prefetch The minimum delay that must be applied to each 155 * incoming packets, in number of frames. The 156 * default value is zero. 159 * incoming packets, in number of frames. 157 160 * @param max_prefetch The maximum allowable value for prefetch delay, 158 * in number of frames. The default value is equal 159 * to the size of the jitter buffer. 161 * in number of frames. 160 162 * 161 163 * @return PJ_SUCCESS on success. -
pjproject/trunk/pjmedia/src/pjmedia/jbuf.c
r2310 r2317 33 33 #define SAFE_SHRINKING_DIFF 1 34 34 #define MIN_SHRINK_GAP_MSEC 200 35 #define USE_PREFETCH_BUFFERING 036 35 37 36 typedef struct jb_framelist_t … … 67 66 // (at the beginning of the framelist->flist_buffer operation) 68 67 int jb_prefetch_cnt; // prefetch counter 68 int jb_def_prefetch; // Default prefetch 69 69 int jb_min_prefetch; // Minimum allowable prefetch 70 70 int jb_max_prefetch; // Maximum allowable prefetch … … 79 79 #define JB_STATUS_INITIALIZING 0 80 80 #define JB_STATUS_PROCESSING 1 81 #define JB_STATUS_PREFETCHING 2 81 82 82 83 /* Enabling this would log the jitter buffer state about once per … … 344 345 345 346 jb->jb_min_prefetch = jb->jb_max_prefetch = 346 jb->jb_prefetch = prefetch;347 jb->jb_prefetch = jb->jb_def_prefetch = prefetch; 347 348 348 349 return PJ_SUCCESS; … … 365 366 PJ_EINVAL); 366 367 367 jb->jb_prefetch = prefetch;368 jb->jb_prefetch = jb->jb_def_prefetch = prefetch; 368 369 jb->jb_min_prefetch = min_prefetch; 369 370 jb->jb_max_prefetch = max_prefetch; … … 423 424 if (jb->jb_stable_hist > STABLE_HISTORY_LIMIT) { 424 425 426 diff = (jb->jb_prefetch - jb->jb_max_hist_level) / 3; 427 428 if (diff < 1) 429 diff = 1; 430 425 431 /* Update max_hist_level. */ 426 432 jb->jb_max_hist_level = jb->jb_prefetch; 427 428 diff = (jb->jb_prefetch - jb->jb_max_hist_level) / 3;429 430 if (diff < 1)431 diff = 1;432 433 433 434 jb->jb_prefetch -= diff; … … 542 543 } 543 544 544 if (jb->jb_prefetch_cnt < jb->jb_prefetch) 545 if (jb->jb_prefetch_cnt < jb->jb_prefetch) { 545 546 jb->jb_prefetch_cnt += seq_diff; 547 548 TRACE__((jb->name.ptr, "PUT prefetch_cnt=%d/%d", 549 jb->jb_prefetch_cnt, jb->jb_prefetch)); 550 551 if (jb->jb_status == JB_STATUS_PREFETCHING && 552 jb->jb_prefetch_cnt >= jb->jb_prefetch) 553 { 554 int diff, cur_size; 555 556 cur_size = jb_framelist_size(&jb->jb_framelist); 557 jb->jb_status = JB_STATUS_PROCESSING; 558 } 559 } 560 561 546 562 547 563 if (discarded) … … 583 599 jbuf_update(jb, JB_OP_GET); 584 600 585 #if USE_PREFETCH_BUFFERING586 587 601 if (jb_framelist_size(&jb->jb_framelist) == 0) { 588 602 jb->jb_prefetch_cnt = 0; 589 } 590 591 if ((jb->jb_prefetch_cnt < jb->jb_prefetch)) { 603 if (jb->jb_def_prefetch) 604 jb->jb_status = JB_STATUS_PREFETCHING; 605 } 606 607 if (jb->jb_status == JB_STATUS_PREFETCHING && 608 jb->jb_prefetch_cnt < jb->jb_prefetch) 609 { 592 610 /* Can't return frame because jitter buffer is filling up 593 611 * minimum prefetch. … … 602 620 *size = 0; 603 621 622 TRACE__((jb->name.ptr, "GET prefetch_cnt=%d/%d", 623 jb->jb_prefetch_cnt, jb->jb_prefetch)); 604 624 return; 605 625 } 606 607 #endif608 626 609 627 /* Retrieve a frame from frame list */ -
pjproject/trunk/pjmedia/src/pjmedia/stream.c
r2310 r2317 1670 1670 jb_max = 500 / stream->codec_param.info.frm_ptime; 1671 1671 1672 if (info->jb_min_pre > =0)1672 if (info->jb_min_pre > 0) 1673 1673 jb_min_pre = info->jb_min_pre; 1674 1674 else … … 1682 1682 jb_max_pre = jb_max * 4 / 5; 1683 1683 1684 if (info->jb_init > =0)1684 if (info->jb_init > 0) 1685 1685 jb_init = info->jb_init; 1686 1686 else 1687 1687 //jb_init = (jb_min_pre + jb_max_pre) / 2; 1688 jb_init = jb_min_pre;1688 jb_init = 0; 1689 1689 1690 1690
Note: See TracChangeset
for help on using the changeset viewer.