falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/42197?usp=email )
Change subject: RTP: make ortp optional at compile time ......................................................................
RTP: make ortp optional at compile time
It is now possible to run osmo-bts configure with --disable-ortp option, which makes it use only twrtp library (integrated into libosmo-netif) and removes all dependency on Belledonne software, such that osmo-bts can be built on top of libosmo-abis that has also been configured with its respective --disable-ortp option.
TODO: contrib/ber/rtp_ber utility still uses ortp and has no support for twrtp or any other alternative - therefore, when osmo-bts is configured with --disable-ortp, this utility is not built.
Related: OS#6474 Change-Id: Ib171bd42a65117457319befee2615e0c36c8d9e1 --- M configure.ac M contrib/ber/Makefile.am M src/common/bts.c M src/common/rtp_abstract.c M src/common/vty.c 5 files changed, 47 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/97/42197/1
diff --git a/configure.ac b/configure.ac index 423b710..fe69954 100644 --- a/configure.ac +++ b/configure.ac @@ -308,6 +308,19 @@ CPPFLAGS=$oldCPPFLAGS fi
+AC_ARG_ENABLE([ortp], [AS_HELP_STRING([--disable-ortp], [Build without ortp support])], + [ + ENABLE_ORTP=$enableval + ], + [ + ENABLE_ORTP="yes" + ]) +AS_IF([test "x$ENABLE_ORTP" = "xyes"], [ + AC_DEFINE([HAVE_ORTP],[1],[Build with ortp support]) +]) +AM_CONDITIONAL(ENABLE_ORTP, test "x$ENABLE_ORTP" = "xyes") +AC_SUBST(ENABLE_ORTP) + # Generate manuals AC_ARG_ENABLE(manuals, [AS_HELP_STRING( diff --git a/contrib/ber/Makefile.am b/contrib/ber/Makefile.am index 9bd7f40..44126b0 100644 --- a/contrib/ber/Makefile.am +++ b/contrib/ber/Makefile.am @@ -1,3 +1,5 @@ +if ENABLE_ORTP + AM_CPPFLAGS = \ $(all_includes) \ -I$(top_srcdir)/include \ @@ -26,3 +28,5 @@
update_codec_bit_class_h: rtp_gen_map $(AM_V_GEN)./$< > $(top_srcdir)/contrib/ber/codec_bit_class.h + +endif diff --git a/src/common/bts.c b/src/common/bts.c index 11f57a7..2cf4d0a 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -20,6 +20,8 @@ * */
+#include "btsconfig.h" + #include <errno.h> #include <unistd.h> #include <stdio.h> @@ -38,7 +40,10 @@ #include <osmocom/gsm/protocol/gsm_12_21.h> #include <osmocom/gsm/gsm48.h> #include <osmocom/gsm/lapdm.h> + +#ifdef HAVE_ORTP #include <osmocom/trau/osmo_ortp.h> +#endif
#include <osmo-bts/logging.h> #include <osmo-bts/abis.h> @@ -316,7 +321,6 @@ { int rc, i; static int initialized = 0; - void *tall_rtp_ctx;
bts->band = GSM_BAND_1800;
@@ -358,11 +362,14 @@ * by users of the software (GSM network operators), as opposed * to being imposed by developers as a flag day change. * The current default is to use ortp, in order to avoid any - * surprise changes in behaviour. It is expected that this - * default will change at some point in the future, prior to - * full discontinuation of support for ortp. + * surprise changes in behaviour - but only if ortp is available + * at compile time. */ +#ifdef HAVE_ORTP bts->use_twrtp = false; +#else + bts->use_twrtp = true; +#endif
/* Default (fall-back) MS/BS Power control parameters */ power_ctrl_params_def_reset(&bts->bs_dpc_params, true); @@ -393,10 +400,15 @@ oml_mo_state_init(&bts->mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED); oml_mo_state_init(&bts->gprs.cell.mo, NM_OPSTATE_DISABLED, NM_AVSTATE_NOT_INSTALLED);
+#ifdef HAVE_ORTP /* allocate a talloc pool for ORTP to ensure it doesn't have to go back * to the libc malloc all the time */ - tall_rtp_ctx = talloc_pool(tall_bts_ctx, 262144); - osmo_rtp_init(tall_rtp_ctx); + { + void *tall_rtp_ctx; + tall_rtp_ctx = talloc_pool(tall_bts_ctx, 262144); + osmo_rtp_init(tall_rtp_ctx); + } +#endif
/* Osmux */ rc = bts_osmux_init(bts); diff --git a/src/common/rtp_abstract.c b/src/common/rtp_abstract.c index 4854b25..fabfe6f 100644 --- a/src/common/rtp_abstract.c +++ b/src/common/rtp_abstract.c @@ -11,7 +11,7 @@ #include <netinet/in.h> #include <arpa/inet.h>
-#define HAVE_ORTP +#include "btsconfig.h"
#include <osmocom/core/logging.h> #include <osmocom/core/msgb.h> diff --git a/src/common/vty.c b/src/common/vty.c index af381b5..95ec94c 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -815,8 +815,18 @@ BTS_VTY_ATTR_NEW_LCHAN) { struct gsm_bts *bts = vty->index; + bool use_twrtp;
- bts->use_twrtp = !strcmp(argv[0], "twrtp"); + use_twrtp = !strcmp(argv[0], "twrtp"); +#ifndef HAVE_ORTP + if (!use_twrtp) { + vty_out(vty, + "%% Error: OsmoBTS was built without ortp support%s", + VTY_NEWLINE); + return CMD_WARNING; + } +#endif + bts->use_twrtp = use_twrtp; return CMD_SUCCESS; }