Index: pjproject/trunk/pjmedia/build/Jbtest.dat
===================================================================
--- pjproject/trunk/pjmedia/build/Jbtest.dat	(revision 2578)
+++ pjproject/trunk/pjmedia/build/Jbtest.dat	(revision 2579)
@@ -1,62 +1,320 @@
-#
-###############################################################################
-# This test demonstrates situation where there is no jitter. 
-# Jitter should go the minimum configured value.
-###############################################################################
-#
-#PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG
-
-#
-###############################################################################
-# This test demonstrates situation where there is no jitter, but with
-# addition of silence compression. The jitter value should also go
-# to the minimum.
-###############################################################################
-#
-#PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG /* Start silence */ GGGGGGGGGGGGGGGGGGGGG /* End silence */ PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG
-
-#
-###############################################################################
-# This test demonstrates situation where there's about one-three packets jitter
-# in the network, without packet lost.
-###############################################################################
-#
-#PGPGPPGGPPGGPPGGGGPG PGPGPPGGPPPGGPPGGGPG PGPGPPGGPPPGGPPGGGPG PGPGPPGGPPGGPPPGGGPG PGPGPPGGPPGGPPPGGGPG
-
-#
-###############################################################################
-# Two gets two puts, no jitter
-###############################################################################
-#
-#PPGGPPGGPPGGPPGGPPGG PPGGPPGGPPGGPPGGPPGG PPGGPPGGPPGGPPGGPPGG PPGGPPGGPPGGPPGGPPGG PPGGPPGGPPGGPPGGPPGG
-
-#
-###############################################################################
-# Three gets three puts, no packet lost
-###############################################################################
-#
-#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
-
-
-#
-###############################################################################
-# Three gets three puts, with packet lost
-###############################################################################
-#
-#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
-
-
-#
-###############################################################################
-# Three gets three puts, then stable
-###############################################################################
-#
-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 
-
-#
-###############################################################################
-# Some jitter
-###############################################################################
-#
-#PGPGPGPGPG /*Some frames missing here*/ GG /*Some frames arrive*/ PPPG /*Normal*/ PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG
-
+= Ideal condition
+%adaptive 0 0 10
+!burst	    1
+!discard    0
+!lost	    0
+!empty	    0
+!delay	    1
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+.
+
+= DTX
+%adaptive 0 0 10
+!burst	    1
+!discard    0
+!lost	    0
+!empty	    20
+!delay	    1
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG
+# Start silence
+GGGGGGGGGGGGGGGGGGGG
+# End silence
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG
+.
+
+= Regular burst (three gets three puts)
+%adaptive 0 0 10
+!burst	    3
+!discard    0
+!lost	    0
+!empty	    0
+!delay	    3
+PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG
+PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG PPPGGGPPPGGGPPPGGG
+.
+
+= Random burst (no drift)
+%adaptive 0 0 10
+!burst	    4
+!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
+!lost	    0
+!empty	    4
+!delay	    4
+PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG 
+PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG 
+PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPP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GGPG PGGGGPPPGPPGPPPGGPGG 
+.
+
+= Random burst (with drift, PUT > GET)
+%adaptive 0 0 10
+!burst	    4
+!discard    68 <- number of PUT - GET, JB does shrinking by discarding frames
+!lost	    0
+!empty	    4
+!delay	    8  <- should be less than or equal to twice of burst
+P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG 
+P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG 
+P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG 
+P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG 
+P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG 
+P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG 
+P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG 
+P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG 
+P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG 
+P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG 
+P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG 
+P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG 
+P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG 
+P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPP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GG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG 
+P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG 
+P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG 
+P PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG P PGPGPPGGPPPPGGPGGGPG 
+P PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG P PGGGGPPPGPPGPPPGGPGG 
+.
+
+= Random burst (with drift, PUT < GET)
+%adaptive 0 0 10
+!burst	    4
+!discard    0
+!lost	    0
+!empty	    70 <- GET - PUT = 66, added 4 for tolerating empty caused by burst
+!delay	    4  <- should be less than or equal to burst
+G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG 
+G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG 
+G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG 
+G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG 
+G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG 
+G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG 
+G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG 
+G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG 
+G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG 
+G PGGGGPPPGPPGPP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+G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG 
+G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG 
+G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG 
+G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG 
+G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG 
+G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG 
+G PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG G PGGGGPPPGPPGPPPGGPGG 
+G PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG G PGPGPPGGPPPPGGPGGGPG 
+.
+
+= Packet lost
+%adaptive 0 0 10
+!burst	    1
+!discard    0
+!lost	    3
+!empty	    1
+!delay	    3
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG
+# Some losts
+LGPGPGLGPGPGPGLGPGPG
+# Normal
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG
+.
+
+= Sequence restart
+%adaptive 0 0 10
+!burst	    1
+!discard    0
+!lost	    0
+!empty	    0
+!delay	    1
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+# seq restarted after 120 PUTs (default MAX_MISORDER == 100)
+R
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+.
+
+= Duplicated frames
+= e.g.: some Forward Error Correction (FEC) methods.
+%adaptive 0 0 10
+!burst	    1
+!discard    40
+!lost	    0
+!empty	    0
+!delay	    1
+PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG
+PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG PDGPDGPDGPDGPDG
+.
+
+= Late frames
+%adaptive 0 0 10
+!burst	    1
+!discard    8  <- late frames are discarded + delay adaptation
+!lost	    4
+!empty	    4
+!delay	    4
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+# Suddenly there are some lost frames
+LGLGPGLGLGPG
+# Those lost frames are actually late (+misordered), here they come
+OOOO
+# Then back to normal
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG 
+.
+
+= PUT burst at the beginning
+%adaptive 0 0 10
+!burst	    1
+!discard    50 <- frames discarded for delay adaptation
+!lost	    0
+!empty	    0
+!delay	    25 <- average delay, JB is able to adapt the delay
+PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPP
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+.
+
+= Fixed mode prefetch 5, with two empty events
+%fixed 5
+!burst	    1
+!discard    0
+!lost	    0
+!empty	    10
+!delay	    5
+G
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+GGGGG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+.
+
+= Fixed mode prefetch 5, with random burst
+%fixed 5
+!burst	    3
+!discard    0
+!lost	    0
+!empty	    5
+!delay	    5
+PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG 
+PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG 
+PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG 
+PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG 
+PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG 
+PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG 
+PGPGPPGGPPPPGGPGGGPG PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPPPGGPGGGPG 
+PGGGGPPPGPPGPPPGGPGG PGPGPPGGPPGGPPPGGGPG PGGGGPPPGPPGPPPGGPGG 
+.
+
+= Fixed mode prefetch 10, PUT burst at the beginning
+%fixed 10
+!burst	    1
+!discard    35 <- frames discarded for delay adaptation
+!lost	    0
+!empty	    0
+!delay	    30 <- average delay
+PPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPP PPPPPPPPPP
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+PGPGPGPGPGPGPGPGPGPG PGPGPGPGPGPGPGPGPGPG PGPGPGPGPG
+.
Index: pjproject/trunk/pjmedia/src/test/jbuf_test.c
===================================================================
--- pjproject/trunk/pjmedia/src/test/jbuf_test.c	(revision 2578)
+++ pjproject/trunk/pjmedia/src/test/jbuf_test.c	(revision 2579)
@@ -27,106 +27,282 @@
 #define JB_MAX_PREFETCH	    10
 #define JB_PTIME	    20
