summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-03-14 09:41:18 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2013-07-29 12:39:40 +0200
commitbdd3c963fd327e91e5930f8dc67b52fe59a0cee1 (patch)
tree6786c14301f5e12852bb7197e5bcf0d317b4859d
parent8e67fa458d5717e44695f140519bc6f2cecff855 (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 decoded, which creates anoying noise. This patch drops these frames. It depends on the SIP endpoint how these 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 3fb8b455b..8f931cf24 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -291,27 +291,36 @@ 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 = 33;
duration = 160;
break;
case GSM_TCHF_FRAME_EFR:
+ if ((frame->data[0] >> 4) != 0xc)
+ goto bfi;
payload_type = (dynamic_pt) ? : RTP_PT_GSM_EFR;
payload_len = 31;
duration = 160;
break;
case GSM_TCHH_FRAME:
+ if ((frame->data[0] & 0xf0) != 0x00)
+ goto bfi;
payload_type = (dynamic_pt) ? : RTP_PT_GSM_HALF;
payload_len = 15;
duration = 160;
break;
case GSM_TCH_FRAME_AMR:
+ if ((frame->data[1] & 0x04) != 0x04)
+ goto bfi;
payload_type = (dynamic_pt) ? : RTP_PT_AMR;
payload_len = frame->data[0];
duration = 160;
amr = 1;
break;
case GSM_BAD_FRAME:
+bfi:
/* in case of a bad frame, just count and drop packt */
payload_type = 0;
payload_len = 0;