summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libtrau
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2014-01-22 10:05:51 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-26 08:49:35 +0100
commit88012b6e870d100e7d97b91f44897ce2d136d486 (patch)
treeef10af6f30b99b10e828b68d51352b3663f4e7a6 /openbsc/src/libtrau
parent6419018e6809924d56d764ba195cbce4c57776f2 (diff)
Use 'defines' for length and duration of RTP payload
Diffstat (limited to 'openbsc/src/libtrau')
-rw-r--r--openbsc/src/libtrau/rtp_proxy.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index 4278fc6..94a5b2f 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -167,15 +167,21 @@ static int rtp_decode(struct msgb *msg, uint32_t callref, struct msgb **data)
switch (rtph->payload_type) {
case RTP_PT_GSM_FULL:
msg_type = GSM_TCHF_FRAME;
- if (payload_len != 33) {
+ if (payload_len != RTP_LEN_GSM_FULL) {
DEBUGPC(DLMUX, "received RTP full rate frame with "
- "payload length != 32 (len = %d)\n",
- payload_len);
+ "payload length != %d (len = %d)\n",
+ RTP_LEN_GSM_FULL, payload_len);
return -EINVAL;
}
break;
case RTP_PT_GSM_EFR:
msg_type = GSM_TCHF_FRAME_EFR;
+ if (payload_len != RTP_LEN_GSM_EFR) {
+ DEBUGPC(DLMUX, "received RTP extended full rate frame "
+ "with payload length != %d (len = %d)\n",
+ RTP_LEN_GSM_EFR, payload_len);
+ return -EINVAL;
+ }
break;
default:
DEBUGPC(DLMUX, "received RTP frame with unknown payload "
@@ -236,13 +242,13 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame)
switch (frame->msg_type) {
case GSM_TCHF_FRAME:
payload_type = RTP_PT_GSM_FULL;
- payload_len = 33;
- duration = 160;
+ payload_len = RTP_LEN_GSM_FULL;
+ duration = RTP_GSM_DURATION;
break;
case GSM_TCHF_FRAME_EFR:
payload_type = RTP_PT_GSM_EFR;
- payload_len = 31;
- duration = 160;
+ payload_len = RTP_LEN_GSM_EFR;
+ duration = RTP_GSM_DURATION;
break;
default:
DEBUGPC(DLMUX, "unsupported message type %d\n",