Skip to content

Commit 9253bb1

Browse files
author
Mychaela N. Falconia
committed
E1: change dummy fill frame generation method
In the absence of a proper TFO transform (TS 28.062 section C3.2.1.1), OsmoMGW-E1 inserts constant fill frames when there is no RTP input, or when RTP input fails conversion to TRAU-DL and thus does not enqueue anything to the I.460 mux. (We accept TW-TS-001 and TW-TS-002 from RTP side, but bad frames cannot be converted to TRAU-DL without a TFO transform.) Prior to the present change, this idle fill of the DL was done using fully hard-coded frames, i.e., the operation of converting the desired fill to TRAU-DL bit format was done once externally and the raw bit frames were hard-coded. Change this approach: use fill frames in RTP format provided by libosmocodec, and execute osmo_rtp2trau() followed by osmo_trau_frame_encode() in the fill frame output path just like we do for regular RTP to DL. Depends: libosmocore.git I2c510ac62a0786c137115c45eee7a48b9736265f Change-Id: I123f77295c56d61ff9aac5f5d64b25eca01e0d63
1 parent 6018cc4 commit 9253bb1

File tree

6 files changed

+40
-157
lines changed

6 files changed

+40
-157
lines changed

TODO-RELEASE

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
#library what description / commit summary line
1010
libosmocore bump_dep; workaround Bump libosmocore version dependency after I68328adb952ca8833ba047cb3b49ccc6f8a1f1b5
1111
has been merged to libosmocore.git; then remove my_msgb_copy_c wrapper function.
12+
libosmocodec bump_dep We depend on the additions of I2c510ac62a0786c137115c45eee7a48b9736265f

configure.ac

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ AC_SUBST(LIBRARY_DLSYM)
4545

4646

4747
PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.11.0)
48+
PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec >= 1.11.0)
4849
PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.11.0)
4950
PKG_CHECK_MODULES(LIBOSMOCTRL, libosmoctrl >= 1.11.0)
5051
PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 1.11.0)

src/libosmo-mgcp/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ AM_CPPFLAGS = \
77
AM_CFLAGS = \
88
-Wall \
99
$(LIBOSMOCORE_CFLAGS) \
10+
$(LIBOSMOCODEC_CFLAGS) \
1011
$(LIBOSMOGSM_CFLAGS) \
1112
$(LIBOSMOVTY_CFLAGS) \
1213
$(LIBOSMONETIF_CFLAGS) \

src/libosmo-mgcp/mgcp_e1.c

+35-157
Original file line numberDiff line numberDiff line change
@@ -57,149 +57,6 @@ static const struct e1inp_line_ops dummy_e1_line_ops = {
5757
.sign_link = NULL,
5858
};
5959

