summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-03-14 09:41:18 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2015-12-27 20:23:22 +0100
commitd4cde09829cfce77a1dd553b5b8ad1074c93b9b6 (patch)
tree99d618801e17c7588e14850369bb68c905b784ef
parent4622fbe25d9a8a0d03e260f5d3fcf1669c996d00 (diff)
Drop bad speech frames rather than forwarding them via RTP
Some RTP endpoints may not check for bad frame indications, so a frame that is marked as bad may be still forwarded, which creates anoying noise. This patch drops these frames. It depends on the other RTP endpoint how dropped frames are handled. (insert silence, extrapolate speech...)
-rw-r--r--openbsc/src/libtrau/rtp_proxy.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index e29f26c..7c9f06c 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -302,26 +302,35 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame)
switch (frame->msg_type) {
case GSM_TCHF_FRAME:
+ if ((frame->data[0] >> 4) != 0xd)
+ goto bfi;
payload_type = RTP_PT_GSM_FULL;
payload_len = RTP_LEN_GSM_FULL;
duration = RTP_GSM_DURATION;
break;
case GSM_TCHF_FRAME_EFR:
+ if ((frame->data[0] >> 4) != 0xc)
+ goto bfi;
payload_type = (dynamic_pt) ? : RTP_PT_GSM_EFR;
payload_len = RTP_LEN_GSM_EFR;
duration = RTP_GSM_DURATION;
break;
case GSM_TCHH_FRAME:
+ if ((frame->data[0] & 0xf0) != 0x00)
+ goto bfi;
payload_type = (dynamic_pt) ? : RTP_PT_GSM_HALF;
payload_len = RTP_LEN_GSM_HALF;
duration = RTP_GSM_DURATION;
break;
case GSM_TCH_FRAME_AMR:
+ if ((frame->data[2] & 0x04) != 0x04)
+ goto bfi;
payload_type = (dynamic_pt) ? : RTP_PT_AMR;
payload_len = frame->data[0];
duration = RTP_GSM_DURATION;
break;
case GSM_BAD_FRAME:
+bfi:
payload_type = 0;
payload_len = 0;
duration = RTP_GSM_DURATION;