Wireshark-users: Re: [Wireshark-users] Calculate Jitter
From: Lars Ruoff <[email protected]>
Date: Thu, 22 Feb 2007 17:43:40 +0100
Ok, let's do this step by step...
(and yes, i will copy this to the Wiki :-))

1)
RFC 3550 says:

If Si is the RTP timestamp from packet i, and Ri is the time of
arrival in RTP timestamp units for packet i, then for two packets
i and j, D may be expressed as

         D(i,j) = (Rj - Ri) - (Sj - Si) = (Rj - Sj) - (Ri - Si)

      The interarrival jitter SHOULD be calculated continuously as each
      data packet i is received from source SSRC_n, using this
      difference D for that packet and the previous packet i-1 in order
      of arrival (not necessarily in sequence), according to the formula

         J(i) = J(i-1) + (|D(i-1,i)| - J(i-1))/16

2)
Example file:
http://wiki.wireshark.org/SampleCaptures#head-6f6128a524888c86ee322aa7cbf0d7b7a8fdf353
file: aaa.pcap
In the second stream (SSRC = 932629361, codec = G.711...).

This is what we have in the packets and what we will use in the formula:
R0 = frame 624: frame.time = Jul  4, 2005 11:56:25.348411000
S0 = frame 624: rtp.timestamp = 1240
R1 = frame 625: frame.time = Jul  4, 2005 11:56:25.418358000
S1 = frame 625: rtp.timestamp = 1400
R2 = frame 626: frame.time = Jul  4, 2005 11:56:25.421891000
S2 = frame 626: rtp.timestamp = 1560

we also have rtp.p_type = ITU-T G.711 PCMA (8)
and thus we know sampling clock is 8000Hz and thus the unit of rtp.timestamp is 1/8000 sec = 0.000125 sec .

3)
Now the calculation:
frame 624:
J(0) = 0

frame 625:
D(0,1) = (R1 - R0) - (S1 - S0)
       = [in seconds] (.418358000 sec - .348411000 sec) - (1400 * 0.000125 sec - 1240 * 0.000125 sec)
       = 0.049947
J(1) = J(0) + (|D(0,1)| - J(0))/16
     = [in seconds] 0 + (|0.049947| - 0)/16
     = 0.0031216875

frame 626:
D(1,2) = (R2 - R1) - (S2 - S1)
       = [in seconds] (.421891000 sec - .418358000 sec) - (1560 * 0.000125 sec - 1400 * 0.000125 sec)
       = -0.016467
J(2) = J(1) + (|D(1,2)| - J(1))/16
     = [in seconds] 0.0031216875 + (|-0.016467| - 0.0031216875)/16
     = 0.00395576953125

etc.

best regards,
Lars Ruoff


Goran Štrok wrote:
In this example:
http://wiki.wireshark.org/SampleCaptures#head-6f6128a524888c86ee322aa7cbf0d7b7a8fdf353
file: aaa.pcap
In the second stream (SSRC = 932629361, codec = G.711...).
When I analyze this RTP stream I see:
first packet: delta = 0,00 ms; jitter = 0,00 ms
second packet: delta = 69,95 ms; jitter = 3,12 ms
third packet: delta = 3,53 ms; jitter = 3,96 ms
...

If I calculate this for second packet: J = (69,95 - 0) - (20 - 0) = 49,95 ms for third packet : J = (3,53 - 69,95) - (40 - 20) = - 86,42 ms
Something must be vrong here...
Please help.


------------------------------------------------------------------------

_______________________________________________
Wireshark-users mailing list
[email protected]
http://www.wireshark.org/mailman/listinfo/wireshark-users