From 9967a57587b9dcc1eeeaa710159447eb098380f3 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Fri, 20 Jan 2012 20:33:37 +0100 Subject: rtp: Add 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_BAD_FRAME. The application can now handle the GAP of missing audio. (e.g. by extrapolation) If TRAU frames are forwarded via RTP, bad frames are dropped, but frame counter and timestamp of RTP sender state is incremented. Conflicts: openbsc/src/libtrau/rtp_proxy.c [hfreyther: Merge without testcase, fix typo] --- openbsc/src/libtrau/rtp_proxy.c | 14 ++++++++++++++ openbsc/src/libtrau/trau_mux.c | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'openbsc') diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c index 52616a0be..82f4063b2 100644 --- a/openbsc/src/libtrau/rtp_proxy.c +++ b/openbsc/src/libtrau/rtp_proxy.c @@ -206,6 +206,7 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame) int payload_type; int payload_len; int duration; /* in samples */ + int is_bfi = 0; if (rs->tx_action != RTP_SEND_DOWNSTREAM) { /* initialize sequences */ @@ -236,6 +237,12 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame) payload_len = frame->data[0]; duration = RTP_GSM_DURATION; break; + case GSM_BAD_FRAME: + payload_type = 0; + payload_len = 0; + duration = RTP_GSM_DURATION; + is_bfi = 1; + break; default: DEBUGPC(DLMUX, "unsupported message type %d\n", frame->msg_type); @@ -248,6 +255,13 @@ int rtp_send_frame(struct rtp_socket *rs, struct gsm_data_frame *frame) return -EINVAL; } + if (is_bfi) { + /* In case of a bad frame, just count and drop packet. */ + rs->transmit.timestamp += duration; + rs->transmit.sequence++; + return 0; + } + msg = msgb_alloc(sizeof(struct rtp_hdr) + payload_len, "RTP-GSM"); if (!msg) return -ENOMEM; diff --git a/openbsc/src/libtrau/trau_mux.c b/openbsc/src/libtrau/trau_mux.c index 3831a80ad..b37c7650e 100644 --- a/openbsc/src/libtrau/trau_mux.c +++ b/openbsc/src/libtrau/trau_mux.c @@ -245,7 +245,10 @@ struct msgb *trau_decode_fr(uint32_t callref, i++; j++; } - frame->msg_type = GSM_TCHF_FRAME; + if (tf->c_bits[11]) /* BFI */ + frame->msg_type = GSM_BAD_FRAME; + else + frame->msg_type = GSM_TCHF_FRAME; frame->callref = callref; msgb_put(msg, sizeof(struct gsm_data_frame) + 33); -- cgit v1.2.3