Changeset 2788 for pjproject


Ignore:
Timestamp:
Jun 24, 2009 2:46:36 PM (15 years ago)
Author:
nanang
Message:

Ticket #763: backported changes from ticket #762

Location:
pjproject/branches/1.0
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.0

  • pjproject/branches/1.0/pjmedia/build/Jbtest.dat

    r65 r2788  
    1 # 
    2 ############################################################################### 
    3 # This test demonstrates situation where there is no jitter.  
    4 # Jitter should go the minimum configured value. 
    5 ############################################################################### 
    6 # 
    7 #PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
    8  
    9 # 
    10 ############################################################################### 
    11 # This test demonstrates situation where there is no jitter, but with 
    12 # addition of silence compression. The jitter value should also go 
    13 # to the minimum. 
    14 ############################################################################### 
    15 # 
    16 #PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG /* Start silence */ GGGGGGGGGGGGGGGGGGGGG /* End silence */ PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
    17  
    18 # 
    19 ############################################################################### 
    20 # This test demonstrates situation where there's about one-three packets jitter 
    21 # in the network, without packet lost. 
    22 ############################################################################### 
    23 # 
    24 #PGPGPPGGPPGGPPGGGGPG PGPGPPGGPPPGGPPGGGPG PGPGPPGGPPPGGPPGGGPG PGPGPPGGPPGGPPPGGGPG PGPGPPGGPPGGPPPGGGPG 
    25  
    26 # 
    27 ############################################################################### 
    28 # Two gets two puts, no jitter 
    29 ############################################################################### 
    30 # 
    31 #PPGGPPGGPPGGPPGGPPGG PPGGPPGGPPGGPPGGPPGG PPGGPPGGPPGGPPGGPPGG PPGGPPGGPPGGPPGGPPGG PPGGPPGGPPGGPPGGPPGG 
    32  
    33 # 
    34 ############################################################################### 
    35 # Three gets three puts, no packet lost 
    36 ############################################################################### 
    37 # 
    38 #PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG 
    39  
    40  
    41 # 
    42 ############################################################################### 
    43 # Three gets three puts, with packet lost 
    44 ############################################################################### 
    45 # 
    46 #PPPGGGPPPGGGPPPGGGPGPG /* Lost */ GGGGGGGGGG PPPGGGPPPGGGPPPGGGPGPG /* Lost */ GGGGGGGGGG PPPGGGPPPGGGPPPGGGPGPG /* Lost */ GGGGGGGGGG PPPGGGPPPGGGPPPGGGPGPG /* Lost */ GGGGGGGGGG PPPGGGPPPGGGPPPGGGPGPG /* Lost */ GGGGGGGGGG PPPGGGPPPGGGPPPGGGPGPG /* Lost */ GGGGGGGGGG PPPGGGPPPGGGPPPGGGPGPG /* Lost */ GGGGGGGGGG PPPGGGPPPGGGPPPGGGPGPG /* Lost */ GGGGGGGGGG PPPGGGPPPGGGPPPGGGPGPG /* Lost */ GGGGGGGGGG PPPGGGPPPGGGPPPGGGPGPG /* Lost */ GGGGGGGGGG PPPGGGPPPGGGPPPGGGPGPG 
    47  
    48  
    49 # 
    50 ############################################################################### 
    51 # Three gets three puts, then stable 
    52 ############################################################################### 
    53 # 
    54 PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PPPGGGPPPGGGPPPGGGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
    55  
    56 # 
    57 ############################################################################### 
    58 # Some jitter 
    59 ############################################################################### 
    60 # 
    61 #PGPGPGPGPG /*Some frames missing here*/ GG /*Some frames arrive*/ PPPG /*Normal*/ PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
    62  
     1= Ideal condition 
     2%adaptive 0 0 10 
     3!burst      1 
     4!discard    0 
     5!lost       0 
     6!empty      0 
     7!delay      1 
     8PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     9PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     10. 
     11 
     12= DTX 
     13%adaptive 0 0 10 
     14!burst      1 
     15!discard    0 
     16!lost       0 
     17!empty      20 
     18!delay      1 
     19PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
     20# Start silence 
     21GGGGGGGGGGGGGGGGGGGG 
     22# End silence 
     23PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
     24. 
     25 
     26= Regular burst (three gets three puts) 
     27%adaptive 0 0 10 
     28!burst      3 
     29!discard    0 
     30!lost       0 
     31!empty      0 
     32!delay      3 
     33PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG 
     34PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG 
     35. 
     36 
     37= Random burst (no drift) 
     38%adaptive 0 0 10 
     39!burst      4 
     40!discard    1 <- there may be delay adaptation caused by multiple empty GETs followed by multiple PUTs, later when burst level reaches 'stable' condition, JB may shrink some excess frames 
     41!lost       0 
     42!empty      4 
     43!delay      4 
     44PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     45PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     46PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     47PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     48PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     49PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     50PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     51PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     52PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     53PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     54PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     55PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     56PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     57PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     58PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     59PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     60PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     61PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     62PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     63PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     64PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     65PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     66PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     67PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     68PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     69PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     70PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     71PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     72PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     73PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     74PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     75PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     76PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     77PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     78PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     79PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     80PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     81PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     82PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     83PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     84PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     85PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     86PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     87PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     88PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     89PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     90PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     91PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     92PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     93PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     94PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     95PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     96. 
     97 
     98= Random burst (with drift, PUT > GET) 
     99%adaptive 0 0 10 
     100!burst      4 
     101!discard    68 <- number of PUT - GET, JB does shrinking by discarding frames 
     102!lost       0 
     103!empty      4 
     104!delay      8  <- should be less than or equal to twice of burst 
     105P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     106P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     107P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     108P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     109P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     110P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     111P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     112P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     113P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     114P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     115P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     116P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     117P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     118P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     119P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     120P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     121P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     122P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     123P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     124P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     125P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     126P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     127P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     128P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     129P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     130P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     131P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     132P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     133P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     134P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     135P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     136P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     137P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG  
     138P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG  
     139. 
     140 
     141= Random burst (with drift, PUT < GET) 
     142%adaptive 0 0 10 
     143!burst      4 
     144!discard    0 
     145!lost       0 
     146!empty      70 <- GET - PUT = 66, added 4 for tolerating empty caused by burst 
     147!delay      4  <- should be less than or equal to burst 
     148G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     149G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     150G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     151G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     152G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     153G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     154G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     155G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     156G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     157G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     158G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     159G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     160G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     161G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     162G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     163G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     164G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     165G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     166G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     167G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     168G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     169G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     170G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     171G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     172G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     173G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     174G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     175G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     176G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     177G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     178G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     179G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG  
     180G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG  
     181. 
     182 
     183= Packet lost 
     184%adaptive 0 0 10 
     185!burst      1 
     186!discard    0 
     187!lost       7 
     188!empty      3 
     189!delay      3 
     190PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
     191# Some losts 
     192LGPGPGLGPGPGPGLGPGPG 
     193# Normal 
     194PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
     195# More losts 
     196PLPGGGPPPGGGPLPGGGPG PLPGGGPPPGGGPLPGGGPG 
     197# Normal 
     198PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
     199. 
     200 
     201= Sequence restart 
     202%adaptive 0 0 10 
     203!burst      1 
     204!discard    0 
     205!lost       0 
     206!empty      0 
     207!delay      1 
     208PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     209PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     210PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     211PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     212# seq restarted after 120 PUTs (default MAX_MISORDER == 100) 
     213R 
     214PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     215PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     216. 
     217 
     218= Duplicated frames 
     219= e.g.: some Forward Error Correction (FEC) methods. 
     220%adaptive 0 0 10 
     221!burst      1 
     222!discard    40 
     223!lost       0 
     224!empty      0 
     225!delay      1 
     226PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG 
     227PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG 
     228. 
     229 
     230= Late frames 
     231%adaptive 0 0 10 
     232!burst      1 
     233!discard    8  <- late frames are discarded + delay adaptation 
     234!lost       4 
     235!empty      4 
     236!delay      4 
     237PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     238PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     239# Suddenly there are some lost frames 
     240LGLGPGLGLGPG 
     241# Those lost frames are actually late (+misordered), here they come 
     242OOOO 
     243# Then back to normal 
     244PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     245PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     246. 
     247 
     248= PUT burst at the beginning 
     249%adaptive 0 0 10 
     250!burst      1 
     251!discard    50 <- frames discarded for delay adaptation 
     252!lost       0 
     253!empty      0 
     254!delay      25 <- average delay, JB is able to adapt the delay 
     255PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPP 
     256PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     257PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     258PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     259PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     260PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     261PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     262PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     263PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     264PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     265PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     266PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     267PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     268PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     269PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     270. 
     271 
     272= Fixed mode prefetch 5, with two empty events 
     273%fixed 5 
     274!burst      1 
     275!discard    0 
     276!lost       0 
     277!empty      10 
     278!delay      5 
     279G 
     280PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     281GGGGG 
     282PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     283. 
     284 
     285= Fixed mode prefetch 5, with random burst 
     286%fixed 5 
     287!burst      3 
     288!discard    0 
     289!lost       0 
     290!empty      5 
     291!delay      5 
     292PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     293PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     294PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     295PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     296PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     297PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     298PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     299PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     300. 
     301 
     302= Fixed mode prefetch 10, PUT burst at the beginning 
     303%fixed 10 
     304!burst      1 
     305!discard    35 <- frames discarded for delay adaptation 
     306!lost       0 
     307!empty      0 
     308!delay      30 <- average delay 
     309PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPP 
     310PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     311PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     312PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     313PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     314PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     315PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     316PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     317PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     318PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     319PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     320PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     321PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     322PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     323PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     324. 
  • pjproject/branches/1.0/pjmedia/include/pjmedia/jbuf.h

    r2394 r2788  
    6767 
    6868/** 
    69  * This structure describes jitter buffer current status. 
     69 * This structure describes jitter buffer state. 
    7070 */ 
    7171struct pjmedia_jb_state 
    7272{ 
     73    /* Setting */ 
    7374    unsigned    frame_size;         /**< Individual frame size, in bytes.   */ 
    74     unsigned    prefetch;           /**< Current prefetch value, in frames  */ 
    7575    unsigned    min_prefetch;       /**< Minimum allowed prefetch, in frms. */ 
    7676    unsigned    max_prefetch;       /**< Maximum allowed prefetch, in frms. */ 
     77 
     78    /* Status */ 
     79    unsigned    prefetch;           /**< Current prefetch value, in frames  */ 
    7780    unsigned    size;               /**< Current buffer size, in frames.    */ 
     81 
     82    /* Statistic */ 
    7883    unsigned    avg_delay;          /**< Average delay, in ms.              */ 
    7984    unsigned    min_delay;          /**< Minimum delay, in ms.              */ 
    8085    unsigned    max_delay;          /**< Maximum delay, in ms.              */ 
    81     unsigned    dev_delay;          /**< Standard deviation of delay, in ms. */ 
     86    unsigned    dev_delay;          /**< Standard deviation of delay, in ms.*/ 
     87    unsigned    avg_burst;          /**< Average burst, in frames.          */ 
     88    unsigned    lost;               /**< Number of lost frames.             */ 
     89    unsigned    discard;            /**< Number of discarded frames.        */ 
     90    unsigned    empty;              /**< Number of empty on GET events.     */ 
    8291}; 
    8392 
  • pjproject/branches/1.0/pjmedia/src/pjmedia/jbuf.c

    r2549 r2788  
    3232#define THIS_FILE   "jbuf.c" 
    3333 
     34 
     35/* Minimal difference between JB size and 2*burst-level to perform  
     36 * JB shrinking.  
     37 */ 
    3438#define SAFE_SHRINKING_DIFF     1 
     39 
     40/* Minimal gap (in ms) between JB shrinking */ 
    3541#define MIN_SHRINK_GAP_MSEC     200 
    3642 
     43/* Invalid sequence number, used as the initial value. */ 
     44#define INVALID_OFFSET          -9999 
     45 
     46/* Maximum burst length, whenever an operation is bursting longer than  
     47 * this value, JB will assume that the opposite operation was idle. 
     48 */ 
     49#define MAX_BURST_MSEC          1000 
     50 
     51/* Number of OP switches to be performed in JB_STATUS_INITIALIZING, before 
     52 * JB can switch its states to JB_STATUS_PROCESSING. 
     53 */ 
     54#define INIT_CYCLE              10 
     55 
     56 
     57/* Struct of JB internal buffer, represented in a circular buffer containing 
     58 * frame content, frame type, frame length, and frame bit info. 
     59 */ 
    3760typedef struct jb_framelist_t 
    3861{ 
    39     char        *flist_buffer; 
    40     int         *flist_frame_type; 
    41     pj_size_t   *flist_content_len; 
    42     pj_uint32_t *flist_bit_info; 
    43     unsigned     flist_frame_size; 
    44     unsigned     flist_max_count; 
    45     unsigned     flist_empty; 
    46     unsigned     flist_head; 
    47     unsigned     flist_tail; 
    48     unsigned     flist_origin; 
     62    /* Settings */ 
     63    unsigned         frame_size;        /**< maximum size of frame          */ 
     64    unsigned         max_count;         /**< maximum number of frames       */ 
     65 
     66    /* Buffers */ 
     67    char            *content;           /**< frame content array            */ 
     68    int             *frame_type;        /**< frame type array               */ 
     69    pj_size_t       *content_len;       /**< frame length array             */ 
     70    pj_uint32_t     *bit_info;          /**< frame bit info array           */ 
     71     
     72    /* States */ 
     73    unsigned         head;              /**< index of head, pointed frame 
     74                                             will be returned by next GET   */ 
     75    unsigned         size;              /**< current size of framelist.     */ 
     76    int              origin;            /**< original index of flist_head   */ 
    4977} jb_framelist_t; 
    5078 
     
    5280struct pjmedia_jbuf 
    5381{ 
    54     pj_str_t        name;                 // jitter buffer name 
    55     jb_framelist_t  jb_framelist; 
    56     pj_size_t       jb_frame_size;        // frame size  
    57     unsigned        jb_frame_ptime;       // frame duration. 
    58     pj_size_t       jb_max_count;         // max frames in the jitter framelist->flist_buffer 
    59  
    60     int             jb_level;             // delay between source & destination 
    61                                           // (calculated according of the number of get/put operations) 
    62     int             jb_max_hist_level;    // max level during the last level calculations 
    63     int             jb_stable_hist;       // num of times the delay has been lower then the prefetch num 
    64     int             jb_last_op;           // last operation executed on the framelist->flist_buffer (put/get) 
    65     int             jb_last_seq_no;       // seq no. of the last frame inserted to the framelist->flist_buffer 
    66     int             jb_prefetch;          // no. of frame to insert before removing some 
    67                                           // (at the beginning of the framelist->flist_buffer operation) 
    68     int             jb_prefetch_cnt;      // prefetch counter 
    69     int             jb_def_prefetch;      // Default prefetch 
    70     int             jb_min_prefetch;      // Minimum allowable prefetch 
    71     int             jb_max_prefetch;      // Maximum allowable prefetch 
    72     int             jb_status;            // status is 'init' until the first 'put' operation 
    73     pj_math_stat    jb_delay;             // Delay statistics of jitter buffer (in frame unit) 
    74  
    75     unsigned        jb_last_del_seq;      // Seq # of last frame deleted 
    76     unsigned        jb_min_shrink_gap;    // How often can we shrink 
     82    /* Settings (consts) */ 
     83    pj_str_t        jb_name;            /**< jitter buffer name             */ 
     84    pj_size_t       jb_frame_size;      /**< frame size                     */ 
     85    unsigned        jb_frame_ptime;     /**< frame duration.                */ 
     86    pj_size_t       jb_max_count;       /**< capacity of jitter buffer,  
     87                                             in frames                      */ 
     88    int             jb_def_prefetch;    /**< Default prefetch               */ 
     89    int             jb_min_prefetch;    /**< Minimum allowable prefetch     */ 
     90    int             jb_max_prefetch;    /**< Maximum allowable prefetch     */ 
     91    int             jb_max_burst;       /**< maximum possible burst, whenever 
     92                                             burst exceeds this value, it  
     93                                             won't be included in level  
     94                                             calculation                    */ 
     95    int             jb_min_shrink_gap;  /**< How often can we shrink        */ 
     96 
     97    /* Buffer */ 
     98    jb_framelist_t  jb_framelist;       /**< the buffer                     */ 
     99 
     100    /* States */ 
     101    int             jb_level;           /**< delay between source &  
     102                                             destination (calculated according  
     103                                             of the number of burst get/put  
     104                                             operations)                    */ 
     105    int             jb_max_hist_level;  /**< max level during the last level  
     106                                             calculations                   */ 
     107    int             jb_stable_hist;     /**< num of times the delay has been  
     108                                             lower then the prefetch num    */ 
     109    int             jb_last_op;         /**< last operation executed  
     110                                             (put/get)                      */ 
     111    int             jb_prefetch;        /**< no. of frame to insert before  
     112                                             removing some (at the beginning  
     113                                             of the framelist->content  
     114                                             operation), the value may be 
     115                                             continuously updated based on 
     116                                             current frame burst level.     */ 
     117    int             jb_status;          /**< status is 'init' until the first  
     118                                             'put' operation                */ 
     119    int             jb_init_cycle_cnt;  /**< status is 'init' until the first  
     120                                             'put' operation                */ 
     121    int             jb_last_del_seq;    /**< Seq # of last frame deleted    */ 
     122 
     123    /* Statistics */ 
     124    pj_math_stat    jb_delay;           /**< Delay statistics of jitter buffer  
     125                                             (in ms)                        */ 
     126    pj_math_stat    jb_burst;           /**< Burst statistics (in frames)   */ 
     127    unsigned        jb_lost;            /**< Number of lost frames.         */ 
     128    unsigned        jb_discard;         /**< Number of discarded frames.    */ 
     129    unsigned        jb_empty;           /**< Number of empty/prefetching frame 
     130                                             returned by GET. */ 
    77131}; 
    78132 
     
    91145#endif 
    92146 
     147static pj_status_t jb_framelist_reset(jb_framelist_t *framelist); 
    93148 
    94149static pj_status_t jb_framelist_init( pj_pool_t *pool, 
     
    101156    pj_bzero(framelist, sizeof(jb_framelist_t)); 
    102157 
    103     framelist->flist_frame_size = frame_size; 
    104     framelist->flist_max_count = max_count; 
    105     framelist->flist_buffer = (char*)  
    106                               pj_pool_zalloc(pool, 
    107                                              framelist->flist_frame_size *  
    108                                              framelist->flist_max_count); 
    109  
    110     framelist->flist_frame_type = (int*) 
    111         pj_pool_zalloc(pool, sizeof(framelist->flist_frame_type[0]) *  
    112                                 framelist->flist_max_count); 
    113  
    114     framelist->flist_content_len = (pj_size_t*) 
    115         pj_pool_zalloc(pool, sizeof(framelist->flist_content_len[0]) *  
    116                                 framelist->flist_max_count); 
    117  
    118     framelist->flist_bit_info = (pj_uint32_t*) 
    119         pj_pool_zalloc(pool, sizeof(framelist->flist_bit_info[0]) *  
    120                                 framelist->flist_max_count); 
    121  
    122     framelist->flist_empty = 1; 
    123  
    124     return PJ_SUCCESS; 
     158    framelist->frame_size   = frame_size; 
     159    framelist->max_count    = max_count; 
     160    framelist->content      = (char*)  
     161                              pj_pool_alloc(pool, 
     162                                            framelist->frame_size*  
     163                                            framelist->max_count); 
     164    framelist->frame_type   = (int*) 
     165                              pj_pool_alloc(pool,  
     166                                            sizeof(framelist->frame_type[0])* 
     167                                            framelist->max_count); 
     168    framelist->content_len  = (pj_size_t*) 
     169                              pj_pool_alloc(pool,  
     170                                            sizeof(framelist->content_len[0])* 
     171                                            framelist->max_count); 
     172    framelist->bit_info     = (pj_uint32_t*) 
     173                              pj_pool_alloc(pool,  
     174                                            sizeof(framelist->bit_info[0])* 
     175                                            framelist->max_count); 
     176 
     177    return jb_framelist_reset(framelist); 
    125178 
    126179} 
     
    132185} 
    133186 
     187static pj_status_t jb_framelist_reset(jb_framelist_t *framelist)  
     188{ 
     189    framelist->head = 0; 
     190    framelist->origin = INVALID_OFFSET; 
     191    framelist->size = 0; 
     192 
     193    //pj_bzero(framelist->content,  
     194    //       framelist->frame_size *  
     195    //       framelist->max_count); 
     196 
     197    pj_memset(framelist->frame_type, 
     198              PJMEDIA_JB_MISSING_FRAME, 
     199              sizeof(framelist->frame_type[0]) *  
     200              framelist->max_count); 
     201 
     202    pj_bzero(framelist->content_len,  
     203             sizeof(framelist->content_len[0]) *  
     204             framelist->max_count); 
     205 
     206    //pj_bzero(framelist->bit_info, 
     207    //       sizeof(framelist->bit_info[0]) *  
     208    //       framelist->max_count); 
     209 
     210    return PJ_SUCCESS; 
     211} 
     212 
    134213 
    135214static unsigned jb_framelist_size(jb_framelist_t *framelist)  
    136215{ 
    137     if (framelist->flist_tail == framelist->flist_head) { 
    138         return framelist->flist_empty ? 0 : framelist->flist_max_count; 
    139     } else { 
    140         return (framelist->flist_tail - framelist->flist_head +  
    141                 framelist->flist_max_count) % framelist->flist_max_count; 
    142     } 
     216    return framelist->size; 
    143217} 
    144218 
     
    149223                                  pj_uint32_t *bit_info)  
    150224{ 
    151     if (!framelist->flist_empty) { 
     225    if (framelist->size) { 
    152226        pj_memcpy(frame,  
    153                   framelist->flist_buffer +  
    154                     framelist->flist_head * framelist->flist_frame_size, 
    155                   framelist->flist_frame_size); 
     227                  framelist->content +  
     228                  framelist->head * framelist->frame_size, 
     229                  framelist->frame_size); 
    156230        *p_type = (pjmedia_jb_frame_type)  
    157                   framelist->flist_frame_type[framelist->flist_head]; 
     231                  framelist->frame_type[framelist->head]; 
    158232        if (size) 
    159             *size   = framelist->flist_content_len[framelist->flist_head]; 
     233            *size   = framelist->content_len[framelist->head]; 
    160234        if (bit_info) 
    161             *bit_info = framelist->flist_bit_info[framelist->flist_head]; 
    162  
    163         pj_bzero(framelist->flist_buffer +  
    164                     framelist->flist_head * framelist->flist_frame_size, 
    165                   framelist->flist_frame_size); 
    166         framelist->flist_frame_type[framelist->flist_head] =  
    167             PJMEDIA_JB_MISSING_FRAME; 
    168         framelist->flist_content_len[framelist->flist_head] = 0; 
    169  
    170         framelist->flist_origin++; 
    171         framelist->flist_head = (framelist->flist_head + 1 ) %  
    172                                 framelist->flist_max_count; 
    173         if (framelist->flist_head == framelist->flist_tail)  
    174             framelist->flist_empty = PJ_TRUE; 
     235            *bit_info = framelist->bit_info[framelist->head]; 
     236 
     237        //pj_bzero(framelist->content +  
     238        //       framelist->head * framelist->frame_size, 
     239        //       framelist->frame_size); 
     240        framelist->frame_type[framelist->head] = PJMEDIA_JB_MISSING_FRAME; 
     241        framelist->content_len[framelist->head] = 0; 
     242        framelist->bit_info[framelist->head] = 0; 
     243 
     244        framelist->origin++; 
     245        framelist->head = (framelist->head + 1) % framelist->max_count; 
     246        framelist->size--; 
    175247         
    176248        return PJ_TRUE; 
    177  
    178249    } else { 
    179         pj_bzero(frame, framelist->flist_frame_size); 
     250        pj_bzero(frame, framelist->frame_size); 
     251 
    180252        return PJ_FALSE; 
    181253    } 
     
    183255 
    184256 
    185 static void jb_framelist_remove_head( jb_framelist_t *framelist, 
    186                                       unsigned count)  
    187 { 
    188     unsigned cur_size; 
    189  
    190     cur_size = jb_framelist_size(framelist); 
    191     if (count > cur_size)  
    192         count = cur_size; 
     257static unsigned jb_framelist_remove_head(jb_framelist_t *framelist, 
     258                                         unsigned count)  
     259{ 
     260    if (count > framelist->size)  
     261        count = framelist->size; 
    193262 
    194263    if (count) { 
    195         // may be done in two steps if overlapping 
     264        /* may be done in two steps if overlapping */ 
    196265        unsigned step1,step2; 
    197         unsigned tmp = framelist->flist_head+count; 
    198  
    199         if (tmp > framelist->flist_max_count) { 
    200             step1 = framelist->flist_max_count - framelist->flist_head; 
     266        unsigned tmp = framelist->head+count; 
     267 
     268        if (tmp > framelist->max_count) { 
     269            step1 = framelist->max_count - framelist->head; 
    201270            step2 = count-step1; 
    202271        } else { 
     
    205274        } 
    206275 
    207         pj_bzero(framelist->flist_buffer +  
    208                     framelist->flist_head * framelist->flist_frame_size, 
    209                   step1*framelist->flist_frame_size); 
    210         pj_memset(framelist->flist_frame_type+framelist->flist_head, 
     276        //pj_bzero(framelist->content +  
     277        //          framelist->head * framelist->frame_size, 
     278        //          step1*framelist->frame_size); 
     279        pj_memset(framelist->frame_type+framelist->head, 
    211280                  PJMEDIA_JB_MISSING_FRAME, 
    212                   step1*sizeof(framelist->flist_frame_type[0])); 
    213         pj_bzero(framelist->flist_content_len+framelist->flist_head, 
    214                   step1*sizeof(framelist->flist_content_len[0])); 
     281                  step1*sizeof(framelist->frame_type[0])); 
     282        pj_bzero(framelist->content_len+framelist->head, 
     283                  step1*sizeof(framelist->content_len[0])); 
    215284 
    216285        if (step2) { 
    217             pj_bzero( framelist->flist_buffer, 
    218                       step2*framelist->flist_frame_size); 
    219             pj_memset(framelist->flist_frame_type, 
     286            //pj_bzero( framelist->content, 
     287            //        step2*framelist->frame_size); 
     288            pj_memset(framelist->frame_type, 
    220289                      PJMEDIA_JB_MISSING_FRAME, 
    221                       step2*sizeof(framelist->flist_frame_type[0])); 
    222             pj_bzero (framelist->flist_content_len, 
    223                       step2*sizeof(framelist->flist_content_len[0])); 
    224         } 
    225  
    226         // update pointers 
    227         framelist->flist_origin += count; 
    228         framelist->flist_head = (framelist->flist_head + count) %  
    229                                 framelist->flist_max_count; 
    230         if (framelist->flist_head == framelist->flist_tail)  
    231             framelist->flist_empty = PJ_TRUE; 
    232     } 
    233 } 
    234  
    235  
    236 static pj_bool_t jb_framelist_put_at(jb_framelist_t *framelist, 
    237                                      unsigned index, 
    238                                      const void *frame, 
    239                                      unsigned frame_size, 
    240                                      pj_uint32_t bit_info) 
    241 { 
     290                      step2*sizeof(framelist->frame_type[0])); 
     291            pj_bzero (framelist->content_len, 
     292                      step2*sizeof(framelist->content_len[0])); 
     293        } 
     294 
     295        /* update states */ 
     296        framelist->origin += count; 
     297        framelist->head = (framelist->head + count) % framelist->max_count; 
     298        framelist->size -= count; 
     299    } 
     300     
     301    return count; 
     302} 
     303 
     304 
     305static pj_status_t jb_framelist_put_at(jb_framelist_t *framelist, 
     306                                       int index, 
     307                                       const void *frame, 
     308                                       unsigned frame_size, 
     309                                       pj_uint32_t bit_info) 
     310{ 
     311    int distance; 
    242312    unsigned where; 
    243  
    244     assert(frame_size <= framelist->flist_frame_size); 
    245  
    246     if (!framelist->flist_empty) { 
    247         unsigned max_index; 
    248         unsigned cur_size; 
    249  
    250         // too late 
    251         if (index < framelist->flist_origin)  
    252             return PJ_FALSE; 
    253  
    254         // too soon 
    255         max_index = framelist->flist_origin + framelist->flist_max_count - 1; 
    256         if (index > max_index) 
    257             return PJ_FALSE; 
    258  
    259         where = (index - framelist->flist_origin + framelist->flist_head) %  
    260                 framelist->flist_max_count; 
    261  
    262         // update framelist->flist_tail pointer 
    263         cur_size = jb_framelist_size(framelist); 
    264         if (index >= framelist->flist_origin + cur_size) { 
    265             unsigned diff = (index - (framelist->flist_origin + cur_size)); 
    266             framelist->flist_tail = (framelist->flist_tail + diff + 1) %  
    267                                     framelist->flist_max_count; 
    268         } 
    269     } else { 
    270         // check if frame is not too late, but watch out for sequence restart. 
    271         if (index < framelist->flist_origin &&  
    272             framelist->flist_origin - index < 0x7FFF)  
    273         { 
    274             return PJ_FALSE; 
    275         } 
    276  
    277         where = framelist->flist_tail; 
    278         framelist->flist_origin = index; 
    279         framelist->flist_tail = (framelist->flist_tail + 1) %  
    280                                 framelist->flist_max_count; 
    281         framelist->flist_empty = PJ_FALSE; 
    282     } 
    283  
    284     pj_memcpy(framelist->flist_buffer + where * framelist->flist_frame_size,  
     313    enum { MAX_MISORDER = 100 }; 
     314    enum { MAX_DROPOUT = 3000 }; 
     315 
     316    assert(frame_size <= framelist->frame_size); 
     317 
     318    /* too late or duplicated or sequence restart */ 
     319    if (index < framelist->origin) { 
     320        if (framelist->origin - index < MAX_MISORDER) { 
     321            /* too late or duplicated */ 
     322            return PJ_ETOOSMALL; 
     323        } else { 
     324            /* sequence restart */ 
     325            framelist->origin = index - framelist->size; 
     326        } 
     327    } 
     328 
     329    /* if jbuf is empty, just reset the origin */ 
     330    if (framelist->size == 0) { 
     331        framelist->origin = index; 
     332    } 
     333 
     334    /* get distance of this frame to the first frame in the buffer */ 
     335    distance = index - framelist->origin; 
     336 
     337    /* far jump, the distance is greater than buffer capacity */ 
     338    if (distance >= (int)framelist->max_count) { 
     339        if (distance > MAX_DROPOUT) { 
     340            /* jump too far, reset the buffer */ 
     341            jb_framelist_reset(framelist); 
     342            framelist->origin = index; 
     343            distance = 0; 
     344        } else { 
     345            /* otherwise, reject the frame */ 
     346            return PJ_ETOOMANY; 
     347        } 
     348    } 
     349 
     350    /* get the slot position */ 
     351    where = (framelist->head + distance) % framelist->max_count; 
     352 
     353    /* if the slot is occupied, it must be duplicated frame, ignore it. */ 
     354    if (framelist->frame_type[where] != PJMEDIA_JB_MISSING_FRAME) 
     355        return PJ_EEXISTS; 
     356 
     357    /* put the frame into the slot */ 
     358    pj_memcpy(framelist->content + where * framelist->frame_size, 
    285359              frame, frame_size); 
    286  
    287     framelist->flist_frame_type[where] = PJMEDIA_JB_NORMAL_FRAME; 
    288     framelist->flist_content_len[where] = frame_size; 
    289     framelist->flist_bit_info[where] = bit_info; 
    290  
    291     return PJ_TRUE; 
     360    framelist->frame_type[where] = PJMEDIA_JB_NORMAL_FRAME; 
     361    framelist->content_len[where] = frame_size; 
     362    framelist->bit_info[where] = bit_info; 
     363    if (framelist->origin + (int)framelist->size <= index) 
     364        framelist->size = distance + 1; 
     365 
     366    return PJ_SUCCESS; 
    292367} 
    293368 
     
    318393        return status; 
    319394 
    320     pj_strdup_with_null(pool, &jb->name, name); 
     395    pj_strdup_with_null(pool, &jb->jb_name, name); 
    321396    jb->jb_frame_size    = frame_size; 
    322397    jb->jb_frame_ptime   = ptime; 
    323     jb->jb_last_seq_no   = -1; 
    324     jb->jb_level         = 0; 
    325     jb->jb_last_op       = JB_OP_INIT; 
    326398    jb->jb_prefetch      = PJ_MIN(PJMEDIA_JB_DEFAULT_INIT_DELAY,max_count*4/5); 
    327     jb->jb_prefetch_cnt  = 0; 
    328399    jb->jb_min_prefetch  = 0; 
    329400    jb->jb_max_prefetch  = max_count*4/5; 
    330     jb->jb_stable_hist   = 0; 
    331     jb->jb_status        = JB_STATUS_INITIALIZING; 
    332     jb->jb_max_hist_level = 0; 
    333401    jb->jb_max_count     = max_count; 
    334402    jb->jb_min_shrink_gap= MIN_SHRINK_GAP_MSEC / ptime; 
    335  
     403    jb->jb_max_burst     = MAX_BURST_MSEC / ptime; 
    336404    pj_math_stat_init(&jb->jb_delay); 
     405    pj_math_stat_init(&jb->jb_burst); 
     406 
     407    pjmedia_jbuf_reset(jb); 
    337408 
    338409    *p_jb = jb; 
     
    383454PJ_DEF(pj_status_t) pjmedia_jbuf_reset(pjmedia_jbuf *jb) 
    384455{ 
    385     jb->jb_last_seq_no   = -1; 
    386456    jb->jb_level         = 0; 
    387457    jb->jb_last_op       = JB_OP_INIT; 
    388     jb->jb_prefetch_cnt  = 0; 
    389458    jb->jb_stable_hist   = 0; 
    390459    jb->jb_status        = JB_STATUS_INITIALIZING; 
    391     jb->jb_max_hist_level = 0; 
    392  
    393     jb_framelist_remove_head(&jb->jb_framelist,  
    394                              jb_framelist_size(&jb->jb_framelist)); 
    395  
    396     pj_math_stat_init(&jb->jb_delay); 
    397      
     460    jb->jb_init_cycle_cnt= 0; 
     461    jb->jb_max_hist_level= 0; 
     462 
     463    jb_framelist_reset(&jb->jb_framelist); 
     464 
    398465    return PJ_SUCCESS; 
    399466} 
     
    402469PJ_DEF(pj_status_t) pjmedia_jbuf_destroy(pjmedia_jbuf *jb) 
    403470{ 
     471    TRACE__((jb->jb_name.ptr, "\n" 
     472            "  JB summary:\n" 
     473            "    size=%d prefetch=%d\n" 
     474            "    delay (min/max/avg/dev)=%d/%d/%d/%d ms\n" 
     475            "    burst (min/max/avg/dev)=%d/%d/%d/%d frames\n" 
     476            "    lost=%d discard=%d empty=%d\n", 
     477            jb->jb_framelist.size, jb->jb_prefetch, 
     478            jb->jb_delay.min, jb->jb_delay.max, jb->jb_delay.mean,  
     479            pj_math_stat_get_stddev(&jb->jb_delay), 
     480            jb->jb_burst.min, jb->jb_burst.max, jb->jb_burst.mean,  
     481            pj_math_stat_get_stddev(&jb->jb_burst), 
     482            jb->jb_lost, jb->jb_discard, jb->jb_empty)); 
     483 
    404484    return jb_framelist_destroy(&jb->jb_framelist); 
    405485} 
     
    411491 
    412492    cur_size = jb_framelist_size(&jb->jb_framelist); 
    413  
    414     /* Only apply burst-level calculation on PUT operation since if VAD is  
    415      * active the burst-level may not be accurate. 
     493    pj_math_stat_update(&jb->jb_burst, jb->jb_level); 
     494    jb->jb_max_hist_level = PJ_MAX(jb->jb_max_hist_level, jb->jb_level); 
     495 
     496    /* Burst level is decreasing */ 
     497    if (jb->jb_level < jb->jb_prefetch) { 
     498 
     499        enum { STABLE_HISTORY_LIMIT = 100 }; 
     500         
     501        jb->jb_stable_hist++; 
     502         
     503        /* Only update the prefetch if 'stable' condition is reached  
     504         * (not just short time impulse) 
     505         */ 
     506        if (jb->jb_stable_hist > STABLE_HISTORY_LIMIT) { 
     507         
     508            diff = (jb->jb_prefetch - jb->jb_max_hist_level) / 3; 
     509 
     510            if (diff < 1) 
     511                diff = 1; 
     512 
     513            jb->jb_prefetch -= diff; 
     514            if (jb->jb_prefetch < jb->jb_min_prefetch)  
     515                jb->jb_prefetch = jb->jb_min_prefetch; 
     516 
     517            /* Reset history */ 
     518            jb->jb_max_hist_level = 0; 
     519            jb->jb_stable_hist = 0; 
     520 
     521            TRACE__((jb->jb_name.ptr,"jb updated(1), prefetch=%d, size=%d", 
     522                     jb->jb_prefetch, cur_size)); 
     523        } 
     524    } 
     525 
     526    /* Burst level is increasing */ 
     527    else if (jb->jb_level > jb->jb_prefetch) { 
     528 
     529        /* Instaneous set prefetch to recent maximum level (max_hist_level) */ 
     530        jb->jb_prefetch = PJ_MIN(jb->jb_max_hist_level, 
     531                                 (int)(jb->jb_max_count*4/5)); 
     532        if (jb->jb_prefetch > jb->jb_max_prefetch) 
     533            jb->jb_prefetch = jb->jb_max_prefetch; 
     534 
     535        jb->jb_stable_hist = 0; 
     536        /* Do not reset max_hist_level. */ 
     537        //jb->jb_max_hist_level = 0; 
     538 
     539        TRACE__((jb->jb_name.ptr,"jb updated(2), prefetch=%d, size=%d",  
     540                 jb->jb_prefetch, cur_size)); 
     541    } 
     542 
     543    /* Level is unchanged */ 
     544    else { 
     545        jb->jb_stable_hist = 0; 
     546    } 
     547} 
     548 
     549PJ_INLINE(void) jbuf_update(pjmedia_jbuf *jb, int oper) 
     550{ 
     551    int diff, burst_level; 
     552 
     553    if(jb->jb_last_op != oper) { 
     554        jb->jb_last_op = oper; 
     555 
     556        if (jb->jb_status == JB_STATUS_INITIALIZING) { 
     557            /* Switch status 'initializing' -> 'processing' after some OP  
     558             * switch cycles and current OP is GET (burst level is calculated  
     559             * based on PUT burst), so burst calculation is guaranted to be 
     560             * performed right after the status switching. 
     561             */ 
     562            if (++jb->jb_init_cycle_cnt >= INIT_CYCLE && oper == JB_OP_GET) { 
     563                jb->jb_status = JB_STATUS_PROCESSING; 
     564            } else { 
     565                jb->jb_level = 0; 
     566                return; 
     567            } 
     568        } 
     569 
     570        /* Perform jitter calculation based on PUT burst-level only, since  
     571         * GET burst-level may not be accurate, e.g: when VAD is active. 
     572         * Note that when burst-level is too big, i.e: exceeds jb_max_burst, 
     573         * the GET op may be idle, in this case, we better skip the jitter  
     574         * calculation. 
     575         */ 
     576        if (oper == JB_OP_GET && jb->jb_level < jb->jb_max_burst) 
     577            jbuf_calculate_jitter(jb); 
     578 
     579        jb->jb_level = 0; 
     580    } 
     581 
     582    /* These code is used for shortening the delay in the jitter buffer. 
     583     * It needs shrink only when there is possibility of drift. Drift 
     584     * detection is performed by inspecting the jitter buffer size, if 
     585     * its size is twice of current burst level, there can be drift. 
     586     * 
     587     * Moreover, normally drift level is quite low, so JB shouldn't need 
     588     * to shrink aggresively, it will shrink maximum one frame per  
     589     * MIN_SHRINK_GAP_MSEC ms. Theoritically, JB may handle drift level  
     590     * as much as = FRAME_PTIME/MIN_SHRINK_GAP_MSEC * 100% 
     591     * 
     592     * Whenever there is drift, where PUT > GET, this method will keep  
     593     * the latency (JB size) as much as twice of burst level. 
    416594     */ 
    417     if (jb->jb_last_op == JB_OP_PUT) { 
    418  
    419         jb->jb_max_hist_level = PJ_MAX(jb->jb_max_hist_level,jb->jb_level); 
    420  
    421         /* Level is decreasing */ 
    422         if (jb->jb_level < jb->jb_prefetch) { 
    423  
    424             enum { STABLE_HISTORY_LIMIT = 100 }; 
    425              
    426             jb->jb_stable_hist++; 
    427              
    428             /* Only update the prefetch if 'stable' condition is reached  
    429              * (not just short time impulse) 
    430              */ 
    431             if (jb->jb_stable_hist > STABLE_HISTORY_LIMIT) { 
    432                  
    433                 diff = (jb->jb_prefetch - jb->jb_max_hist_level) / 3; 
    434  
    435                 if (diff < 1) 
    436                     diff = 1; 
    437  
    438                 /* Update max_hist_level. */ 
    439                 jb->jb_max_hist_level = jb->jb_prefetch; 
    440  
    441                 jb->jb_prefetch -= diff; 
    442                 if (jb->jb_prefetch < jb->jb_min_prefetch)  
    443                     jb->jb_prefetch = jb->jb_min_prefetch; 
    444  
    445                 jb->jb_stable_hist = 0; 
    446  
    447                 TRACE__((jb->name.ptr,"jb updated(1), prefetch=%d, size=%d",  
    448                          jb->jb_prefetch, cur_size)); 
    449             } 
    450         } 
    451  
    452         /* Level is increasing */ 
    453         else if (jb->jb_level > jb->jb_prefetch) { 
    454  
    455             /* Instaneous set prefetch */ 
    456             jb->jb_prefetch = PJ_MIN(jb->jb_max_hist_level, 
    457                                      (int)(jb->jb_max_count*4/5)); 
    458             if (jb->jb_prefetch > jb->jb_max_prefetch) 
    459                 jb->jb_prefetch = jb->jb_max_prefetch; 
    460  
    461             jb->jb_stable_hist = 0; 
    462             // Keep max_hist_level. 
    463             //jb->jb_max_hist_level = 0; 
    464  
    465             TRACE__((jb->name.ptr,"jb updated(2), prefetch=%d, size=%d",  
    466                      jb->jb_prefetch, cur_size)); 
    467         } 
    468  
    469         /* Level is unchanged */ 
    470         else { 
    471             jb->jb_stable_hist = 0; 
    472         } 
    473     } 
    474  
    475     /* These code is used for shortening the delay in the jitter buffer. */ 
    476     // Shrinking based on max_hist_level (recent max level). 
    477     //diff = cur_size - jb->jb_prefetch; 
    478     diff = cur_size - jb->jb_max_hist_level; 
    479     if (diff > SAFE_SHRINKING_DIFF &&  
    480         jb->jb_framelist.flist_origin-jb->jb_last_del_seq > jb->jb_min_shrink_gap) 
    481     { 
    482         /* Shrink slowly */ 
    483         diff = 1; 
    484  
    485         /* Drop frame(s)! */ 
    486         jb_framelist_remove_head(&jb->jb_framelist, diff); 
    487         jb->jb_last_del_seq = jb->jb_framelist.flist_origin; 
    488  
    489         pj_math_stat_update(&jb->jb_delay, cur_size - diff); 
    490  
    491         TRACE__((jb->name.ptr,  
    492                  "JB shrinking %d frame(s), size=%d", diff, 
    493                  jb_framelist_size(&jb->jb_framelist))); 
    494     } else { 
    495         pj_math_stat_update(&jb->jb_delay, cur_size); 
    496     } 
    497  
    498     jb->jb_level = 0; 
    499 } 
    500  
    501 PJ_INLINE(void) jbuf_update(pjmedia_jbuf *jb, int oper) 
    502 { 
    503     if(jb->jb_last_op != oper) { 
    504         jbuf_calculate_jitter(jb); 
    505         jb->jb_last_op = oper; 
     595 
     596    if (jb->jb_status != JB_STATUS_PROCESSING) 
     597        return; 
     598 
     599    burst_level = PJ_MAX(jb->jb_prefetch, jb->jb_level); 
     600    diff = jb_framelist_size(&jb->jb_framelist) - burst_level*2; 
     601 
     602    if (diff >= SAFE_SHRINKING_DIFF) { 
     603        /* Check and adjust jb_last_del_seq, in case there was seq restart */ 
     604        if (jb->jb_framelist.origin < jb->jb_last_del_seq) 
     605            jb->jb_last_del_seq = jb->jb_framelist.origin; 
     606 
     607        if (jb->jb_framelist.origin - jb->jb_last_del_seq >= 
     608            jb->jb_min_shrink_gap) 
     609        { 
     610            /* Shrink slowly, one frame per cycle */ 
     611            diff = 1; 
     612 
     613            /* Drop frame(s)! */ 
     614            diff = jb_framelist_remove_head(&jb->jb_framelist, diff); 
     615            jb->jb_last_del_seq = jb->jb_framelist.origin; 
     616            jb->jb_discard += diff; 
     617 
     618            TRACE__((jb->jb_name.ptr,  
     619                     "JB shrinking %d frame(s), cur size=%d", diff, 
     620                     jb_framelist_size(&jb->jb_framelist))); 
     621        } 
    506622    } 
    507623} 
     
    523639{ 
    524640    pj_size_t min_frame_size; 
    525     int seq_diff; 
    526  
    527     if (jb->jb_last_seq_no == -1)       { 
    528         jb->jb_last_seq_no = frame_seq - 1; 
    529     } 
    530  
    531     seq_diff = frame_seq - jb->jb_last_seq_no; 
    532     jb->jb_last_seq_no = PJ_MAX(jb->jb_last_seq_no, frame_seq); 
    533     if (seq_diff > 0) jb->jb_level += seq_diff; 
    534  
    535     if(jb->jb_status == JB_STATUS_INITIALIZING) { 
    536         jb->jb_status = JB_STATUS_PROCESSING; 
    537         jb->jb_level = 0; 
    538     } else { 
     641    int prev_size, cur_size; 
     642    pj_status_t status; 
     643 
     644    /* Get JB size before PUT */ 
     645    prev_size = jb_framelist_size(&jb->jb_framelist); 
     646     
     647    /* Attempt to store the frame */ 
     648    min_frame_size = PJ_MIN(frame_size, jb->jb_frame_size); 
     649    status = jb_framelist_put_at(&jb->jb_framelist, frame_seq, frame, 
     650                                 min_frame_size, bit_info); 
     651     
     652    /* Jitter buffer is full, cannot store the frame */ 
     653    while (status == PJ_ETOOMANY) { 
     654        unsigned removed; 
     655 
     656        removed = jb_framelist_remove_head(&jb->jb_framelist, 
     657                                           PJ_MAX(jb->jb_max_count/4, 1)); 
     658        status = jb_framelist_put_at(&jb->jb_framelist, frame_seq, frame, 
     659                                     min_frame_size, bit_info); 
     660 
     661        jb->jb_discard += removed; 
     662    } 
     663 
     664    /* Get JB size after PUT */ 
     665    cur_size = jb_framelist_size(&jb->jb_framelist); 
     666 
     667    /* Return the flag if this frame is discarded */ 
     668    if (discarded) 
     669        *discarded = (status != PJ_SUCCESS); 
     670 
     671    if (status == PJ_SUCCESS) { 
     672        if (jb->jb_status == JB_STATUS_PREFETCHING) { 
     673            TRACE__((jb->jb_name.ptr, "PUT prefetch_cnt=%d/%d",  
     674                     cur_size, jb->jb_prefetch)); 
     675            if (cur_size >= jb->jb_prefetch) 
     676                jb->jb_status = JB_STATUS_PROCESSING; 
     677        } 
     678        jb->jb_level += (cur_size > prev_size ? cur_size-prev_size : 1); 
    539679        jbuf_update(jb, JB_OP_PUT); 
    540     } 
    541  
    542     min_frame_size = PJ_MIN(frame_size, jb->jb_frame_size); 
    543     if (seq_diff > 0) { 
    544  
    545         while (jb_framelist_put_at(&jb->jb_framelist, frame_seq, frame, 
    546                                    min_frame_size, bit_info) == PJ_FALSE) 
    547         { 
    548             jb_framelist_remove_head(&jb->jb_framelist, 
    549                                      PJ_MAX(jb->jb_max_count/4,1) ); 
    550         } 
    551  
    552         if (jb->jb_prefetch_cnt < jb->jb_prefetch) { 
    553             jb->jb_prefetch_cnt += seq_diff; 
    554              
    555             TRACE__((jb->name.ptr, "PUT prefetch_cnt=%d/%d",  
    556                      jb->jb_prefetch_cnt, jb->jb_prefetch)); 
    557  
    558             if (jb->jb_status == JB_STATUS_PREFETCHING &&  
    559                 jb->jb_prefetch_cnt >= jb->jb_prefetch) 
    560             { 
    561                 jb->jb_status = JB_STATUS_PROCESSING; 
    562             } 
    563         } 
    564  
    565  
    566  
    567         if (discarded) 
    568             *discarded = PJ_FALSE; 
    569     } 
    570     else 
    571     { 
    572         pj_bool_t res; 
    573         res = jb_framelist_put_at(&jb->jb_framelist,frame_seq,frame, 
    574                                   min_frame_size, bit_info); 
    575         if (discarded) 
    576             *discarded = !res; 
    577     } 
     680    } else 
     681        jb->jb_discard++; 
    578682} 
    579683 
     
    597701                                     pj_uint32_t *bit_info) 
    598702{ 
    599     pjmedia_jb_frame_type ftype; 
    600  
    601     jb->jb_level++; 
    602  
    603     jbuf_update(jb, JB_OP_GET); 
    604  
    605     if (jb_framelist_size(&jb->jb_framelist) == 0) { 
    606         jb->jb_prefetch_cnt = 0; 
     703    int cur_size; 
     704 
     705    cur_size = jb_framelist_size(&jb->jb_framelist); 
     706 
     707    if (cur_size == 0) { 
     708        /* jitter buffer empty */ 
     709 
    607710        if (jb->jb_def_prefetch) 
    608711            jb->jb_status = JB_STATUS_PREFETCHING; 
    609     } 
    610  
    611     if (jb->jb_status == JB_STATUS_PREFETCHING &&  
    612         jb->jb_prefetch_cnt < jb->jb_prefetch) 
    613     { 
     712 
     713        //pj_bzero(frame, jb->jb_frame_size); 
     714        *p_frame_type = PJMEDIA_JB_ZERO_EMPTY_FRAME; 
     715        if (size) 
     716            *size = 0; 
     717 
     718        jb->jb_empty++; 
     719 
     720    } else if (jb->jb_status == JB_STATUS_PREFETCHING) { 
     721 
    614722        /* Can't return frame because jitter buffer is filling up 
    615723         * minimum prefetch. 
    616724         */ 
    617         pj_bzero(frame, jb->jb_frame_size); 
    618         if (jb_framelist_size(&jb->jb_framelist) == 0) 
    619             *p_frame_type = PJMEDIA_JB_ZERO_EMPTY_FRAME; 
    620         else 
    621             *p_frame_type = PJMEDIA_JB_ZERO_PREFETCH_FRAME; 
    622  
     725 
     726        //pj_bzero(frame, jb->jb_frame_size); 
     727        *p_frame_type = PJMEDIA_JB_ZERO_PREFETCH_FRAME; 
    623728        if (size) 
    624729            *size = 0; 
    625730 
    626         TRACE__((jb->name.ptr, "GET prefetch_cnt=%d/%d", 
    627                  jb->jb_prefetch_cnt, jb->jb_prefetch)); 
    628         return; 
    629     } 
    630  
    631     /* Retrieve a frame from frame list */ 
    632     if (jb_framelist_get(&jb->jb_framelist,frame,size,&ftype,bit_info) == 
    633         PJ_FALSE)  
    634     { 
    635         /* Can't return frame because jitter buffer is empty! */ 
    636         pj_bzero(frame, jb->jb_frame_size); 
    637         *p_frame_type = PJMEDIA_JB_ZERO_EMPTY_FRAME; 
    638         if (size) 
    639             *size = 0; 
    640  
    641         return; 
    642     } 
    643  
    644     /* We've successfully retrieved a frame from the frame list, but 
    645      * the frame could be a blank frame! 
    646      */ 
    647     if (ftype == PJMEDIA_JB_NORMAL_FRAME)  
    648         *p_frame_type   = PJMEDIA_JB_NORMAL_FRAME; 
    649     else  
    650         *p_frame_type   = PJMEDIA_JB_MISSING_FRAME; 
     731        TRACE__((jb->jb_name.ptr, "GET prefetch_cnt=%d/%d", 
     732                 cur_size, jb->jb_prefetch)); 
     733 
     734        jb->jb_empty++; 
     735 
     736    } else { 
     737 
     738        pjmedia_jb_frame_type ftype; 
     739        pj_bool_t res; 
     740 
     741        /* Retrieve a frame from frame list */ 
     742        res = jb_framelist_get(&jb->jb_framelist, frame, size, &ftype,  
     743                               bit_info); 
     744        pj_assert(res); 
     745 
     746        /* We've successfully retrieved a frame from the frame list, but 
     747         * the frame could be a blank frame! 
     748         */ 
     749        if (ftype == PJMEDIA_JB_NORMAL_FRAME) { 
     750            *p_frame_type = PJMEDIA_JB_NORMAL_FRAME; 
     751        } else { 
     752            *p_frame_type = PJMEDIA_JB_MISSING_FRAME; 
     753            jb->jb_lost++; 
     754        } 
     755 
     756        /* Calculate delay on the first GET */ 
     757        if (jb->jb_last_op == JB_OP_PUT) 
     758            pj_math_stat_update(&jb->jb_delay, cur_size * jb->jb_frame_ptime); 
     759    } 
     760 
     761    jb->jb_level++; 
     762    jbuf_update(jb, JB_OP_GET); 
    651763} 
    652764 
     
    660772 
    661773    state->frame_size = jb->jb_frame_size; 
    662     state->prefetch = jb->jb_prefetch; 
    663774    state->min_prefetch = jb->jb_min_prefetch; 
    664775    state->max_prefetch = jb->jb_max_prefetch; 
     776     
     777    state->prefetch = jb->jb_prefetch; 
    665778    state->size = jb_framelist_size(&jb->jb_framelist); 
    666     state->avg_delay = jb->jb_delay.mean * jb->jb_frame_ptime; 
    667     state->min_delay = jb->jb_delay.min * jb->jb_frame_ptime; 
    668     state->max_delay = jb->jb_delay.max * jb->jb_frame_ptime; 
    669     state->dev_delay = pj_math_stat_get_stddev(&jb->jb_delay) *  
    670                        jb->jb_frame_ptime; 
     779     
     780    state->avg_delay = jb->jb_delay.mean; 
     781    state->min_delay = jb->jb_delay.min; 
     782    state->max_delay = jb->jb_delay.max; 
     783    state->dev_delay = pj_math_stat_get_stddev(&jb->jb_delay); 
     784     
     785    state->avg_burst = jb->jb_burst.mean; 
     786    state->empty = jb->jb_empty; 
     787    state->discard = jb->jb_discard; 
     788    state->lost = jb->jb_lost; 
    671789 
    672790    return PJ_SUCCESS; 
  • pjproject/branches/1.0/pjmedia/src/test/jbuf_test.c

    r2394 r2788  
    2727#define JB_MAX_PREFETCH     10 
    2828#define JB_PTIME            20 
    29 #define JB_BUF_SIZE         20 
     29#define JB_BUF_SIZE         50 
    3030 
    3131#define REPORT 
    3232//#define PRINT_COMMENT 
    3333 
     34typedef struct test_param_t { 
     35    pj_bool_t adaptive; 
     36    unsigned init_prefetch; 
     37    unsigned min_prefetch; 
     38    unsigned max_prefetch; 
     39} test_param_t; 
     40 
     41typedef struct test_cond_t { 
     42    int burst; 
     43    int discard; 
     44    int lost; 
     45    int empty; 
     46    int delay;      /**< Maximum delay, in frames.          */ 
     47} test_cond_t; 
     48 
     49static pj_bool_t parse_test_headers(char *line, test_param_t *param,  
     50                               test_cond_t *cond) 
     51{ 
     52    char *p = line; 
     53 
     54    if (*p == '%') { 
     55        /* Test params. */ 
     56        char mode_st[16]; 
     57 
     58        sscanf(p+1, "%s %u %u %u", mode_st, &param->init_prefetch,  
     59               &param->min_prefetch, &param->max_prefetch); 
     60        param->adaptive = (pj_ansi_stricmp(mode_st, "adaptive") == 0); 
     61 
     62    } else if (*p == '!') { 
     63        /* Success condition. */ 
     64        char cond_st[16]; 
     65        unsigned cond_val; 
     66 
     67        sscanf(p+1, "%s %u", cond_st, &cond_val); 
     68        if (pj_ansi_stricmp(cond_st, "burst") == 0) 
     69            cond->burst = cond_val; 
     70        else if (pj_ansi_stricmp(cond_st, "delay") == 0) 
     71            cond->delay = cond_val; 
     72        else if (pj_ansi_stricmp(cond_st, "discard") == 0) 
     73            cond->discard = cond_val; 
     74        else if (pj_ansi_stricmp(cond_st, "empty") == 0) 
     75            cond->empty = cond_val; 
     76        else if (pj_ansi_stricmp(cond_st, "lost") == 0) 
     77            cond->lost = cond_val; 
     78 
     79    } else if (*p == '=') { 
     80        /* Test title. */ 
     81        ++p; 
     82        while (*p && isspace(*p)) ++p; 
     83        printf("%s", p); 
     84    } else { 
     85        /* Unknown header, perhaps this is the test data */ 
     86 
     87        /* Skip spaces */ 
     88        while (*p && isspace(*p)) ++p; 
     89 
     90        /* Test data started.*/ 
     91        if (*p != 0) 
     92            return PJ_FALSE; 
     93    } 
     94 
     95    return PJ_TRUE; 
     96} 
     97 
     98static pj_bool_t process_test_data(char data, pjmedia_jbuf *jb,  
     99                                   pj_uint16_t *seq, pj_uint16_t *last_seq) 
     100{ 
     101    char frame[1]; 
     102    char f_type; 
     103    pj_bool_t print_state = PJ_TRUE; 
     104    pj_bool_t data_eos = PJ_FALSE; 
     105 
     106    switch (toupper(data)) { 
     107    case 'G': /* Get */ 
     108        pjmedia_jbuf_get_frame(jb, frame, &f_type); 
     109        break; 
     110    case 'P': /* Put */ 
     111        pjmedia_jbuf_put_frame(jb, (void*)frame, 1, *seq); 
     112        *last_seq = *seq; 
     113        ++*seq; 
     114        break; 
     115    case 'L': /* Lost */ 
     116        *last_seq = *seq; 
     117        ++*seq; 
     118        printf("Lost\n"); 
     119        break; 
     120    case 'R': /* Sequence restarts */ 
     121        *seq = 1; 
     122        printf("Sequence restarting, from %u to %u\n", *last_seq, *seq); 
     123        break; 
     124    case 'J': /* Sequence jumps */ 
     125        (*seq) += 5000; 
     126        printf("Sequence jumping, from %u to %u\n", *last_seq, *seq); 
     127        break; 
     128    case 'D': /* Frame duplicated */ 
     129        pjmedia_jbuf_put_frame(jb, (void*)frame, 1, *seq - 1); 
     130        break; 
     131    case 'O': /* Old/late frame */ 
     132        pjmedia_jbuf_put_frame(jb, (void*)frame, 1, *seq - 10 - pj_rand()%40); 
     133        break; 
     134    case '.': /* End of test session. */ 
     135        data_eos = PJ_TRUE; 
     136        break; 
     137    default: 
     138        print_state = PJ_FALSE; 
     139        printf("Unknown test data '%c'\n", data); 
     140        break; 
     141    } 
     142 
     143    if (data_eos) 
     144        return PJ_FALSE; 
     145 
     146#ifdef REPORT 
     147    if (print_state) { 
     148        pjmedia_jb_state state; 
     149 
     150        pjmedia_jbuf_get_state(jb, &state); 
     151        printf("seq=%d\t%c\tsize=%d\tprefetch=%d\n",  
     152               *last_seq, toupper(data), state.size, state.prefetch); 
     153    } 
     154#endif 
     155 
     156    return PJ_TRUE; 
     157} 
     158 
    34159int jbuf_main(void) 
    35160{ 
    36     pjmedia_jbuf *jb; 
    37161    FILE *input = fopen("JBTEST.DAT", "rt"); 
    38     unsigned seq; 
    39     char line[1024 * 10], *p; 
    40     pj_pool_t *pool; 
    41     pjmedia_jb_state state; 
    42     pj_str_t jb_name = {"JBTEST", 6}; 
    43  
    44     pj_init(); 
    45     pool = pj_pool_create(mem, "JBPOOL", 256*16, 256*16, NULL); 
    46  
    47     pjmedia_jbuf_create(pool, &jb_name, 1, JB_PTIME, JB_BUF_SIZE, &jb); 
    48     pjmedia_jbuf_set_adaptive(jb, JB_INIT_PREFETCH, JB_MIN_PREFETCH,  
    49                               JB_MAX_PREFETCH); 
    50  
    51     while ((p=fgets(line, sizeof(line), input)) != NULL) { 
    52  
    53         while (*p && isspace(*p)) 
    54             ++p; 
    55  
    56         if (!*p) 
    57             continue; 
    58  
    59         if (*p == '#') { 
    60 #ifdef PRINT_COMMENT 
    61             printf("%s", p); 
    62 #endif 
    63             continue; 
    64         } 
    65  
     162    pj_bool_t data_eof = PJ_FALSE; 
     163    int old_log_level; 
     164    int rc = 0; 
     165 
     166    old_log_level = pj_log_get_level(); 
     167    pj_log_set_level(5); 
     168 
     169    while (rc == 0 && !data_eof) { 
     170        pj_str_t jb_name = {"JBTEST", 6}; 
     171        pjmedia_jbuf *jb; 
     172        pj_pool_t *pool; 
     173        pjmedia_jb_state state; 
     174        pj_uint16_t last_seq = 0; 
     175        pj_uint16_t seq = 1; 
     176        char line[1024], *p = NULL; 
     177 
     178        test_param_t param; 
     179        test_cond_t cond; 
     180 
     181        param.adaptive = PJ_TRUE; 
     182        param.init_prefetch = JB_INIT_PREFETCH; 
     183        param.min_prefetch = JB_MIN_PREFETCH; 
     184        param.max_prefetch = JB_MAX_PREFETCH; 
     185 
     186        cond.burst = -1; 
     187        cond.delay = -1; 
     188        cond.discard = -1; 
     189        cond.empty = -1; 
     190        cond.lost = -1; 
     191 
     192        printf("\n\n"); 
     193 
     194        /* Parse test session title, param, and conditions */ 
     195        do { 
     196            p = fgets(line, sizeof(line), input); 
     197        } while (p && parse_test_headers(line, &param, &cond)); 
     198 
     199        /* EOF test data */ 
     200        if (p == NULL) 
     201            break; 
     202 
     203        //printf("======================================================\n"); 
     204 
     205        /* Initialize test session */ 
     206        pool = pj_pool_create(mem, "JBPOOL", 256*16, 256*16, NULL); 
     207        pjmedia_jbuf_create(pool, &jb_name, 1, JB_PTIME, JB_BUF_SIZE, &jb); 
    66208        pjmedia_jbuf_reset(jb); 
    67         seq = 1; 
     209 
     210        if (param.adaptive) { 
     211            pjmedia_jbuf_set_adaptive(jb,  
     212                                      param.init_prefetch,  
     213                                      param.min_prefetch, 
     214                                      param.max_prefetch); 
     215        } else { 
     216            pjmedia_jbuf_set_fixed(jb, param.init_prefetch); 
     217        } 
    68218 
    69219#ifdef REPORT 
    70220        pjmedia_jbuf_get_state(jb, &state); 
    71221        printf("Initial\tsize=%d\tprefetch=%d\tmin.pftch=%d\tmax.pftch=%d\n",  
    72             state.size, state.prefetch, state.min_prefetch, state.max_prefetch); 
     222               state.size, state.prefetch, state.min_prefetch,  
     223               state.max_prefetch); 
    73224#endif 
    74225 
    75         while (*p) { 
     226 
     227        /* Test session start */ 
     228        while (1) { 
    76229            int c; 
    77             char frame[1]; 
    78             char f_type; 
    79230             
     231            /* Get next line of test data */ 
     232            if (!p || *p == 0) { 
     233                p = fgets(line, sizeof(line), input); 
     234                if (p == NULL) { 
     235                    data_eof = PJ_TRUE; 
     236                    break; 
     237                } 
     238            } 
     239 
     240            /* Get next char of test data */ 
    80241            c = *p++; 
     242 
     243            /* Skip spaces */ 
    81244            if (isspace(c)) 
    82245                continue; 
    83              
    84             if (c == '/') { 
    85                 putchar('\n'); 
    86  
    87                 while (*++p && *p != '/') 
    88                     putchar(*p); 
    89  
    90                 putchar('\n'); 
    91  
    92                 if (*++p == 0) 
    93                     break; 
    94  
     246 
     247            /* Print comment line */ 
     248            if (c == '#') { 
     249#ifdef PRINT_COMMENT 
     250                while (*p && isspace(*p)) ++p; 
     251                if (*p) printf("..%s", p); 
     252#endif 
     253                *p = 0; 
    95254                continue; 
    96255            } 
    97256 
    98             switch (toupper(c)) { 
    99             case 'G': 
    100                 pjmedia_jbuf_get_frame(jb, frame, &f_type); 
     257            /* Process test data */ 
     258            if (!process_test_data(c, jb, &seq, &last_seq)) 
    101259                break; 
    102             case 'P': 
    103                 pjmedia_jbuf_put_frame(jb, (void*)frame, 1, seq); 
    104                 seq++; 
    105                 break; 
    106             case 'L': 
    107                 seq++; 
    108                 printf("Lost\n"); 
    109                 break; 
    110             default: 
    111                 printf("Unknown character '%c'\n", c); 
    112                 break; 
    113             } 
    114  
    115 #ifdef REPORT 
    116             if (toupper(c) != 'L') { 
    117                 pjmedia_jbuf_get_state(jb, &state); 
    118                 printf("seq=%d\t%c\tsize=%d\tprefetch=%d\n",  
    119                        seq, toupper(c), state.size, state.prefetch); 
    120             } 
    121 #endif 
    122         } 
     260        } 
     261 
     262        /* Print JB states */ 
     263        pjmedia_jbuf_get_state(jb, &state); 
     264        printf("------------------------------------------------------\n"); 
     265        printf("Summary:\n"); 
     266        printf("  size=%d prefetch=%d\n", state.size, state.prefetch); 
     267        printf("  delay (min/max/avg/dev)=%d/%d/%d/%d ms\n", 
     268               state.min_delay, state.max_delay, state.avg_delay,  
     269               state.dev_delay); 
     270        printf("  lost=%d discard=%d empty=%d burst(avg)=%d\n",  
     271               state.lost, state.discard, state.empty, state.avg_burst); 
     272 
     273        /* Evaluate test session */ 
     274        if (cond.burst >= 0 && (int)state.avg_burst > cond.burst) { 
     275            printf("! 'Burst' should be %d, it is %d\n",  
     276                   cond.burst, state.avg_burst); 
     277            rc |= 1; 
     278        } 
     279        if (cond.delay >= 0 && (int)state.avg_delay/JB_PTIME > cond.delay) { 
     280            printf("! 'Delay' should be %d, it is %d\n",  
     281                   cond.delay, state.avg_delay/JB_PTIME); 
     282            rc |= 2; 
     283        } 
     284        if (cond.discard >= 0 && (int)state.discard > cond.discard) { 
     285            printf("! 'Discard' should be %d, it is %d\n", 
     286                   cond.discard, state.discard); 
     287            rc |= 4; 
     288        } 
     289        if (cond.empty >= 0 && (int)state.empty > cond.empty) { 
     290            printf("! 'Empty' should be %d, it is %d\n",  
     291                   cond.empty, state.empty); 
     292            rc |= 8; 
     293        } 
     294        if (cond.lost >= 0 && (int)state.lost > cond.lost) { 
     295            printf("! 'Lost' should be %d, it is %d\n",  
     296                   cond.lost, state.lost); 
     297            rc |= 16; 
     298        } 
     299 
     300        pjmedia_jbuf_destroy(jb); 
     301        pj_pool_release(pool); 
    123302    } 
    124303 
    125     pjmedia_jbuf_destroy(jb); 
    126  
    127     if (input != stdin) 
    128         fclose(input); 
    129  
    130     pj_pool_release(pool); 
    131     return 0; 
     304    fclose(input); 
     305    pj_log_set_level(old_log_level); 
     306 
     307    return rc; 
    132308} 
  • pjproject/branches/1.0/pjmedia/src/test/test.c

    r2394 r2788  
    6161    //rtp_test(&caching_pool.factory); 
    6262    //session_test (&caching_pool.factory); 
    63     //jbuf_main(); 
    64     mips_test(); 
     63    DO_TEST(jbuf_main()); 
     64    //DO_TEST(mips_test()); 
    6565 
    6666    PJ_LOG(3,(THIS_FILE," ")); 
    6767 
     68on_return: 
    6869    if (rc != 0) { 
    6970        PJ_LOG(3,(THIS_FILE,"Test completed with error(s)!")); 
     
    7374 
    7475    pj_caching_pool_destroy(&caching_pool); 
     76 
    7577    return rc; 
    7678} 
Note: See TracChangeset for help on using the changeset viewer.