summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-01-30 21:01:36 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-31 11:45:25 +0100
commitb281e4e6f4245749b3adb04bc86a962a2bbff9a9 (patch)
treec0813e8ef4bcb8a9e9b0a2910f11bb93b7733d5f
parenteacc9b92a15d541761ee6f77f9cdcf4983553bfe (diff)
mgcp/rtp: Base jitter calculation on input timestamps
So far, the jitter computation has been based on output timestamps. This patch uses the input timestamps instead and resets jitter computation on SSRC changes. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/src/libmgcp/mgcp_network.c6
-rw-r--r--openbsc/tests/mgcp/mgcp_test.ok156
2 files changed, 82 insertions, 80 deletions
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index 5363fb8de..8a5656a83 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -375,6 +375,7 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *sta
timestamp = ntohl(rtp_hdr->timestamp);
arrival_time = get_current_ts(rtp_end->rate);
ssrc = ntohl(rtp_hdr->ssrc);
+ transit = arrival_time - timestamp;
if (!state->initialized) {
state->in_stream.last_seq = seq - 1;
@@ -383,7 +384,7 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *sta
state->base_seq = seq;
state->initialized = 1;
state->jitter = 0;
- state->transit = arrival_time - timestamp;
+ state->transit = transit;
state->packet_duration = mgcp_rtp_packet_duration(endp, rtp_end);
state->out_stream = state->in_stream;
state->out_stream.last_timestamp = timestamp;
@@ -414,6 +415,8 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *sta
endp->conn_mode);
state->in_stream.ssrc = ssrc;
+ state->jitter = 0;
+ state->transit = transit;
if (rtp_end->force_constant_ssrc) {
int16_t delta_seq;
@@ -507,7 +510,6 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *sta
* Appendix A of RFC 3550. Timestamp and arrival_time have a 1/rate
* resolution.
*/
- transit = arrival_time - timestamp;
d = transit - state->transit;
state->transit = transit;
if (d < 0)
diff --git a/openbsc/tests/mgcp/mgcp_test.ok b/openbsc/tests/mgcp/mgcp_test.ok
index e383fb5b2..2c3011535 100644
--- a/openbsc/tests/mgcp/mgcp_test.ok
+++ b/openbsc/tests/mgcp/mgcp_test.ok
@@ -123,58 +123,58 @@ Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
Stats: Jitter = 15, Transit = 39
In TS: 34688, dTS: 0, Seq: 12
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 14, Transit = 39
+Stats: Jitter = 0, Transit = 4294934527
In TS: 34848, dTS: 160, Seq: 13
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 13, Transit = 39
+Stats: Jitter = 0, Transit = 4294934527
In TS: 35008, dTS: 160, Seq: 14
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 13, Transit = 40
+Stats: Jitter = 0, Transit = 4294934528
In TS: 35128, dTS: 120, Seq: 15
Out TS change: 120, dTS: 120, Seq change: 1, TS Err change: in +1, out +1
-Stats: Jitter = 14, Transit = 80
+Stats: Jitter = 2, Transit = 4294934568
In TS: 35288, dTS: 160, Seq: 16
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 13, Transit = 79
+Stats: Jitter = 2, Transit = 4294934567
In TS: 35448, dTS: 160, Seq: 17
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 13, Transit = 80
+Stats: Jitter = 2, Transit = 4294934568
In TS: 35768, dTS: 160, Seq: 19
Out TS change: 320, dTS: 160, Seq change: 2, TS Err change: in +0, out +0
-Stats: Jitter = 22, Transit = 4294967216
+Stats: Jitter = 12, Transit = 4294934408
In TS: 35928, dTS: 160, Seq: 20
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 20, Transit = 4294967215
+Stats: Jitter = 11, Transit = 4294934407
In TS: 36088, dTS: 160, Seq: 21
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 29, Transit = 4294967055
+Stats: Jitter = 20, Transit = 4294934247
In TS: 36088, dTS: 160, Seq: 21
Out TS change: 0, dTS: 160, Seq change: 0, TS Err change: in +0, out +0
-Stats: Jitter = 37, Transit = 4294967216
+Stats: Jitter = 29, Transit = 4294934408
In TS: 36248, dTS: 160, Seq: 22
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 35, Transit = 4294967215
+Stats: Jitter = 27, Transit = 4294934407
In TS: 36408, dTS: 160, Seq: 23
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 33, Transit = 4294967215
+Stats: Jitter = 26, Transit = 4294934407
In TS: 36568, dTS: 160, Seq: 23
Out TS change: 160, dTS: 160, Seq change: 0, TS Err change: in +1, out +1
-Stats: Jitter = 31, Transit = 4294967216
+Stats: Jitter = 24, Transit = 4294934408
In TS: 36728, dTS: 160, Seq: 24
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 29, Transit = 4294967215
+Stats: Jitter = 23, Transit = 4294934407
In TS: 36888, dTS: 160, Seq: 25
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 27, Transit = 4294967216
+Stats: Jitter = 21, Transit = 4294934408
In TS: 160000, dTS: 0, Seq: 1000
Out TS change: 12000, dTS: 12000, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 25, Transit = 4294967216
+Stats: Jitter = 0, Transit = 4294823296
In TS: 160160, dTS: 160, Seq: 1001
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 24, Transit = 4294967215
+Stats: Jitter = 0, Transit = 4294823295
In TS: 160320, dTS: 160, Seq: 1002
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 22, Transit = 4294967215
+Stats: Jitter = 0, Transit = 4294823295
Testing packet error detection.
Output SSRC changed to 11223344
In TS: 0, dTS: 0, Seq: 0
@@ -216,59 +216,59 @@ Stats: Jitter = 15, Transit = 39
Output SSRC changed to 10203040
In TS: 34688, dTS: 0, Seq: 12
Out TS change: 32968, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 2065, Transit = 4294934527
+Stats: Jitter = 0, Transit = 4294934527
In TS: 34848, dTS: 160, Seq: 13
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1936, Transit = 4294934527
+Stats: Jitter = 0, Transit = 4294934527
In TS: 35008, dTS: 160, Seq: 14
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1815, Transit = 4294934528
+Stats: Jitter = 0, Transit = 4294934528
In TS: 35128, dTS: 120, Seq: 15
Out TS change: 120, dTS: 120, Seq change: 1, TS Err change: in +1, out +1
-Stats: Jitter = 1704, Transit = 4294934568
+Stats: Jitter = 2, Transit = 4294934568
In TS: 35288, dTS: 160, Seq: 16
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1597, Transit = 4294934567
+Stats: Jitter = 2, Transit = 4294934567
In TS: 35448, dTS: 160, Seq: 17
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1498, Transit = 4294934568
+Stats: Jitter = 2, Transit = 4294934568
In TS: 35768, dTS: 160, Seq: 19
Out TS change: 320, dTS: 160, Seq change: 2, TS Err change: in +0, out +0
-Stats: Jitter = 1414, Transit = 4294934408
+Stats: Jitter = 12, Transit = 4294934408
In TS: 35928, dTS: 160, Seq: 20
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1326, Transit = 4294934407
+Stats: Jitter = 11, Transit = 4294934407
In TS: 36088, dTS: 160, Seq: 21
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1253, Transit = 4294934247
+Stats: Jitter = 20, Transit = 4294934247
In TS: 36088, dTS: 160, Seq: 21
Out TS change: 0, dTS: 160, Seq change: 0, TS Err change: in +0, out +0
-Stats: Jitter = 1185, Transit = 4294934408
+Stats: Jitter = 29, Transit = 4294934408
In TS: 36248, dTS: 160, Seq: 22
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1111, Transit = 4294934407
+Stats: Jitter = 27, Transit = 4294934407
In TS: 36408, dTS: 160, Seq: 23
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1041, Transit = 4294934407
+Stats: Jitter = 26, Transit = 4294934407
In TS: 36568, dTS: 160, Seq: 23
Out TS change: 160, dTS: 160, Seq change: 0, TS Err change: in +1, out +1
-Stats: Jitter = 976, Transit = 4294934408
+Stats: Jitter = 24, Transit = 4294934408
In TS: 36728, dTS: 160, Seq: 24
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 915, Transit = 4294934407
+Stats: Jitter = 23, Transit = 4294934407
In TS: 36888, dTS: 160, Seq: 25
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 858, Transit = 4294934408
+Stats: Jitter = 21, Transit = 4294934408
Output SSRC changed to 50607080
In TS: 160000, dTS: 0, Seq: 1000
Out TS change: 123112, dTS: 160, Seq change: 975, TS Err change: in +0, out +0
-Stats: Jitter = 7749, Transit = 4294823296
+Stats: Jitter = 0, Transit = 4294823296
In TS: 160160, dTS: 160, Seq: 1001
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 7264, Transit = 4294823295
+Stats: Jitter = 0, Transit = 4294823295
In TS: 160320, dTS: 160, Seq: 1002
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 6810, Transit = 4294823295
+Stats: Jitter = 0, Transit = 4294823295
Testing packet error detection, patch timestamps.
Output SSRC changed to 11223344
In TS: 0, dTS: 0, Seq: 0
@@ -300,69 +300,69 @@ Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
Stats: Jitter = 16, Transit = 4294967295
In TS: 1400, dTS: 120, Seq: 9
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +1, out +0
-Stats: Jitter = 15, Transit = 0
+Stats: Jitter = 17, Transit = 40
In TS: 1560, dTS: 160, Seq: 10
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 14, Transit = 0
+Stats: Jitter = 16, Transit = 40
In TS: 1720, dTS: 160, Seq: 11
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 13, Transit = 4294967295
+Stats: Jitter = 15, Transit = 39
Output SSRC changed to 10203040
In TS: 34688, dTS: 0, Seq: 12
Out TS change: 32968, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 2063, Transit = 4294934487
+Stats: Jitter = 0, Transit = 4294934527
In TS: 34848, dTS: 160, Seq: 13
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1934, Transit = 4294934487
+Stats: Jitter = 0, Transit = 4294934527
In TS: 35008, dTS: 160, Seq: 14
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1813, Transit = 4294934488
+Stats: Jitter = 0, Transit = 4294934528
In TS: 35128, dTS: 120, Seq: 15
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +1, out +0
-Stats: Jitter = 1700, Transit = 4294934488
+Stats: Jitter = 2, Transit = 4294934568
In TS: 35288, dTS: 160, Seq: 16
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1593, Transit = 4294934487
+Stats: Jitter = 2, Transit = 4294934567
In TS: 35448, dTS: 160, Seq: 17
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1494, Transit = 4294934488
+Stats: Jitter = 2, Transit = 4294934568
In TS: 35768, dTS: 160, Seq: 19
Out TS change: 320, dTS: 160, Seq change: 2, TS Err change: in +0, out +0
-Stats: Jitter = 1411, Transit = 4294934328
+Stats: Jitter = 12, Transit = 4294934408
In TS: 35928, dTS: 160, Seq: 20
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1322, Transit = 4294934327
+Stats: Jitter = 11, Transit = 4294934407
In TS: 36088, dTS: 160, Seq: 21
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1250, Transit = 4294934167
+Stats: Jitter = 20, Transit = 4294934247
In TS: 36088, dTS: 160, Seq: 21
Out TS change: 0, dTS: 160, Seq change: 0, TS Err change: in +0, out +0
-Stats: Jitter = 1182, Transit = 4294934328
+Stats: Jitter = 29, Transit = 4294934408
In TS: 36248, dTS: 160, Seq: 22
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1108, Transit = 4294934327
+Stats: Jitter = 27, Transit = 4294934407
In TS: 36408, dTS: 160, Seq: 23
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 1039, Transit = 4294934327
+Stats: Jitter = 26, Transit = 4294934407
In TS: 36568, dTS: 160, Seq: 23
Out TS change: 160, dTS: 160, Seq change: 0, TS Err change: in +1, out +1
-Stats: Jitter = 974, Transit = 4294934328
+Stats: Jitter = 24, Transit = 4294934408
In TS: 36728, dTS: 160, Seq: 24
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 913, Transit = 4294934327
+Stats: Jitter = 23, Transit = 4294934407
In TS: 36888, dTS: 160, Seq: 25
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 856, Transit = 4294934328
+Stats: Jitter = 21, Transit = 4294934408
Output SSRC changed to 50607080
In TS: 160000, dTS: 0, Seq: 1000
Out TS change: 123112, dTS: 160, Seq change: 975, TS Err change: in +0, out +0
-Stats: Jitter = 7747, Transit = 4294823216
+Stats: Jitter = 0, Transit = 4294823296
In TS: 160160, dTS: 160, Seq: 1001
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 7263, Transit = 4294823215
+Stats: Jitter = 0, Transit = 4294823295
In TS: 160320, dTS: 160, Seq: 1002
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 6809, Transit = 4294823215
+Stats: Jitter = 0, Transit = 4294823295
Testing packet error detection, patch SSRC, patch timestamps.
Output SSRC changed to 11223344
In TS: 0, dTS: 0, Seq: 0
@@ -394,65 +394,65 @@ Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
Stats: Jitter = 16, Transit = 4294967295
In TS: 1400, dTS: 120, Seq: 9
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +1, out +0
-Stats: Jitter = 15, Transit = 0
+Stats: Jitter = 17, Transit = 40
In TS: 1560, dTS: 160, Seq: 10
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 14, Transit = 0
+Stats: Jitter = 16, Transit = 40
In TS: 1720, dTS: 160, Seq: 11
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 13, Transit = 4294967295
+Stats: Jitter = 15, Transit = 39
In TS: 34688, dTS: 0, Seq: 12
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 12, Transit = 4294967295
+Stats: Jitter = 0, Transit = 4294934527
In TS: 34848, dTS: 160, Seq: 13
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 11, Transit = 4294967295
+Stats: Jitter = 0, Transit = 4294934527
In TS: 35008, dTS: 160, Seq: 14
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 11, Transit = 0
+Stats: Jitter = 0, Transit = 4294934528
In TS: 35128, dTS: 120, Seq: 15
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +1, out +0
-Stats: Jitter = 10, Transit = 0
+Stats: Jitter = 2, Transit = 4294934568
In TS: 35288, dTS: 160, Seq: 16
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 9, Transit = 4294967295
+Stats: Jitter = 2, Transit = 4294934567
In TS: 35448, dTS: 160, Seq: 17
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 9, Transit = 0
+Stats: Jitter = 2, Transit = 4294934568
In TS: 35768, dTS: 160, Seq: 19
Out TS change: 320, dTS: 160, Seq change: 2, TS Err change: in +0, out +0
-Stats: Jitter = 18, Transit = 4294967136
+Stats: Jitter = 12, Transit = 4294934408
In TS: 35928, dTS: 160, Seq: 20
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 17, Transit = 4294967135
+Stats: Jitter = 11, Transit = 4294934407
In TS: 36088, dTS: 160, Seq: 21
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 26, Transit = 4294966975
+Stats: Jitter = 20, Transit = 4294934247
In TS: 36088, dTS: 160, Seq: 21
Out TS change: 0, dTS: 160, Seq change: 0, TS Err change: in +0, out +0
-Stats: Jitter = 34, Transit = 4294967136
+Stats: Jitter = 29, Transit = 4294934408
In TS: 36248, dTS: 160, Seq: 22
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 32, Transit = 4294967135
+Stats: Jitter = 27, Transit = 4294934407
In TS: 36408, dTS: 160, Seq: 23
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 30, Transit = 4294967135
+Stats: Jitter = 26, Transit = 4294934407
In TS: 36568, dTS: 160, Seq: 23
Out TS change: 160, dTS: 160, Seq change: 0, TS Err change: in +1, out +1
-Stats: Jitter = 28, Transit = 4294967136
+Stats: Jitter = 24, Transit = 4294934408
In TS: 36728, dTS: 160, Seq: 24
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 27, Transit = 4294967135
+Stats: Jitter = 23, Transit = 4294934407
In TS: 36888, dTS: 160, Seq: 25
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 25, Transit = 4294967136
+Stats: Jitter = 21, Transit = 4294934408
In TS: 160000, dTS: 0, Seq: 1000
Out TS change: 12000, dTS: 12000, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 23, Transit = 4294967136
+Stats: Jitter = 0, Transit = 4294823296
In TS: 160160, dTS: 160, Seq: 1001
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 22, Transit = 4294967135
+Stats: Jitter = 0, Transit = 4294823295
In TS: 160320, dTS: 160, Seq: 1002
Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0
-Stats: Jitter = 21, Transit = 4294967135
+Stats: Jitter = 0, Transit = 4294823295
Done