diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn index da67c093ec..3fb9cfea72 100644 --- a/webrtc/BUILD.gn +++ b/webrtc/BUILD.gn @@ -118,6 +118,10 @@ config("common_config") { 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 @@ config("common_config") { # 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 8eeccb3a05..45fcd91508 100644 --- a/webrtc/api/BUILD.gn +++ b/webrtc/api/BUILD.gn @@ -262,7 +262,9 @@ if (rtc_include_tests) { "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 b213ecb00f..4f34cfa83e 100644 --- a/webrtc/api/peerconnection_unittest.cc +++ b/webrtc/api/peerconnection_unittest.cc @@ -1789,6 +1789,7 @@ TEST_F(P2PTestConductor, LocalP2PTestOfferDtlsButNotSdes) { 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 @@ TEST_F(P2PTestConductor, LocalP2PTestOfferDataChannelOnly) { 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 @@ TEST_F(P2PTestConductor, LocalP2PTestRtpDataChannel) { 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 @@ TEST_F(P2PTestConductor, UnorderedSctpDataChannel) { 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 fedadd9e12..4110db07c9 100644 --- a/webrtc/api/peerconnectionendtoend_unittest.cc +++ b/webrtc/api/peerconnectionendtoend_unittest.cc @@ -194,6 +194,7 @@ TEST_F(PeerConnectionEndToEndTest, CallWithLegacySdp) { } #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 @@ TEST_F(PeerConnectionEndToEndTest, 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 @@ TEST_F(PeerConnectionEndToEndTest, MessageTransferBetweenQuicDataChannels) { } #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 @@ TEST_F(PeerConnectionEndToEndTest, CloseDataChannelRemotelyWhileNotReferenced) { // 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 c28130fe8a..d78ba3529f 100644 --- a/webrtc/api/rtcstats_integrationtest.cc +++ b/webrtc/api/rtcstats_integrationtest.cc @@ -523,6 +523,7 @@ class RTCStatsReportVerifier { rtc::scoped_refptr report_; }; +#ifdef HAVE_SCTP TEST_F(RTCStatsIntegrationTest, GetStatsFromCaller) { StartCall(); @@ -549,6 +550,7 @@ TEST_F(RTCStatsIntegrationTest, GetsStatsWhileDestroyingPeerConnections) { // 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 17405c3cb3..1f97724380 100644 --- a/webrtc/build/webrtc.gni +++ b/webrtc/build/webrtc.gni @@ -47,6 +47,9 @@ declare_args() { # 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 4ed14138b6..04936de177 100644 --- a/webrtc/media/BUILD.gn +++ b/webrtc/media/BUILD.gn @@ -143,10 +143,15 @@ rtc_static_library("rtc_media") { "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 @@ rtc_static_library("rtc_media") { 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 @@ if (rtc_include_tests) { "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 fe8711fa26..f2bdbc3568 100644 --- a/webrtc/pc/BUILD.gn +++ b/webrtc/pc/BUILD.gn @@ -15,10 +15,10 @@ group("pc") { } config("rtc_pc_config") { - defines = [ - "HAVE_SCTP", - "HAVE_SRTP", - ] + defines = [ "HAVE_SRTP" ] + if (rtc_enable_sctp) { + defines += [ "HAVE_SCTP" ] + } } rtc_static_library("rtc_pc") {