60-
/* The following EFR TRAU-DL frame is a dummy to be transmitted in the absence
61-
* of RTP-derived TRAU-DL frames. The payload bit content here is the decoder
62-
* homing frame (DHF) of TS 46.060 section 8.2 Table 7 - the best we can do
63-
* in the absence of a proper TFO transform for EFR - while the full TRAU-DL
64-
* frame was generated by passing said EFR DHF through osmo_rtp2trau().
65-
*/
66-
static const ubit_t idle_tf_efr[] = {
67-
0, 0, 0, 0, 0, 0, 0, 0,
68-
0, 0, 0, 0, 0, 0, 0, 0,
69-
1, 1, 1, 0, 1, 0, 0, 0,
70-
0, 0, 0, 0, 1, 1, 1, 1,
71-
1, 1, 0, 0, 0, 0, 1, 0,
72-
0, 0, 0, 1, 0, 1, 1, 1,
73-
1, 1, 0, 1, 0, 1, 1, 0,
74-
1, 0, 0, 1, 0, 0, 1, 0,
75-
1, 0, 0, 0, 1, 1, 1, 1,
76-
1, 0, 0, 1, 0, 1, 0, 1,
77-
1, 0, 1, 0, 1, 1, 0, 1,
78-
0, 1, 1, 0, 0, 0, 0, 0,
79-
1, 0, 0, 1, 1, 1, 1, 1,
80-
0, 0, 0, 1, 1, 1, 0, 1,
81-
1, 0, 0, 0, 0, 1, 1, 0,
82-
0, 0, 0, 1, 1, 0, 0, 0,
83-
1, 0, 0, 0, 1, 1, 1, 1,
84-
0, 1, 1, 0, 1, 1, 0, 0,
85-
1, 0, 0, 1, 1, 0, 0, 0,
86-
1, 0, 0, 0, 0, 1, 0, 1,
87-
1, 1, 0, 0, 0, 0, 0, 0,
88-
1, 0, 0, 0, 0, 0, 0, 0,
89-
1, 0, 1, 0, 0, 1, 0, 0,
90-
0, 0, 0, 0, 0, 0, 1, 0,
91-
1, 0, 1, 0, 1, 0, 1, 0,
92-
1, 1, 0, 0, 0, 0, 0, 0,
93-
1, 0, 0, 0, 0, 0, 0, 0,
94-
0, 0, 0, 0, 0, 0, 0, 0,
95-
1, 0, 0, 0, 0, 0, 0, 0,
96-
0, 0, 0, 0, 0, 0, 0, 0,
97-
1, 0, 0, 0, 0, 0, 0, 0,
98-
0, 0, 0, 0, 1, 1, 1, 0,
99-
1, 1, 1, 0, 1, 0, 1, 1,
100-
0, 0, 0, 0, 0, 0, 0, 0,
101-
1, 0, 0, 0, 0, 0, 0, 0,
102-
0, 0, 0, 0, 0, 0, 0, 0,
103-
1, 0, 0, 0, 0, 0, 0, 0,
104-
0, 0, 0, 0, 0, 0, 0, 0,
105-
1, 0, 0, 0, 1, 1, 1, 1,
106-
1, 1, 1, 1, 1, 1, 1, 1,
107-
};
108-
109-
/* The following FRv1 TRAU-DL frame is a dummy to be transmitted in the absence
110-
* of RTP-derived TRAU-DL frames. The payload bit content here is the silence
111-
* frame of TS 46.011 Table 1 - the best we can do without integrating the
112-
* TFO transform for FRv1 from Themyscira libgsmfr2 - while the full TRAU-DL
113-
* frame was generated by passing said FRv1 silence frame through
114-
* osmo_rtp2trau().
115-
*/
116-
static const ubit_t idle_tf_fr[] = {
117-
0, 0, 0, 0, 0, 0, 0, 0,
118-
0, 0, 0, 0, 0, 0, 0, 0,
119-
1, 1, 1, 1, 0, 0, 0, 0,
120-
0, 0, 0, 0, 1, 1, 1, 1,
121-
1, 0, 1, 0, 1, 0, 1, 1,
122-
1, 1, 0, 0, 1, 1, 0, 1,
123-
1, 0, 1, 0, 1, 0, 1, 0,
124-
1, 0, 0, 1, 0, 0, 1, 0,
125-
1, 1, 1, 0, 0, 1, 0, 0,
126-
0, 0, 1, 0, 1, 0, 0, 0,
127-
1, 1, 0, 0, 0, 0, 0, 0,
128-
0, 1, 1, 0, 0, 0, 1, 1,
129-
1, 1, 0, 0, 0, 1, 0, 0,
130-
1, 1, 1, 0, 1, 1, 0, 1,
131-
1, 1, 0, 1, 1, 0, 0, 0,
132-
1, 0, 0, 1, 1, 1, 0, 1,
133-
1, 1, 0, 0, 0, 0, 1, 0,
134-
1, 0, 0, 0, 1, 0, 0, 0,
135-
1, 0, 0, 0, 0, 1, 1, 0,
136-
0, 0, 1, 1, 1, 0, 0, 0,
137-
1, 1, 0, 0, 1, 1, 1, 0,
138-
1, 1, 0, 1, 1, 0, 1, 1,
139-
1, 0, 0, 0, 1, 0, 0, 1,
140-
1, 1, 0, 1, 1, 0, 0, 0,
141-
1, 0, 1, 0, 1, 0, 0, 0,
142-
1, 0, 0, 0, 0, 0, 0, 0,
143-
1, 1, 1, 0, 0, 0, 1, 1,
144-
1, 0, 0, 0, 1, 0, 0, 1,
145-
1, 1, 1, 0, 1, 1, 0, 1,
146-
1, 0, 1, 1, 0, 0, 0, 1,
147-
1, 0, 0, 1, 1, 1, 0, 1,
148-
1, 0, 0, 0, 0, 1, 0, 1,
149-
1, 0, 0, 0, 1, 0, 0, 0,
150-
0, 0, 0, 0, 1, 1, 0, 0,
151-
1, 0, 1, 1, 1, 0, 0, 0,
152-
1, 0, 0, 1, 1, 1, 0, 1,
153-
1, 1, 0, 1, 1, 0, 1, 1,
154-
0, 0, 0, 1, 0, 0, 1, 1,
155-
1, 1, 0, 1, 1, 0, 1, 1,
156-
1, 1, 1, 1, 1, 1, 1, 1,
157-
};
158-
159-
/* Idle speech frame, see also GSM 08.60, chapter 3.4 */
160-
static const ubit_t idle_tf_spch[] = {
161-
0, 0, 0, 0, 0, 0, 0, 0,
162-
0, 0, 0, 0, 0, 0, 0, 0,
163-
1, 0, 1, 1, 1, 0, 0, 0,
164-
0, 0, 0, 0, 1, 0, 0, 0,
165-
1, 1, 1, 1, 1, 1, 1, 1,
166-
1, 1, 1, 1, 1, 1, 1, 1,
167-
1, 1, 1, 1, 1, 1, 1, 1,
168-
1, 1, 1, 1, 1, 1, 1, 1,
169-
1, 1, 1, 1, 1, 1, 1, 1,
170-
1, 1, 1, 1, 1, 1, 1, 1,
171-
1, 1, 1, 1, 1, 1, 1, 1,
172-
1, 1, 1, 1, 1, 1, 1, 1,
173-
1, 1, 1, 1, 1, 1, 1, 1,
174-
1, 1, 1, 1, 1, 1, 1, 1,
175-
1, 1, 1, 1, 1, 1, 1, 1,
176-
1, 1, 1, 1, 1, 1, 1, 1,
177-
1, 1, 1, 1, 1, 1, 1, 1,
178-
1, 1, 1, 1, 1, 1, 1, 1,
179-
1, 1, 1, 1, 1, 1, 1, 1,
180-
1, 1, 1, 1, 1, 1, 1, 1,
181-
1, 1, 1, 1, 1, 1, 1, 1,
182-
1, 1, 1, 1, 1, 1, 1, 1,
183-
1, 1, 1, 1, 1, 1, 1, 1,
184-
1, 1, 1, 1, 1, 1, 1, 1,
185-
1, 1, 1, 1, 1, 1, 1, 1,
186-
1, 1, 1, 1, 1, 1, 1, 1,
187-
1, 1, 1, 1, 1, 1, 1, 1,
188-
1, 1, 1, 1, 1, 1, 1, 1,
189-
1, 1, 1, 1, 1, 1, 1, 1,
190-
1, 1, 1, 1, 1, 1, 1, 1,
191-
1, 1, 1, 1, 1, 1, 1, 1,
192-
1, 1, 1, 1, 1, 1, 1, 1,
193-
1, 1, 1, 1, 1, 1, 1, 1,
194-
1, 1, 1, 1, 1, 1, 1, 1,
195-
1, 1, 1, 1, 1, 1, 1, 1,
196-
1, 1, 1, 1, 1, 1, 1, 1,
197-
1, 1, 1, 1, 1, 1, 1, 1,
198-
1, 1, 1, 1, 1, 1, 1, 1,
199-
1, 1, 1, 1, 1, 1, 1, 0,
200-
1, 1, 1, 1, 1, 1, 1, 1,
201-
};
202-
20360
/* If the RTP transmission has dropouts for some reason the I.460 TX-Queue may
20461
* run empty. In order to make sure that the TRAU frame transmission continues
20562
* we generate idle TRAU frames here. */
@@ -208,33 +65,54 @@ static void e1_i460_mux_empty_cb(struct osmo_i460_subchan *schan, void *user_dat
20865
struct mgcp_endpoint *endp = user_data;
20966
struct rate_ctr_group *rate_ctrs = endp->trunk->ratectr.e1_stats;
21067
struct msgb *msg = msgb_alloc_c(endp->trunk, E1_TRAU_BITS_MSGB, "E1-I.460-IDLE-TX-TRAU-frame");
211-
uint8_t *ptr;
212-
const uint8_t *ptr_ft;
213-
enum osmo_trau_frame_type ft;
68+
const uint8_t *dummy_fill_pl;
69+
unsigned dummy_fill_pl_len;
70+
struct osmo_trau_frame tf;
71+
int rc;
21472

21573
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, E1_I460_TRAU_MUX_EMPTY_CTR));
21674

