Changeset 2579


Ignore:
Timestamp:
Apr 6, 2009 5:13:33 PM (10 years ago)
Author:
nanang
Message:

Ticket #762: Updated JB test:

  • Added support for more scenarios, e.g: frame loss, late, sequence restart, etc.
  • Added automatic test result checks based on specified condition.
  • Updated test data.
Location:
pjproject/trunk/pjmedia
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/build/Jbtest.dat

    r65 r2579  
    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       3 
     188!empty      1 
     189!delay      3 
     190PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
     191# Some losts 
     192LGPGPGLGPGPGPGLGPGPG 
     193# Normal 
     194PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
     195. 
     196 
     197= Sequence restart 
     198%adaptive 0 0 10 
     199!burst      1 
     200!discard    0 
     201!lost       0 
     202!empty      0 
     203!delay      1 
     204PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     205PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     206PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     207PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     208# seq restarted after 120 PUTs (default MAX_MISORDER == 100) 
     209R 
     210PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     211PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     212. 
     213 
     214= Duplicated frames 
     215= e.g.: some Forward Error Correction (FEC) methods. 
     216%adaptive 0 0 10 
     217!burst      1 
     218!discard    40 
     219!lost       0 
     220!empty      0 
     221!delay      1 
     222PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG 
     223PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG 
     224. 
     225 
     226= Late frames 
     227%adaptive 0 0 10 
     228!burst      1 
     229!discard    8  <- late frames are discarded + delay adaptation 
     230!lost       4 
     231!empty      4 
     232!delay      4 
     233PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     234PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     235# Suddenly there are some lost frames 
     236LGLGPGLGLGPG 
     237# Those lost frames are actually late (+misordered), here they come 
     238OOOO 
     239# Then back to normal 
     240PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     241PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG  
     242. 
     243 
     244= PUT burst at the beginning 
     245%adaptive 0 0 10 
     246!burst      1 
     247!discard    50 <- frames discarded for delay adaptation 
     248!lost       0 
     249!empty      0 
     250!delay      25 <- average delay, JB is able to adapt the delay 
     251PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPP 
     252PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     253PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     254PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     255PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     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 
     266. 
     267 
     268= Fixed mode prefetch 5, with two empty events 
     269%fixed 5 
     270!burst      1 
     271!discard    0 
     272!lost       0 
     273!empty      10 
     274!delay      5 
     275G 
     276PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     277GGGGG 
     278PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     279. 
     280 
     281= Fixed mode prefetch 5, with random burst 
     282%fixed 5 
     283!burst      3 
     284!discard    0 
     285!lost       0 
     286!empty      5 
     287!delay      5 
     288PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     289PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     290PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     291PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     292PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     293PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     294PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG  
     295PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG  
     296. 
     297 
     298= Fixed mode prefetch 10, PUT burst at the beginning 
     299%fixed 10 
     300!burst      1 
     301!discard    35 <- frames discarded for delay adaptation 
     302!lost       0 
     303!empty      0 
     304!delay      30 <- average delay 
     305PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPP 
     306PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     307PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     308PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     309PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG 
     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 
     320. 
  • pjproject/trunk/pjmedia/src/test/jbuf_test.c

    r2394 r2579  
    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 = (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 (stricmp(cond_st, "burst") == 0) 
     69            cond->burst = cond_val; 
     70        else if (stricmp(cond_st, "delay") == 0) 
     71            cond->delay = cond_val; 
     72        else if (stricmp(cond_st, "discard") == 0) 
     73            cond->discard = cond_val; 
     74        else if (stricmp(cond_st, "empty") == 0) 
     75            cond->empty = cond_val; 
     76        else if (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/trunk/pjmedia/src/test/test.c

    r2394 r2579  
    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.