aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/BUILD.gn7
-rw-r--r--api/DEPS6
-rw-r--r--api/peer_connection_interface.h3
-rw-r--r--api/test/create_time_controller.cc9
-rw-r--r--call/BUILD.gn8
-rw-r--r--call/call.cc27
-rw-r--r--call/call.h7
-rw-r--r--call/call_config.cc13
-rw-r--r--call/call_config.h6
-rw-r--r--call/call_factory.cc22
-rw-r--r--call/rtp_transport_config.h51
-rw-r--r--call/rtp_transport_controller_send_factory.h37
-rw-r--r--call/rtp_transport_controller_send_factory_interface.h32
-rw-r--r--pc/BUILD.gn2
-rw-r--r--pc/peer_connection_factory.cc10
-rw-r--r--pc/peer_connection_factory.h4
16 files changed, 225 insertions, 19 deletions
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 6a04f4fcf3..e1c45e2032 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -29,7 +29,10 @@ rtc_source_set("call_api") {
rtc_source_set("callfactory_api") {
visibility = [ "*" ]
sources = [ "call/call_factory_interface.h" ]
- deps = [ "../rtc_base/system:rtc_export" ]
+ deps = [
+ "../call:rtp_interfaces",
+ "../rtc_base/system:rtc_export",
+ ]
}
if (!build_with_chromium) {
@@ -172,6 +175,7 @@ rtc_library("libjingle_peerconnection_api") {
":rtp_transceiver_direction",
":scoped_refptr",
":sequence_checker",
+ "../call:rtp_interfaces",
"../rtc_base:network_constants",
"adaptation:resource_adaptation_api",
"audio:audio_mixer_api",
@@ -1053,6 +1057,7 @@ if (rtc_include_tests) {
":time_controller",
"../call",
"../call:call_interfaces",
+ "../call:rtp_interfaces",
"../test/time_controller",
]
}
diff --git a/api/DEPS b/api/DEPS
index afec84d8ec..bfa989f85f 100644
--- a/api/DEPS
+++ b/api/DEPS
@@ -42,6 +42,11 @@ include_rules = [
specific_include_rules = {
# Some internal headers are allowed even in API headers:
+
+ "call_factory_interface\.h": [
+ "+call/rtp_transport_controller_send_factory_interface.h",
+ ],
+
".*\.h": [
"+rtc_base/checks.h",
"+rtc_base/system/rtc_export.h",
@@ -126,6 +131,7 @@ specific_include_rules = {
],
"peer_connection_interface\.h": [
+ "+call/rtp_transport_controller_send_factory_interface.h",
"+media/base/media_config.h",
"+media/base/media_engine.h",
"+p2p/base/port.h",
diff --git a/api/peer_connection_interface.h b/api/peer_connection_interface.h
index e815f19518..ad3f70c323 100644
--- a/api/peer_connection_interface.h
+++ b/api/peer_connection_interface.h
@@ -118,6 +118,7 @@
#include "api/transport/webrtc_key_value_config.h"
#include "api/turn_customizer.h"
#include "api/video/video_bitrate_allocator_factory.h"
+#include "call/rtp_transport_controller_send_factory_interface.h"
#include "media/base/media_config.h"
#include "media/base/media_engine.h"
// TODO(bugs.webrtc.org/7447): We plan to provide a way to let applications
@@ -1402,6 +1403,8 @@ struct RTC_EXPORT PeerConnectionFactoryDependencies final {
std::unique_ptr<NetEqFactory> neteq_factory;
std::unique_ptr<SctpTransportFactoryInterface> sctp_factory;
std::unique_ptr<WebRtcKeyValueConfig> trials;
+ std::unique_ptr<RtpTransportControllerSendFactoryInterface>
+ transport_controller_send_factory;
};
// PeerConnectionFactoryInterface is the factory interface used for creating
diff --git a/api/test/create_time_controller.cc b/api/test/create_time_controller.cc
index a2c0cb713f..f7faeaab42 100644
--- a/api/test/create_time_controller.cc
+++ b/api/test/create_time_controller.cc
@@ -13,6 +13,8 @@
#include <memory>
#include "call/call.h"
+#include "call/rtp_transport_config.h"
+#include "call/rtp_transport_controller_send_factory_interface.h"
#include "test/time_controller/external_time_controller.h"
#include "test/time_controller/simulated_time_controller.h"
@@ -40,8 +42,13 @@ std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(
time_controller_->CreateProcessThread("CallModules"),
[this]() { module_thread_ = nullptr; });
}
+
+ RtpTransportConfig transportConfig = config.ExtractTransportConfig();
+
return Call::Create(config, time_controller_->GetClock(), module_thread_,
- time_controller_->CreateProcessThread("Pacer"));
+ config.rtp_transport_controller_send_factory->Create(
+ transportConfig, time_controller_->GetClock(),
+ time_controller_->CreateProcessThread("Pacer")));
}
private:
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 9f0cd037f3..ffe3da5820 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -98,22 +98,29 @@ rtc_library("rtp_interfaces") {
"rtp_config.h",
"rtp_packet_sink_interface.h",
"rtp_stream_receiver_controller_interface.h",
+ "rtp_transport_config.h",
+ "rtp_transport_controller_send_factory_interface.h",
"rtp_transport_controller_send_interface.h",
]
deps = [
"../api:array_view",
"../api:fec_controller_api",
"../api:frame_transformer_interface",
+ "../api:network_state_predictor_api",
"../api:rtp_headers",
"../api:rtp_parameters",
"../api/crypto:options",
"../api/rtc_event_log",
"../api/transport:bitrate_settings",
+ "../api/transport:network_control",
+ "../api/transport:webrtc_key_value_config",
"../api/units:timestamp",
"../common_video:frame_counts",
"../modules/rtp_rtcp:rtp_rtcp_format",
+ "../modules/utility",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
+ "../rtc_base:rtc_task_queue",
]
absl_deps = [
"//third_party/abseil-cpp/absl/algorithm:container",
@@ -150,6 +157,7 @@ rtc_library("rtp_sender") {
"rtp_payload_params.h",
"rtp_transport_controller_send.cc",
"rtp_transport_controller_send.h",
+ "rtp_transport_controller_send_factory.h",
"rtp_video_sender.cc",
"rtp_video_sender.h",
"rtp_video_sender_interface.h",
diff --git a/call/call.cc b/call/call.cc
index b8eafdc923..aea03af8d3 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -33,6 +33,7 @@
#include "call/receive_time_calculator.h"
#include "call/rtp_stream_receiver_controller.h"
#include "call/rtp_transport_controller_send.h"
+#include "call/rtp_transport_controller_send_factory.h"
#include "call/version.h"
#include "logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h"
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h"
@@ -519,11 +520,6 @@ Call* Call::Create(const Call::Config& config) {
rtc::scoped_refptr<SharedModuleThread> call_thread =
SharedModuleThread::Create(ProcessThread::Create("ModuleProcessThread"),
nullptr);
- return Create(config, std::move(call_thread));
-}
-
-Call* Call::Create(const Call::Config& config,
- rtc::scoped_refptr<SharedModuleThread> call_thread) {
return Create(config, Clock::GetRealTimeClock(), std::move(call_thread),
ProcessThread::Create("PacerThread"));
}
@@ -533,15 +529,28 @@ Call* Call::Create(const Call::Config& config,
rtc::scoped_refptr<SharedModuleThread> call_thread,
std::unique_ptr<ProcessThread> pacer_thread) {
RTC_DCHECK(config.task_queue_factory);
+
+ RtpTransportControllerSendFactory transport_controller_factory_;
+
+ RtpTransportConfig transportConfig = config.ExtractTransportConfig();
+
return new internal::Call(
clock, config,
- std::make_unique<RtpTransportControllerSend>(
- clock, config.event_log, config.network_state_predictor_factory,
- config.network_controller_factory, config.bitrate_config,
- std::move(pacer_thread), config.task_queue_factory, config.trials),
+ transport_controller_factory_.Create(transportConfig, clock,
+ std::move(pacer_thread)),
std::move(call_thread), config.task_queue_factory);
}
+Call* Call::Create(const Call::Config& config,
+ Clock* clock,
+ rtc::scoped_refptr<SharedModuleThread> call_thread,
+ std::unique_ptr<RtpTransportControllerSendInterface>
+ transportControllerSend) {
+ RTC_DCHECK(config.task_queue_factory);
+ return new internal::Call(clock, config, std::move(transportControllerSend),
+ std::move(call_thread), config.task_queue_factory);
+}
+
class SharedModuleThread::Impl {
public:
Impl(std::unique_ptr<ProcessThread> process_thread,
diff --git a/call/call.h b/call/call.h
index 37d784f726..86d0620e62 100644
--- a/call/call.h
+++ b/call/call.h
@@ -84,11 +84,14 @@ class Call {
static Call* Create(const Call::Config& config);
static Call* Create(const Call::Config& config,
- rtc::scoped_refptr<SharedModuleThread> call_thread);
- static Call* Create(const Call::Config& config,
Clock* clock,
rtc::scoped_refptr<SharedModuleThread> call_thread,
std::unique_ptr<ProcessThread> pacer_thread);
+ static Call* Create(const Call::Config& config,
+ Clock* clock,
+ rtc::scoped_refptr<SharedModuleThread> call_thread,
+ std::unique_ptr<RtpTransportControllerSendInterface>
+ transportControllerSend);
virtual AudioSendStream* CreateAudioSendStream(
const AudioSendStream::Config& config) = 0;
diff --git a/call/call_config.cc b/call/call_config.cc
index 8b3c91222e..23b60ce436 100644
--- a/call/call_config.cc
+++ b/call/call_config.cc
@@ -22,6 +22,19 @@ CallConfig::CallConfig(RtcEventLog* event_log,
CallConfig::CallConfig(const CallConfig& config) = default;
+RtpTransportConfig CallConfig::ExtractTransportConfig() const {
+ RtpTransportConfig transportConfig;
+ transportConfig.bitrate_config = bitrate_config;
+ transportConfig.event_log = event_log;
+ transportConfig.network_controller_factory = network_controller_factory;
+ transportConfig.network_state_predictor_factory =
+ network_state_predictor_factory;
+ transportConfig.task_queue_factory = task_queue_factory;
+ transportConfig.trials = trials;
+
+ return transportConfig;
+}
+
CallConfig::~CallConfig() = default;
} // namespace webrtc
diff --git a/call/call_config.h b/call/call_config.h
index 95dad36002..ba6dec3ad6 100644
--- a/call/call_config.h
+++ b/call/call_config.h
@@ -19,6 +19,8 @@
#include "api/transport/network_control.h"
#include "api/transport/webrtc_key_value_config.h"
#include "call/audio_state.h"
+#include "call/rtp_transport_config.h"
+#include "call/rtp_transport_controller_send_factory_interface.h"
namespace webrtc {
@@ -32,6 +34,7 @@ struct CallConfig {
explicit CallConfig(RtcEventLog* event_log,
TaskQueueBase* network_task_queue = nullptr);
CallConfig(const CallConfig&);
+ RtpTransportConfig ExtractTransportConfig() const;
~CallConfig();
// Bitrate config used until valid bitrate estimates are calculated. Also
@@ -69,6 +72,9 @@ struct CallConfig {
const WebRtcKeyValueConfig* trials = nullptr;
TaskQueueBase* const network_task_queue_ = nullptr;
+ // RtpTransportControllerSend to use for this call.
+ RtpTransportControllerSendFactoryInterface*
+ rtp_transport_controller_send_factory = nullptr;
};
} // namespace webrtc
diff --git a/call/call_factory.cc b/call/call_factory.cc
index cc02c02835..aeb3cbdaa7 100644
--- a/call/call_factory.cc
+++ b/call/call_factory.cc
@@ -14,11 +14,13 @@
#include <memory>
#include <string>
+#include <utility>
#include "absl/types/optional.h"
#include "api/test/simulated_network.h"
#include "call/call.h"
#include "call/degraded_call.h"
+#include "call/rtp_transport_config.h"
#include "rtc_base/checks.h"
#include "system_wrappers/include/field_trial.h"
@@ -81,10 +83,19 @@ Call* CallFactory::CreateCall(const Call::Config& config) {
absl::optional<webrtc::BuiltInNetworkBehaviorConfig>
receive_degradation_config = ParseDegradationConfig(false);
+ RtpTransportConfig transportConfig = config.ExtractTransportConfig();
+
if (send_degradation_config || receive_degradation_config) {
- return new DegradedCall(std::unique_ptr<Call>(Call::Create(config)),
- send_degradation_config, receive_degradation_config,
- config.task_queue_factory);
+ return new DegradedCall(
+ std::unique_ptr<Call>(Call::Create(
+ config, Clock::GetRealTimeClock(),
+ SharedModuleThread::Create(
+ ProcessThread::Create("ModuleProcessThread"), nullptr),
+ config.rtp_transport_controller_send_factory->Create(
+ transportConfig, Clock::GetRealTimeClock(),
+ ProcessThread::Create("PacerThread")))),
+ send_degradation_config, receive_degradation_config,
+ config.task_queue_factory);
}
if (!module_thread_) {
@@ -95,7 +106,10 @@ Call* CallFactory::CreateCall(const Call::Config& config) {
});
}
- return Call::Create(config, module_thread_);
+ return Call::Create(config, Clock::GetRealTimeClock(), module_thread_,
+ config.rtp_transport_controller_send_factory->Create(
+ transportConfig, Clock::GetRealTimeClock(),
+ ProcessThread::Create("PacerThread")));
}
std::unique_ptr<CallFactoryInterface> CreateCallFactory() {
diff --git a/call/rtp_transport_config.h b/call/rtp_transport_config.h
new file mode 100644
index 0000000000..9aa9f14c16
--- /dev/null
+++ b/call/rtp_transport_config.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef CALL_RTP_TRANSPORT_CONFIG_H_
+#define CALL_RTP_TRANSPORT_CONFIG_H_
+
+#include <memory>
+
+#include "api/network_state_predictor.h"
+#include "api/rtc_event_log/rtc_event_log.h"
+#include "api/transport/bitrate_settings.h"
+#include "api/transport/network_control.h"
+#include "api/transport/webrtc_key_value_config.h"
+#include "modules/utility/include/process_thread.h"
+#include "rtc_base/task_queue.h"
+
+namespace webrtc {
+
+struct RtpTransportConfig {
+ // Bitrate config used until valid bitrate estimates are calculated. Also
+ // used to cap total bitrate used. This comes from the remote connection.
+ BitrateConstraints bitrate_config;
+
+ // RtcEventLog to use for this call. Required.
+ // Use webrtc::RtcEventLog::CreateNull() for a null implementation.
+ RtcEventLog* event_log = nullptr;
+
+ // Task Queue Factory to be used in this call. Required.
+ TaskQueueFactory* task_queue_factory = nullptr;
+
+ // NetworkStatePredictor to use for this call.
+ NetworkStatePredictorFactoryInterface* network_state_predictor_factory =
+ nullptr;
+
+ // Network controller factory to use for this call.
+ NetworkControllerFactoryInterface* network_controller_factory = nullptr;
+
+ // Key-value mapping of internal configurations to apply,
+ // e.g. field trials.
+ const WebRtcKeyValueConfig* trials = nullptr;
+};
+} // namespace webrtc
+
+#endif // CALL_RTP_TRANSPORT_CONFIG_H_
diff --git a/call/rtp_transport_controller_send_factory.h b/call/rtp_transport_controller_send_factory.h
new file mode 100644
index 0000000000..a857ca7e6f
--- /dev/null
+++ b/call/rtp_transport_controller_send_factory.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef CALL_RTP_TRANSPORT_CONTROLLER_SEND_FACTORY_H_
+#define CALL_RTP_TRANSPORT_CONTROLLER_SEND_FACTORY_H_
+
+#include <memory>
+#include <utility>
+
+#include "call/rtp_transport_controller_send.h"
+#include "call/rtp_transport_controller_send_factory_interface.h"
+
+namespace webrtc {
+class RtpTransportControllerSendFactory
+ : public RtpTransportControllerSendFactoryInterface {
+ public:
+ std::unique_ptr<RtpTransportControllerSendInterface> Create(
+ const RtpTransportConfig& config,
+ Clock* clock,
+ std::unique_ptr<ProcessThread> process_thread) override {
+ return std::make_unique<RtpTransportControllerSend>(
+ clock, config.event_log, config.network_state_predictor_factory,
+ config.network_controller_factory, config.bitrate_config,
+ std::move(process_thread), config.task_queue_factory, config.trials);
+ }
+
+ virtual ~RtpTransportControllerSendFactory() {}
+};
+} // namespace webrtc
+#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_FACTORY_H_
diff --git a/call/rtp_transport_controller_send_factory_interface.h b/call/rtp_transport_controller_send_factory_interface.h
new file mode 100644
index 0000000000..a0218532a1
--- /dev/null
+++ b/call/rtp_transport_controller_send_factory_interface.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+#ifndef CALL_RTP_TRANSPORT_CONTROLLER_SEND_FACTORY_INTERFACE_H_
+#define CALL_RTP_TRANSPORT_CONTROLLER_SEND_FACTORY_INTERFACE_H_
+
+#include <memory>
+
+#include "call/rtp_transport_config.h"
+#include "call/rtp_transport_controller_send_interface.h"
+#include "modules/utility/include/process_thread.h"
+
+namespace webrtc {
+// A factory used for dependency injection on the send side of the transport
+// controller.
+class RtpTransportControllerSendFactoryInterface {
+ public:
+ virtual std::unique_ptr<RtpTransportControllerSendInterface> Create(
+ const RtpTransportConfig& config,
+ Clock* clock,
+ std::unique_ptr<ProcessThread> process_thread) = 0;
+
+ virtual ~RtpTransportControllerSendFactoryInterface() {}
+};
+} // namespace webrtc
+#endif // CALL_RTP_TRANSPORT_CONTROLLER_SEND_FACTORY_INTERFACE_H_
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index a6eae1604b..f66ec07250 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -301,6 +301,8 @@ rtc_library("peerconnection") {
"../api/video:video_rtp_headers",
"../api/video_codecs:video_codecs_api",
"../call:call_interfaces",
+ "../call:rtp_interfaces",
+ "../call:rtp_sender",
"../common_video",
"../logging:ice_log",
"../media:rtc_data_sctp_transport_internal",
diff --git a/pc/peer_connection_factory.cc b/pc/peer_connection_factory.cc
index d4e199cbe2..50755a38c7 100644
--- a/pc/peer_connection_factory.cc
+++ b/pc/peer_connection_factory.cc
@@ -25,6 +25,7 @@
#include "api/transport/bitrate_settings.h"
#include "api/units/data_rate.h"
#include "call/audio_state.h"
+#include "call/rtp_transport_controller_send_factory.h"
#include "media/base/media_engine.h"
#include "p2p/base/basic_async_resolver_factory.h"
#include "p2p/base/basic_packet_socket_factory.h"
@@ -100,7 +101,11 @@ PeerConnectionFactory::PeerConnectionFactory(
std::move(dependencies->network_state_predictor_factory)),
injected_network_controller_factory_(
std::move(dependencies->network_controller_factory)),
- neteq_factory_(std::move(dependencies->neteq_factory)) {}
+ neteq_factory_(std::move(dependencies->neteq_factory)),
+ transport_controller_send_factory_(
+ (dependencies->transport_controller_send_factory)
+ ? std::move(dependencies->transport_controller_send_factory)
+ : std::make_unique<RtpTransportControllerSendFactory>()) {}
PeerConnectionFactory::PeerConnectionFactory(
PeerConnectionFactoryDependencies dependencies)
@@ -334,7 +339,8 @@ std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
}
call_config.trials = &trials();
-
+ call_config.rtp_transport_controller_send_factory =
+ transport_controller_send_factory_.get();
return std::unique_ptr<Call>(
context_->call_factory()->CreateCall(call_config));
}
diff --git a/pc/peer_connection_factory.h b/pc/peer_connection_factory.h
index bd2efe457e..4946ec6ea2 100644
--- a/pc/peer_connection_factory.h
+++ b/pc/peer_connection_factory.h
@@ -14,6 +14,7 @@
#include <stdint.h>
#include <stdio.h>
+
#include <memory>
#include <string>
@@ -36,6 +37,7 @@
#include "api/transport/sctp_transport_factory_interface.h"
#include "api/transport/webrtc_key_value_config.h"
#include "call/call.h"
+#include "call/rtp_transport_controller_send_factory_interface.h"
#include "p2p/base/port_allocator.h"
#include "pc/channel_manager.h"
#include "pc/connection_context.h"
@@ -148,6 +150,8 @@ class PeerConnectionFactory : public PeerConnectionFactoryInterface {
std::unique_ptr<NetworkControllerFactoryInterface>
injected_network_controller_factory_;
std::unique_ptr<NetEqFactory> neteq_factory_;
+ const std::unique_ptr<RtpTransportControllerSendFactoryInterface>
+ transport_controller_send_factory_;
};
} // namespace webrtc