summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2015-12-27 22:19:25 (UTC)
committerSylvain Munaut <tnt@246tNt.com>2015-12-27 22:19:25 (UTC)
commitf198259f57f868bc85726cbac3df47b143b0300f (patch)
treea6ae64d3b0a51fa7d433daf30bc097bf6ccd9ca6
parentb21bf53788397012f220311af61db8632efa059b (diff)
HACK for HR
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--openbsc/src/libtrau/rtp_proxy.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index 8c982c9..26bffef 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -147,6 +147,7 @@ static int rtp_decode(struct msgb *msg, uint32_t callref, struct msgb **data)
break;
case RTP_PT_GSM_HALF:
msg_type = GSM_TCHH_FRAME;
+ payload_len++;
if (payload_len != RTP_LEN_GSM_HALF) {
DEBUGPC(DLMUX, "received RTP half rate frame with "
"payload length != %d (len = %d)\n",
@@ -187,7 +188,12 @@ static int rtp_decode(struct msgb *msg, uint32_t callref, struct msgb **data)
*data0 = payload_len;
}
payload_out = msgb_put(new_msg, payload_len);
- memcpy(payload_out, payload, payload_len);
+ if (rtph->payload_type == RTP_PT_GSM_HALF) {
+ payload_out[0] = 0;
+ memcpy(payload_out + 1, payload, payload_len - 1);
+ } else {
+ memcpy(payload_out, payload, payload_len);
+ }
*data = new_msg;
return 0;
@@ -229,7 +235,7 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame)
break;
case GSM_TCHH_FRAME:
payload_type = RTP_PT_GSM_HALF;
- payload_len = RTP_LEN_GSM_HALF;
+ payload_len = RTP_LEN_GSM_HALF - 1;
duration = RTP_GSM_DURATION;
break;
case GSM_TCH_FRAME_AMR:
@@ -280,6 +286,8 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame)
payload = msgb_put(msg, payload_len);
if (frame->msg_type == GSM_TCH_FRAME_AMR)
memcpy(payload, frame->data + 1, payload_len);
+ else if (frame->msg_type == GSM_TCHH_FRAME)
+ memcpy(payload, frame->data + 1, payload_len);
else
memcpy(payload, frame->data, payload_len);
msgb_enqueue(&rss->tx_queue, msg);