Hook up new "rtc_enable_sctp" build argument to "HAVE_SCTP" define.
This allows building without SCTP support (and even building/running
tests). The "HAVE_SCTP" define has been functional for a while, but there
wasn't any easy way to turn it on/off.
NOTRY=True
BUG=webrtc:6933
Review-Url: https://codereview.webrtc.org/2593313002
Cr-Commit-Position: refs/heads/master@{#15763}
diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn
index da67c09..3fb9cfe 100644
--- a/webrtc/BUILD.gn
+++ b/webrtc/BUILD.gn
@@ -118,6 +118,10 @@
defines += [ "RTC_DISABLE_VP9" ]
}
+ if (rtc_enable_sctp) {
+ defines += [ "HAVE_SCTP" ]
+ }
+
if (build_with_chromium) {
defines += [
# NOTICE: Since common_inherited_config is used in public_configs for our
@@ -126,7 +130,6 @@
# source when webrtc:4256 is completed.
"ENABLE_EXTERNAL_AUTH",
"HAVE_OPENSSL_SSL_H",
- "HAVE_SCTP",
"HAVE_SRTP",
"HAVE_WEBRTC_VIDEO",
"HAVE_WEBRTC_VOICE",
diff --git a/webrtc/api/BUILD.gn b/webrtc/api/BUILD.gn
index 8eeccb3..45fcd91 100644
--- a/webrtc/api/BUILD.gn
+++ b/webrtc/api/BUILD.gn
@@ -262,7 +262,9 @@
"webrtcsession_unittest.cc",
]
- defines = [ "HAVE_SCTP" ]
+ if (rtc_enable_sctp) {
+ defines = [ "HAVE_SCTP" ]
+ }
configs += [ ":peerconnection_unittests_config" ]
diff --git a/webrtc/api/peerconnection_unittest.cc b/webrtc/api/peerconnection_unittest.cc
index b213ecb..4f34cfa 100644
--- a/webrtc/api/peerconnection_unittest.cc
+++ b/webrtc/api/peerconnection_unittest.cc
@@ -1789,6 +1789,7 @@
VerifyRenderedAspectRatio(640, 480);
}
+#ifdef HAVE_SCTP
// This test verifies that the negotiation will succeed with data channel only
// in max-bundle mode.
TEST_F(P2PTestConductor, LocalP2PTestOfferDataChannelOnly) {
@@ -1799,6 +1800,7 @@
initializing_client()->CreateDataChannel();
initializing_client()->Negotiate();
}
+#endif
// This test sets up a Jsep call between two parties, and the callee only
// accept to receive video.
@@ -2088,6 +2090,7 @@
EXPECT_FALSE(receiving_client()->data_observer()->IsOpen());
}
+#ifdef HAVE_SCTP
// This test sets up a call between two parties with audio, video and an SCTP
// data channel.
TEST_F(P2PTestConductor, LocalP2PTestSctpDataChannel) {
@@ -2175,6 +2178,7 @@
kMaxWaitMs);
EXPECT_TRUE_WAIT(!receiving_client()->data_observer()->IsOpen(), kMaxWaitMs);
}
+#endif // HAVE_SCTP
// This test sets up a call between two parties and creates a data channel.
// The test tests that received data is buffered unless an observer has been
diff --git a/webrtc/api/peerconnectionendtoend_unittest.cc b/webrtc/api/peerconnectionendtoend_unittest.cc
index fedadd9..4110db0 100644
--- a/webrtc/api/peerconnectionendtoend_unittest.cc
+++ b/webrtc/api/peerconnectionendtoend_unittest.cc
@@ -194,6 +194,7 @@
}
#endif // !defined(ADDRESS_SANITIZER)
+#ifdef HAVE_SCTP
// Verifies that a DataChannel created before the negotiation can transition to
// "OPEN" and transfer data.
TEST_F(PeerConnectionEndToEndTest, CreateDataChannelBeforeNegotiate) {
@@ -319,6 +320,7 @@
EXPECT_EQ(1U, dc_1_observer->received_message_count());
EXPECT_EQ(1U, dc_2_observer->received_message_count());
}
+#endif // HAVE_SCTP
#ifdef HAVE_QUIC
// Test that QUIC data channels can be used and that messages go to the correct
@@ -396,6 +398,7 @@
}
#endif // HAVE_QUIC
+#ifdef HAVE_SCTP
// Verifies that a DataChannel added from an OPEN message functions after
// a channel has been previously closed (webrtc issue 3778).
// This previously failed because the new channel re-uses the ID of the closed
@@ -455,3 +458,4 @@
// close message and be destroyed.
rtc::Thread::Current()->ProcessMessages(100);
}
+#endif // HAVE_SCTP
diff --git a/webrtc/api/rtcstats_integrationtest.cc b/webrtc/api/rtcstats_integrationtest.cc
index c28130fe..d78ba35 100644
--- a/webrtc/api/rtcstats_integrationtest.cc
+++ b/webrtc/api/rtcstats_integrationtest.cc
@@ -523,6 +523,7 @@
rtc::scoped_refptr<const RTCStatsReport> report_;
};
+#ifdef HAVE_SCTP
TEST_F(RTCStatsIntegrationTest, GetStatsFromCaller) {
StartCall();
@@ -549,6 +550,7 @@
// the peer connection.
EXPECT_TRUE(stats_obtainer->report());
}
+#endif // HAVE_SCTP
} // namespace
diff --git a/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni
index 17405c3..1f97724 100644
--- a/webrtc/build/webrtc.gni
+++ b/webrtc/build/webrtc.gni
@@ -47,6 +47,9 @@
# Set this to true to enable BWE test logging.
rtc_enable_bwe_test_logging = false
+ # Set this to disable building with support for SCTP data channels.
+ rtc_enable_sctp = true
+
# Disable these to not build components which can be externally provided.
rtc_build_expat = true
rtc_build_json = true
diff --git a/webrtc/media/BUILD.gn b/webrtc/media/BUILD.gn
index 4ed1413..04936de 100644
--- a/webrtc/media/BUILD.gn
+++ b/webrtc/media/BUILD.gn
@@ -143,10 +143,15 @@
"engine/webrtcvoe.h",
"engine/webrtcvoiceengine.cc",
"engine/webrtcvoiceengine.h",
- "sctp/sctpdataengine.cc",
- "sctp/sctpdataengine.h",
]
+ if (rtc_enable_sctp) {
+ sources += [
+ "sctp/sctpdataengine.cc",
+ "sctp/sctpdataengine.h",
+ ]
+ }
+
configs += [ ":rtc_media_warnings_config" ]
if (!build_with_chromium && is_clang) {
@@ -179,7 +184,7 @@
include_dirs += [ "$rtc_libyuv_dir/include" ]
}
- if (rtc_build_usrsctp) {
+ if (rtc_enable_sctp && rtc_build_usrsctp) {
include_dirs += [
# TODO(jiayl): move this into the public_configs of
# //third_party/usrsctp/BUILD.gn.
@@ -338,9 +343,12 @@
"engine/webrtcvideocapturer_unittest.cc",
"engine/webrtcvideoengine2_unittest.cc",
"engine/webrtcvoiceengine_unittest.cc",
- "sctp/sctpdataengine_unittest.cc",
]
+ if (rtc_enable_sctp) {
+ sources += [ "sctp/sctpdataengine_unittest.cc" ]
+ }
+
configs += [ ":rtc_media_unittests_config" ]
if (rtc_use_h264) {
diff --git a/webrtc/pc/BUILD.gn b/webrtc/pc/BUILD.gn
index fe8711f..f2bdbc3 100644
--- a/webrtc/pc/BUILD.gn
+++ b/webrtc/pc/BUILD.gn
@@ -15,10 +15,10 @@
}
config("rtc_pc_config") {
- defines = [
- "HAVE_SCTP",
- "HAVE_SRTP",
- ]
+ defines = [ "HAVE_SRTP" ]
+ if (rtc_enable_sctp) {
+ defines += [ "HAVE_SCTP" ]
+ }
}
rtc_static_library("rtc_pc") {