aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp/mgcp_network.c
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 /openbsc/src/libmgcp/mgcp_network.c
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
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_network.c')
-rw-r--r--openbsc/src/libmgcp/mgcp_network.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index 5363fb8..8a5656a 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)