summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-03-14 09:41:18 +0100
committerIvan Kluchnikov <kluchnikovi@gmail.com>2014-05-06 17:22:24 +0400
commitbe097ca15534d3f197c2068cd302fd8d90c459a1 (patch)
tree23f0d1f90ff5dca0550b4cb306324b95ae9c54d3
parent0cdf92b63d50182e24413e1f45bc2d8befb21d5f (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 52abad0ce..0aa325d24 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -327,27 +327,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 = 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;
is_amr = 1;
break;
case GSM_BAD_FRAME:
+bfi:
payload_type = 0;
payload_len = 0;
duration = RTP_GSM_DURATION;