217-
/* Choose an appropiate idle frame type */
218-
ft = endp->e1.trau_rtp_st->type;
219-
switch (ft) {
75+
/* choose dummy fill frame payload based on current codec */
76+
switch (endp->e1.trau_rtp_st->type) {
22077
case OSMO_TRAU16_FT_FR:
221-
ptr_ft = idle_tf_fr;
78+
dummy_fill_pl = osmo_gsm611_silence_frame;
79+
dummy_fill_pl_len = GSM_FR_BYTES;
22280
break;
22381
case OSMO_TRAU16_FT_EFR:
224-
ptr_ft = idle_tf_efr;
82+
dummy_fill_pl = osmo_gsm660_homing_frame;
83+
dummy_fill_pl_len = GSM_EFR_BYTES;
22584
break;
22685
default:
227-
/* FIXME: What about 8k subslots and AMR frames? */
228-
ptr_ft = idle_tf_spch;
86+
LOGPENDP(endp, DE1, LOGL_ERROR, "E1-I.460-IDLE-TX: unsupported frame type\n");
87+
goto skip;
22988
}
23089

231-
/* Put the replacement into a message buffer and enqueue it into the
232-
* I.460 multiplexer */
233-
ptr = msgb_put(msg, E1_TRAU_BITS);
234-
memcpy(ptr, ptr_ft, E1_TRAU_BITS);
90+
/* turn it into a TRAU-DL frame */
91+
memset(&tf, 0, sizeof(tf));
92+
tf.dir = OSMO_TRAU_DIR_DL;
93+
rc = osmo_rtp2trau(&tf, dummy_fill_pl, dummy_fill_pl_len, endp->e1.trau_rtp_st);
94+
if (rc < 0) {
95+
LOGPENDP(endp, DE1, LOGL_ERROR,
96+
"E1-I.460-IDLE-TX: error converting dummy fill frame!\n");
97+
goto skip;
98+
}
99+
rc = osmo_trau_frame_encode(msgb_data(msg), msg->data_len, &tf);
100+
if (rc < 0) {
101+
LOGPENDP(endp, DE1, LOGL_ERROR,
102+
"E1-I.460-IDLE-TX: error encoding dummy fill frame!\n");
103+
goto skip;
104+
}
105+
msgb_put(msg, rc);
106+
107+
/* enqueue it into the I.460 multiplexer */
235108
LOGPENDP(endp, DE1, LOGL_DEBUG, "E1-I.460-IDLE-TX: enquing %u trau frame bits: %s...\n", msgb_length(msg),
236109
osmo_ubit_dump(msgb_data(msg), msgb_length(msg) > DEBUG_BITS_MAX ? DEBUG_BITS_MAX : msgb_length(msg)));
237110
osmo_i460_mux_enqueue(endp->e1.schan, msg);
111+
return;
112+
113+
skip:
114+
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, E1_I460_TRAU_TX_FAIL_CTR));
115+
msgb_free(msg);
238116
}
239117

240118
/* called by I.460 de-multiplexer; feed output of I.460 demux into TRAU frame sync */

src/osmo-mgw/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ osmo_mgw_SOURCES = \
2727
osmo_mgw_LDADD = \
2828
$(top_builddir)/src/libosmo-mgcp/libosmo-mgcp.a \
2929
$(LIBOSMOCORE_LIBS) \
30+
$(LIBOSMOCODEC_LIBS) \
3031
$(LIBOSMOVTY_LIBS) \
3132
$(LIBOSMOGSM_LIBS) \
3233
$(LIBOSMOCTRL_LIBS) \

tests/mgcp/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ mgcp_test_SOURCES = \
3636
mgcp_test_LDADD = \
3737
$(top_builddir)/src/libosmo-mgcp/libosmo-mgcp.a \
3838
$(LIBOSMOCORE_LIBS) \
39+
$(LIBOSMOCODEC_LIBS) \
3940
$(LIBOSMOVTY_LIBS) \
4041
$(LIBOSMOGSM_LIBS) \
4142
$(LIBOSMOABIS_LIBS) \

0 commit comments

Comments
 (0)