summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-08-03 15:36:57 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-08-03 23:57:16 +0800
commit5c1e6cf5fc12c1668e2709f7040906f776d9cd49 (patch)
tree15d4d3f9a980d8cbc2076bfe625f002d57ed5458
parent89976e8285945d7bc389ec38f664412eee1ed8ca (diff)
mgcp: Only patch the header if we had a change in SSRC0.9.1
-rw-r--r--openbsc/include/openbsc/mgcp_internal.h1
-rw-r--r--openbsc/src/mgcp/mgcp_network.c13
2 files changed, 9 insertions, 5 deletions
diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h
index f6f8d6ebb..2d9629aa8 100644
--- a/openbsc/include/openbsc/mgcp_internal.h
+++ b/openbsc/include/openbsc/mgcp_internal.h
@@ -38,6 +38,7 @@ enum mgcp_connection_mode {
struct mgcp_rtp_state {
int initialized;
+ int patch;
uint32_t orig_ssrc;
uint32_t ssrc;
diff --git a/openbsc/src/mgcp/mgcp_network.c b/openbsc/src/mgcp/mgcp_network.c
index b5e2cddf8..2abc6b528 100644
--- a/openbsc/src/mgcp/mgcp_network.c
+++ b/openbsc/src/mgcp/mgcp_network.c
@@ -116,17 +116,20 @@ static void patch_and_count(struct mgcp_rtp_state *state, int payload, char *dat
state->ssrc = rtp_hdr->ssrc;
state->seq_offset = (state->seq_no + 1) - seq;
state->timestamp_offset = state->last_timestamp - timestamp;
+ state->patch = 1;
LOGP(DMGCP, LOGL_NOTICE, "The SSRC changed... SSRC: %u offset: %d\n",
state->ssrc, state->seq_offset);
}
/* apply the offset and store it back to the packet */
- seq += state->seq_offset;
- rtp_hdr->sequence = htons(seq);
- rtp_hdr->ssrc = state->orig_ssrc;
+ if (state->patch) {
+ seq += state->seq_offset;
+ rtp_hdr->sequence = htons(seq);
+ rtp_hdr->ssrc = state->orig_ssrc;
- timestamp += state->timestamp_offset;
- rtp_hdr->timestamp = htonl(timestamp);
+ timestamp += state->timestamp_offset;
+ rtp_hdr->timestamp = htonl(timestamp);
+ }
/* seq changed, now compare if we have lost something */
if (state->seq_no + 1u != seq)