summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2012-01-20 20:33:37 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2013-07-29 12:34:07 +0200
commita9f011c244eb2190ee6f21c1f9666eedadbc705c (patch)
tree376f2ca3bb5af9a19cadf5f3bd7b1a0920bcc17a
parentd1dea065295f825e91cd7f04dc60bc35f4cdbd75 (diff)
Adding handling of BFI (Bad Frame Indicatior) of received TRAU frames
If a bad TRAU frame is received, it is forwarded to MNCC application as GSM_TCHF_BAD_FRAME. The application can now handle the GAP of missing audio. (e.g. with extrapolation) If TRAU frames are forwarded via RTP, bad frames are dropped, but frame counter and timestamp of RTP sender state is increased.
-rw-r--r--openbsc/include/openbsc/mncc.h1
-rw-r--r--openbsc/src/libmsc/mncc_sock.c6
-rw-r--r--openbsc/src/libtrau/rtp_proxy.c9
-rw-r--r--openbsc/src/libtrau/trau_mux.c5
4 files changed, 18 insertions, 3 deletions
diff --git a/openbsc/include/openbsc/mncc.h b/openbsc/include/openbsc/mncc.h
index 12a6ec833..7e3fd957c 100644
--- a/openbsc/include/openbsc/mncc.h
+++ b/openbsc/include/openbsc/mncc.h
@@ -99,6 +99,7 @@ struct gsm_call {
#define GSM_TCHF_FRAME 0x0300
#define GSM_TCHF_FRAME_EFR 0x0301
#define GSM_TCHF_FRAME_HR 0x0302
+#define GSM_TCHF_BAD_FRAME 0x03ff
#define MNCC_SOCKET_HELLO 0x0400
diff --git a/openbsc/src/libmsc/mncc_sock.c b/openbsc/src/libmsc/mncc_sock.c
index ad0f27f63..da69dae34 100644
--- a/openbsc/src/libmsc/mncc_sock.c
+++ b/openbsc/src/libmsc/mncc_sock.c
@@ -56,7 +56,8 @@ int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg)
* otherwise we send it through MNCC interface */
if (msg_type == GSM_TCHF_FRAME
|| msg_type == GSM_TCHF_FRAME_EFR
- || msg_type == GSM_TCHF_FRAME_HR) {
+ || msg_type == GSM_TCHF_FRAME_HR
+ || msg_type == GSM_TCHF_BAD_FRAME) {
struct gsm_trans *trans = trans_find_by_callref(net, mncc_in->callref);
if (trans && trans->cc.rs) {
@@ -72,7 +73,8 @@ int mncc_sock_from_cc(struct gsm_network *net, struct msgb *msg)
"but socket is gone\n", get_mncc_name(msg_type));
if (msg_type != GSM_TCHF_FRAME
&& msg_type != GSM_TCHF_FRAME_EFR
- && msg_type != GSM_TCHF_FRAME_HR) {
+ && msg_type != GSM_TCHF_FRAME_HR
+ && msg_type != GSM_TCHF_BAD_FRAME) {
/* release the request */
struct gsm_mncc mncc_out;
memset(&mncc_out, 0, sizeof(mncc_out));
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index 8ad248843..f19ae9331 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -264,6 +264,12 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame)
payload_len = 14;
duration = 160;
break;
+ case GSM_TCHF_BAD_FRAME:
+ /* in case of a bad frame, just count and drop packt */
+ duration = 160;
+ rs->transmit.timestamp += duration;
+ rs->transmit.sequence++;
+ break;
default:
DEBUGPC(DLMUX, "unsupported message type %d\n",
frame->msg_type);
@@ -291,6 +297,9 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame)
}
}
+ if (frame->msg_type == GSM_TCHF_BAD_FRAME)
+ return 0;
+
msg = msgb_alloc(sizeof(struct rtp_hdr) + payload_len, "RTP-GSM-FULL");
if (!msg)
return -ENOMEM;
diff --git a/openbsc/src/libtrau/trau_mux.c b/openbsc/src/libtrau/trau_mux.c
index ac410c3fc..cc33a0ca0 100644
--- a/openbsc/src/libtrau/trau_mux.c
+++ b/openbsc/src/libtrau/trau_mux.c
@@ -215,7 +215,10 @@ int trau_mux_input(struct gsm_e1_subslot *src_e1_ss,
i++;
j++;
}
- frame->msg_type = GSM_TCHF_FRAME;
+ if (tf.c_bits[11]) /* BFI */
+ frame->msg_type = GSM_TCHF_BAD_FRAME;
+ else
+ frame->msg_type = GSM_TCHF_FRAME;
frame->callref = ue->callref;
msgb_put(msg, sizeof(struct gsm_data_frame) + 33);
trau_tx_to_mncc(ue->net, msg);