Skip to content

Commit

Permalink
sctp: Reorganize build targets
Browse files Browse the repository at this point in the history
Bug: webrtc:12614
Change-Id: I2d276139746bb8cafdd5c50fe4595e60a6b1c7fc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/215234
Reviewed-by: Mirko Bonadei <[email protected]>
Reviewed-by: Harald Alvestrand <[email protected]>
Commit-Queue: Florent Castelli <[email protected]>
Cr-Commit-Position: refs/heads/master@{#33745}
  • Loading branch information
Orphis authored and Commit Bot committed Apr 15, 2021
1 parent 6c7c495 commit a80c3e5
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 74 deletions.
92 changes: 52 additions & 40 deletions media/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -392,59 +392,73 @@ rtc_library("rtc_media_engine_defaults") {
]
}

rtc_library("rtc_data") {
defines = [
# "SCTP_DEBUG" # Uncomment for SCTP debugging.
]
rtc_source_set("rtc_data_sctp_transport_internal") {
sources = [ "sctp/sctp_transport_internal.h" ]
deps = [
":rtc_media_base",
"../api:call_api",
"../api:sequence_checker",
"../api:transport_api",
"../media:rtc_media_base",
"../p2p:rtc_p2p",
"../rtc_base",
"../rtc_base:rtc_base_approved",
"../rtc_base:threading",
"../rtc_base/synchronization:mutex",
"../rtc_base/task_utils:pending_task_safety_flag",
"../rtc_base/task_utils:to_queued_task",
"../rtc_base/third_party/sigslot",
"../system_wrappers",
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/types:optional",
]
}

if (rtc_enable_sctp) {
if (rtc_build_usrsctp) {
rtc_library("rtc_data_usrsctp_transport") {
defines = [
# "SCTP_DEBUG" # Uncomment for SCTP debugging.
]
sources = [
"sctp/sctp_transport_factory.cc",
"sctp/sctp_transport_factory.h",
"sctp/sctp_transport_internal.h",
"sctp/usrsctp_transport.cc",
"sctp/usrsctp_transport.h",
]
} else {
# libtool on mac does not like empty targets.
sources = [ "sctp/noop.cc" ]
}

if (rtc_enable_sctp && rtc_build_usrsctp) {
deps += [
"../api/transport:sctp_transport_factory_interface",
deps = [
":rtc_data_sctp_transport_internal",
"../media:rtc_media_base",
"../p2p:rtc_p2p",
"../rtc_base",
"../rtc_base:rtc_base_approved",
"../rtc_base:threading",
"../rtc_base/synchronization:mutex",
"../rtc_base/task_utils:pending_task_safety_flag",
"../rtc_base/task_utils:to_queued_task",
"../rtc_base/third_party/sigslot:sigslot",
"//third_party/usrsctp",
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/types:optional",
]
}
}

rtc_library("rtc_data_sctp_transport_factory") {
defines = []
sources = [
"sctp/sctp_transport_factory.cc",
"sctp/sctp_transport_factory.h",
]
deps = [
":rtc_data_sctp_transport_internal",
"../api/transport:sctp_transport_factory_interface",
"../rtc_base:threading",
"../rtc_base/system:unused",
]

if (rtc_enable_sctp) {
assert(rtc_build_usrsctp, "An SCTP backend is required to enable SCTP")
}

if (rtc_build_usrsctp) {
defines += [ "WEBRTC_HAVE_USRSCTP" ]
deps += [ ":rtc_data_usrsctp_transport" ]
}
}

rtc_source_set("rtc_media") {
visibility = [ "*" ]
allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
deps = [
":rtc_audio_video",
":rtc_data",
]
deps = [ ":rtc_audio_video" ]
}

if (rtc_include_tests) {
Expand Down Expand Up @@ -537,7 +551,6 @@ if (rtc_include_tests) {
defines = []
deps = [
":rtc_audio_video",
":rtc_data",
":rtc_encoder_simulcast_proxy",
":rtc_internal_video_codecs",
":rtc_media",
Expand Down Expand Up @@ -641,15 +654,18 @@ if (rtc_include_tests) {
sources += [ "engine/webrtc_voice_engine_unittest.cc" ]
}

if (rtc_enable_sctp) {
if (rtc_build_usrsctp) {
sources += [
"sctp/usrsctp_transport_reliability_unittest.cc",
"sctp/usrsctp_transport_unittest.cc",
]
deps += [
":rtc_data_sctp_transport_internal",
":rtc_data_usrsctp_transport",
"../rtc_base:rtc_event",
"../rtc_base/task_utils:pending_task_safety_flag",
"../rtc_base/task_utils:to_queued_task",
"//third_party/usrsctp",
]
}

Expand All @@ -669,10 +685,6 @@ if (rtc_include_tests) {
if (is_ios) {
deps += [ ":rtc_media_unittests_bundle_data" ]
}

if (rtc_enable_sctp && rtc_build_usrsctp) {
deps += [ "//third_party/usrsctp" ]
}
}
}
}
13 changes: 0 additions & 13 deletions media/sctp/noop.cc

This file was deleted.

20 changes: 17 additions & 3 deletions media/sctp/sctp_transport_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,30 @@

#include "media/sctp/sctp_transport_factory.h"

#include "rtc_base/system/unused.h"

#ifdef WEBRTC_HAVE_USRSCTP
#include "media/sctp/usrsctp_transport.h" // nogncheck
#endif

namespace cricket {

SctpTransportFactory::SctpTransportFactory(rtc::Thread* network_thread)
: network_thread_(network_thread) {}
: network_thread_(network_thread) {
RTC_UNUSED(network_thread_);
}

std::unique_ptr<SctpTransportInternal>
SctpTransportFactory::CreateSctpTransport(
rtc::PacketTransportInternal* transport) {
return std::unique_ptr<SctpTransportInternal>(
new UsrsctpTransport(network_thread_, transport));
std::unique_ptr<SctpTransportInternal> result;
#ifdef WEBRTC_HAVE_USRSCTP
if (!result) {
result = std::unique_ptr<SctpTransportInternal>(
new UsrsctpTransport(network_thread_, transport));
}
#endif
return result;
}

} // namespace cricket
2 changes: 1 addition & 1 deletion media/sctp/sctp_transport_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <memory>

#include "api/transport/sctp_transport_factory_interface.h"
#include "media/sctp/usrsctp_transport.h"
#include "media/sctp/sctp_transport_internal.h"
#include "rtc_base/thread.h"

namespace cricket {
Expand Down
1 change: 0 additions & 1 deletion media/sctp/usrsctp_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <vector>

#include "absl/types/optional.h"
#include "api/transport/sctp_transport_factory_interface.h"
#include "rtc_base/buffer.h"
#include "rtc_base/constructor_magic.h"
#include "rtc_base/copy_on_write_buffer.h"
Expand Down
16 changes: 5 additions & 11 deletions pc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ rtc_library("rtc_pc_base") {
"../common_video",
"../common_video:common_video",
"../logging:ice_log",
"../media:rtc_data",
"../media:rtc_data_sctp_transport_internal",
"../media:rtc_h264_profile_id",
"../media:rtc_media_base",
"../media:rtc_media_config",
Expand Down Expand Up @@ -281,7 +281,7 @@ rtc_library("peerconnection") {
"../call:call_interfaces",
"../common_video",
"../logging:ice_log",
"../media:rtc_data",
"../media:rtc_data_sctp_transport_internal",
"../media:rtc_media_base",
"../media:rtc_media_config",
"../modules/audio_processing:audio_processing_statistics",
Expand Down Expand Up @@ -336,7 +336,7 @@ rtc_library("connection_context") {
"../api/transport:field_trial_based_config",
"../api/transport:sctp_transport_factory_interface",
"../api/transport:webrtc_key_value_config",
"../media:rtc_data",
"../media:rtc_data_sctp_transport_factory",
"../media:rtc_media_base",
"../p2p:rtc_p2p",
"../rtc_base",
Expand Down Expand Up @@ -869,7 +869,7 @@ if (rtc_include_tests && !build_with_chromium) {
"../api/video/test:mock_recordable_encoded_frame",
"../call:rtp_interfaces",
"../call:rtp_receiver",
"../media:rtc_data",
"../media:rtc_data_sctp_transport_internal",
"../media:rtc_media_base",
"../media:rtc_media_tests_utils",
"../modules/rtp_rtcp:rtp_rtcp_format",
Expand Down Expand Up @@ -1011,10 +1011,6 @@ if (rtc_include_tests && !build_with_chromium) {
"webrtc_sdp_unittest.cc",
]

if (rtc_enable_sctp) {
defines = [ "WEBRTC_HAVE_SCTP" ]
}

deps = [
":audio_rtp_receiver",
":audio_track",
Expand Down Expand Up @@ -1065,6 +1061,7 @@ if (rtc_include_tests && !build_with_chromium) {
"../api/video:video_rtp_headers",
"../call/adaptation:resource_adaptation_test_utilities",
"../logging:fake_rtc_event_log",
"../media:rtc_data_sctp_transport_internal",
"../media:rtc_media_config",
"../media:rtc_media_engine_defaults",
"../modules/audio_device:audio_device_api",
Expand Down Expand Up @@ -1118,8 +1115,6 @@ if (rtc_include_tests && !build_with_chromium) {
"../api/video_codecs:video_codecs_api",
"../call:call_interfaces",
"../media:rtc_audio_video",
"../media:rtc_data", # TODO(phoglund): AFAIK only used for one sctp
# constant.
"../media:rtc_media_base",
"../media:rtc_media_tests_utils",
"../modules/audio_processing",
Expand Down Expand Up @@ -1328,7 +1323,6 @@ if (rtc_include_tests && !build_with_chromium) {
"../api/video_codecs:builtin_video_encoder_factory",
"../api/video_codecs:video_codecs_api",
"../call:call_interfaces",
"../media:rtc_data",
"../media:rtc_media",
"../media:rtc_media_base",
"../media:rtc_media_tests_utils",
Expand Down
1 change: 0 additions & 1 deletion pc/connection_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "api/transport/sctp_transport_factory_interface.h"
#include "api/transport/webrtc_key_value_config.h"
#include "media/base/media_engine.h"
#include "media/sctp/sctp_transport_internal.h"
#include "p2p/base/basic_packet_socket_factory.h"
#include "pc/channel_manager.h"
#include "rtc_base/checks.h"
Expand Down
1 change: 0 additions & 1 deletion pc/peer_connection_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "api/transport/sctp_transport_factory_interface.h"
#include "api/transport/webrtc_key_value_config.h"
#include "call/call.h"
#include "media/sctp/sctp_transport_internal.h"
#include "p2p/base/port_allocator.h"
#include "pc/channel_manager.h"
#include "pc/connection_context.h"
Expand Down
1 change: 0 additions & 1 deletion sdk/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,6 @@ if (current_os == "linux" || is_android) {
"../../api/video_codecs:video_codecs_api",
"../../call:call_interfaces",
"../../media:rtc_audio_video",
"../../media:rtc_data",
"../../media:rtc_media_base",
"../../modules/audio_device",
"../../modules/audio_processing:api",
Expand Down
2 changes: 1 addition & 1 deletion test/pc/sctp/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ import("../../../webrtc.gni")
rtc_source_set("fake_sctp_transport") {
visibility = [ "*" ]
sources = [ "fake_sctp_transport.h" ]
deps = [ "../../../media:rtc_data" ]
deps = [ "../../../media:rtc_data_sctp_transport_internal" ]
}
6 changes: 5 additions & 1 deletion webrtc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ declare_args() {
rtc_libvpx_build_vp9 = !build_with_mozilla
rtc_build_opus = !build_with_mozilla
rtc_build_ssl = !build_with_mozilla
rtc_build_usrsctp = !build_with_mozilla

# Enable libevent task queues on platforms that support it.
if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
Expand Down Expand Up @@ -290,6 +289,11 @@ declare_args() {
rtc_exclude_transient_suppressor = false
}

declare_args() {
# Enable the usrsctp backend for DataChannels and related unittests
rtc_build_usrsctp = !build_with_mozilla && rtc_enable_sctp
}

# Make it possible to provide custom locations for some libraries (move these
# up into declare_args should we need to actually use them for the GN build).
rtc_libvpx_dir = "//third_party/libvpx"
Expand Down

0 comments on commit a80c3e5

Please sign in to comment.