- Timestamp:
- Oct 3, 2011 6:46:51 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/1.x/pjmedia/src/pjmedia/jbuf.c
r3568 r3779 768 768 { 769 769 unsigned interval, seq_delta; 770 unsigned burst_level, burst_factor; 771 772 /* Calculating discard interval (aggressiveness) based on 773 * (current size / burst level). 774 */ 770 unsigned burst_level = 0, overflow_pct = 0; 771 772 /* Calculating percentage of burst overflow */ 775 773 if (jb->jb_status == JB_STATUS_PROCESSING) { 776 774 burst_level = PJ_MAX(jb->jb_eff_level, jb->jb_level); 777 burst_factor = cur_size / burst_level; 778 /* Tolerate small spikes */ 779 if ((burst_level <= 5) && (burst_factor < 3)) 780 burst_factor = 0; 775 if (cur_size > (int)burst_level) 776 overflow_pct = (cur_size - burst_level) * 100 / burst_level; 777 } 778 779 /* Deciding discard interval (aggressiveness) based on 780 * burst overflow percentage. 781 */ 782 if (burst_level <= 5 && overflow_pct < 200) { 783 /* Tolerate spikes on relatively small burst level */ 784 interval = 0; 785 } else if (overflow_pct >= 200) { 786 /* Overflow >= 200% */ 787 interval = 4; 788 } else if (overflow_pct >= 100) { 789 /* Overflow >= 100% */ 790 interval = 5; 791 } else if (overflow_pct >= 10) { 792 /* Overflow >= 10% */ 793 interval = 7; 781 794 } else { 782 burst_factor = 0; 783 } 784 785 switch (burst_factor) { 786 case 0: 795 /* Overflow < 10%, tolerable */ 787 796 interval = 0; 788 break;789 case 1:790 interval = 7;791 break;792 case 2:793 interval = 5;794 break;795 default:796 interval = 4;797 break;798 797 } 799 798
Note: See TracChangeset
for help on using the changeset viewer.