falconia has submitted this change. ( 
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/Makefile.am
M src/common/bts.c
M src/common/rtp_abstract.c
M src/common/vty.c
5 files changed, 50 insertions(+), 9 deletions(-)

Approvals:
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve




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/Makefile.am b/contrib/Makefile.am
index 5594199..a34e66f 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1 +1,5 @@
-SUBDIRS = systemd ber
+SUBDIRS = systemd
+
+if ENABLE_ORTP
+SUBDIRS += ber
+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..a923067 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -432,8 +432,10 @@
         * In the meantime, however, extra attention is required to keep
         * the following code in sync with changes in the default!
         */
+#ifdef HAVE_ORTP
        if (bts->use_twrtp)
                vty_out(vty, " rtp library twrtp%s", VTY_NEWLINE);
+#endif
        if (bts->rtp_nogaps_mode)
                vty_out(vty, " rtp continuous-streaming%s", VTY_NEWLINE);
        vty_out(vty, " %srtp internal-uplink-ecu%s",
@@ -815,8 +817,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;
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/42197?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ib171bd42a65117457319befee2615e0c36c8d9e1
Gerrit-Change-Number: 42197
Gerrit-PatchSet: 3
Gerrit-Owner: falconia <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>

Reply via email to