aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
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
parent6419018e6809924d56d764ba195cbce4c57776f2 (diff)
Use 'defines' for length and duration of RTP payload
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/rtp_proxy.h4
-rw-r--r--openbsc/src/libtrau/rtp_proxy.c20
2 files changed, 17 insertions, 7 deletions
diff --git a/openbsc/include/openbsc/rtp_proxy.h b/openbsc/include/openbsc/rtp_proxy.h
index 26cac0df4..52ffefd27 100644
--- a/openbsc/include/openbsc/rtp_proxy.h
+++ b/openbsc/include/openbsc/rtp_proxy.h
@@ -33,6 +33,10 @@
#define RTP_PT_GSM_HALF 96
#define RTP_PT_GSM_EFR 97
#define RTP_PT_AMR 98
+#define RTP_LEN_GSM_FULL 33
+#define RTP_LEN_GSM_HALF 15
+#define RTP_LEN_GSM_EFR 31
+#define RTP_GSM_DURATION 160
enum rtp_rx_action {
RTP_NONE,
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index 4278fc680..94a5b2f57 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",