-#define JB_BUF_SIZE	    20
+#define JB_BUF_SIZE	    50
 
 #define REPORT
 //#define PRINT_COMMENT
 
+typedef struct test_param_t {
+    pj_bool_t adaptive;
+    unsigned init_prefetch;
+    unsigned min_prefetch;
+    unsigned max_prefetch;
+} test_param_t;
+
+typedef struct test_cond_t {
+    int burst;
+    int discard;
+    int lost;
+    int empty;
+    int delay;	    /**< Maximum delay, in frames.	    */
+} test_cond_t;
+
+static pj_bool_t parse_test_headers(char *line, test_param_t *param, 
+			       test_cond_t *cond)
+{
+    char *p = line;
+
+    if (*p == '%') {
+	/* Test params. */
+	char mode_st[16];
+
+	sscanf(p+1, "%s %u %u %u", mode_st, &param->init_prefetch, 
+	       &param->min_prefetch, &param->max_prefetch);
+	param->adaptive = (stricmp(mode_st, "adaptive") == 0);
+
+    } else if (*p == '!') {
+	/* Success condition. */
+	char cond_st[16];
+	unsigned cond_val;
+
+	sscanf(p+1, "%s %u", cond_st, &cond_val);
+	if (stricmp(cond_st, "burst") == 0)
+	    cond->burst = cond_val;
+	else if (stricmp(cond_st, "delay") == 0)
+	    cond->delay = cond_val;
+	else if (stricmp(cond_st, "discard") == 0)
+	    cond->discard = cond_val;
+	else if (stricmp(cond_st, "empty") == 0)
+	    cond->empty = cond_val;
+	else if (stricmp(cond_st, "lost") == 0)
+	    cond->lost = cond_val;
+
+    } else if (*p == '=') {
+	/* Test title. */
+	++p;
+	while (*p && isspace(*p)) ++p;
+	printf("%s", p);
+    } else {
+	/* Unknown header, perhaps this is the test data */
+
+	/* Skip spaces */
+	while (*p && isspace(*p)) ++p;
+
+	/* Test data started.*/
+	if (*p != 0)
+	    return PJ_FALSE;
+    }
+
+    return PJ_TRUE;
+}
+
+static pj_bool_t process_test_data(char data, pjmedia_jbuf *jb, 
+				   pj_uint16_t *seq, pj_uint16_t *last_seq)
+{
+    char frame[1];
+    char f_type;
+    pj_bool_t print_state = PJ_TRUE;
+    pj_bool_t data_eos = PJ_FALSE;
+
+    switch (toupper(data)) {
+    case 'G': /* Get */
+	pjmedia_jbuf_get_frame(jb, frame, &f_type);
+	break;
+    case 'P': /* Put */
+	pjmedia_jbuf_put_frame(jb, (void*)frame, 1, *seq);
+	*last_seq = *seq;
+	++*seq;
+	break;
+    case 'L': /* Lost */
+	*last_seq = *seq;
+	++*seq;
+	printf("Lost\n");
+	break;
+    case 'R': /* Sequence restarts */
+	*seq = 1;
+	printf("Sequence restarting, from %u to %u\n", *last_seq, *seq);
+	break;
+    case 'J': /* Sequence jumps */
+	(*seq) += 5000;
+	printf("Sequence jumping, from %u to %u\n", *last_seq, *seq);
+	break;
+    case 'D': /* Frame duplicated */
+	pjmedia_jbuf_put_frame(jb, (void*)frame, 1, *seq - 1);
+	break;
+    case 'O': /* Old/late frame */
+	pjmedia_jbuf_put_frame(jb, (void*)frame, 1, *seq - 10 - pj_rand()%40);
+	break;
+    case '.': /* End of test session. */
+	data_eos = PJ_TRUE;
+	break;
+    default:
+	print_state = PJ_FALSE;
+	printf("Unknown test data '%c'\n", data);
+	break;
+    }
+
+    if (data_eos)
+	return PJ_FALSE;
+
+#ifdef REPORT
+    if (print_state) {
+	pjmedia_jb_state state;
+
+	pjmedia_jbuf_get_state(jb, &state);
+	printf("seq=%d\t%c\tsize=%d\tprefetch=%d\n", 
+	       *last_seq, toupper(data), state.size, state.prefetch);
+    }
+#endif
+
+    return PJ_TRUE;
+}
+
 int jbuf_main(void)
 {
-    pjmedia_jbuf *jb;
     FILE *input = fopen("JBTEST.DAT", "rt");
-    unsigned seq;
-    char line[1024 * 10], *p;
-    pj_pool_t *pool;
-    pjmedia_jb_state state;
-    pj_str_t jb_name = {"JBTEST", 6};
-
-    pj_init();
-    pool = pj_pool_create(mem, "JBPOOL", 256*16, 256*16, NULL);
-
-    pjmedia_jbuf_create(pool, &jb_name, 1, JB_PTIME, JB_BUF_SIZE, &jb);
-    pjmedia_jbuf_set_adaptive(jb, JB_INIT_PREFETCH, JB_MIN_PREFETCH, 
-			      JB_MAX_PREFETCH);
-
-    while ((p=fgets(line, sizeof(line), input)) != NULL) {
-
-	while (*p && isspace(*p))
-	    ++p;
-
-	if (!*p)
-	    continue;
-
-	if (*p == '#') {
-#ifdef PRINT_COMMENT
-	    printf("%s", p);
-#endif
-	    continue;
-	}
-
+    pj_bool_t data_eof = PJ_FALSE;
+    int old_log_level;
+    int rc = 0;
+
+    old_log_level = pj_log_get_level();
+    pj_log_set_level(5);
+
+    while (rc == 0 && !data_eof) {
+	pj_str_t jb_name = {"JBTEST", 6};
+	pjmedia_jbuf *jb;
+	pj_pool_t *pool;
+	pjmedia_jb_state state;
+	pj_uint16_t last_seq = 0;
+	pj_uint16_t seq = 1;
+	char line[1024], *p = NULL;
+
+	test_param_t param;
+	test_cond_t cond;
+
+	param.adaptive = PJ_TRUE;
+	param.init_prefetch = JB_INIT_PREFETCH;
+	param.min_prefetch = JB_MIN_PREFETCH;
+	param.max_prefetch = JB_MAX_PREFETCH;
+
+	cond.burst = -1;
+	cond.delay = -1;
+	cond.discard = -1;
+	cond.empty = -1;
+	cond.lost = -1;
+
+	printf("\n\n");
+
+	/* Parse test session title, param, and conditions */
+	do {
+	    p = fgets(line, sizeof(line), input);
+	} while (p && parse_test_headers(line, &param, &cond));
+
+	/* EOF test data */
+	if (p == NULL)
+	    break;
+
+	//printf("======================================================\n");
+
+	/* Initialize test session */
+	pool = pj_pool_create(mem, "JBPOOL", 256*16, 256*16, NULL);
+	pjmedia_jbuf_create(pool, &jb_name, 1, JB_PTIME, JB_BUF_SIZE, &jb);
 	pjmedia_jbuf_reset(jb);
-	seq = 1;
+
+	if (param.adaptive) {
+	    pjmedia_jbuf_set_adaptive(jb, 
+				      param.init_prefetch, 
+				      param.min_prefetch,
+				      param.max_prefetch);
+	} else {
+	    pjmedia_jbuf_set_fixed(jb, param.init_prefetch);
+	}
 
 #ifdef REPORT
 	pjmedia_jbuf_get_state(jb, &state);
 	printf("Initial\tsize=%d\tprefetch=%d\tmin.pftch=%d\tmax.pftch=%d\n", 
-	    state.size, state.prefetch, state.min_prefetch, state.max_prefetch);
+	       state.size, state.prefetch, state.min_prefetch, 
+	       state.max_prefetch);
 #endif
 
-	while (*p) {
+
+	/* Test session start */
+	while (1) {
 	    int c;
-	    char frame[1];
-	    char f_type;
 	    
+	    /* Get next line of test data */
+	    if (!p || *p == 0) {
+		p = fgets(line, sizeof(line), input);
+		if (p == NULL) {
+		    data_eof = PJ_TRUE;
+		    break;
+		}
+	    }
+
+	    /* Get next char of test data */
 	    c = *p++;
+
+	    /* Skip spaces */
 	    if (isspace(c))
 		continue;
-	    
-	    if (c == '/') {
-		putchar('\n');
-
-		while (*++p && *p != '/')
-		    putchar(*p);
-
-		putchar('\n');
-
-		if (*++p == 0)
-		    break;
-
+
+	    /* Print comment line */
+	    if (c == '#') {
+#ifdef PRINT_COMMENT
+		while (*p && isspace(*p)) ++p;
+		if (*p) printf("..%s", p);
+#endif
+		*p = 0;
 		continue;
 	    }
 
-	    switch (toupper(c)) {
-	    case 'G':
-		pjmedia_jbuf_get_frame(jb, frame, &f_type);
+	    /* Process test data */
+	    if (!process_test_data(c, jb, &seq, &last_seq))
 		break;
-	    case 'P':
-		pjmedia_jbuf_put_frame(jb, (void*)frame, 1, seq);
-		seq++;
-		break;
-	    case 'L':
-		seq++;
-		printf("Lost\n");
-		break;
-	    default:
-		printf("Unknown character '%c'\n", c);
-		break;
-	    }
-
-#ifdef REPORT
-	    if (toupper(c) != 'L') {
-		pjmedia_jbuf_get_state(jb, &state);
-		printf("seq=%d\t%c\tsize=%d\tprefetch=%d\n", 
-		       seq, toupper(c), state.size, state.prefetch);
-	    }
-#endif
-	}
+	}
+
+	/* Print JB states */
+	pjmedia_jbuf_get_state(jb, &state);
+	printf("------------------------------------------------------\n");
+	printf("Summary:\n");
+	printf("  size=%d prefetch=%d\n", state.size, state.prefetch);
+	printf("  delay (min/max/avg/dev)=%d/%d/%d/%d ms\n",
+	       state.min_delay, state.max_delay, state.avg_delay, 
+	       state.dev_delay);
+	printf("  lost=%d discard=%d empty=%d burst(avg)=%d\n", 
+	       state.lost, state.discard, state.empty, state.avg_burst);
+
+	/* Evaluate test session */
+	if (cond.burst >= 0 && (int)state.avg_burst > cond.burst) {
+	    printf("! 'Burst' should be %d, it is %d\n", 
+		   cond.burst, state.avg_burst);
+	    rc |= 1;
+	}
+	if (cond.delay >= 0 && (int)state.avg_delay/JB_PTIME > cond.delay) {
+	    printf("! 'Delay' should be %d, it is %d\n", 
+		   cond.delay, state.avg_delay/JB_PTIME);
+	    rc |= 2;
+	}
+	if (cond.discard >= 0 && (int)state.discard > cond.discard) {
+	    printf("! 'Discard' should be %d, it is %d\n",
+		   cond.discard, state.discard);
+	    rc |= 4;
+	}
+	if (cond.empty >= 0 && (int)state.empty > cond.empty) {
+	    printf("! 'Empty' should be %d, it is %d\n", 
+		   cond.empty, state.empty);
+	    rc |= 8;
+	}
+	if (cond.lost >= 0 && (int)state.lost > cond.lost) {
+	    printf("! 'Lost' should be %d, it is %d\n", 
+		   cond.lost, state.lost);
+	    rc |= 16;
+	}
+
+	pjmedia_jbuf_destroy(jb);
+	pj_pool_release(pool);
     }
 
-    pjmedia_jbuf_destroy(jb);
-
-    if (input != stdin)
-	fclose(input);
-
-    pj_pool_release(pool);
-    return 0;
+    fclose(input);
+    pj_log_set_level(old_log_level);
+
+    return rc;
 }
Index: pjproject/trunk/pjmedia/src/test/test.c
===================================================================
--- pjproject/trunk/pjmedia/src/test/test.c	(revision 2578)
+++ pjproject/trunk/pjmedia/src/test/test.c	(revision 2579)
@@ -61,9 +61,10 @@
     //rtp_test(&caching_pool.factory);
     //session_test (&caching_pool.factory);
-    //jbuf_main();
-    mips_test();
+    DO_TEST(jbuf_main());
+    //DO_TEST(mips_test());
 
     PJ_LOG(3,(THIS_FILE," "));
 
+on_return:
     if (rc != 0) {
 	PJ_LOG(3,(THIS_FILE,"Test completed with error(s)!"));
@@ -73,4 +74,5 @@
 
     pj_caching_pool_destroy(&caching_pool);
+
     return rc;
 }
