Cleanup Call construction
Return unique_ptr to clearly communicate ownership is transfered.
Remove Call::Config alias
Bug: None
Change-Id: Ie3aa1da383ad65fae490d218fced443d44961eab
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/323160
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40934}
diff --git a/api/call/call_factory_interface.h b/api/call/call_factory_interface.h
index 6051409..fde8cba 100644
--- a/api/call/call_factory_interface.h
+++ b/api/call/call_factory_interface.h
@@ -26,9 +26,9 @@
// is constructed with a CallFactoryInterface, which may or may not be null.
class CallFactoryInterface {
public:
- virtual ~CallFactoryInterface() {}
+ virtual ~CallFactoryInterface() = default;
- virtual Call* CreateCall(const CallConfig& config) = 0;
+ virtual std::unique_ptr<Call> CreateCall(const CallConfig& config) = 0;
};
RTC_EXPORT std::unique_ptr<CallFactoryInterface> CreateCallFactory();
diff --git a/api/test/create_time_controller.cc b/api/test/create_time_controller.cc
index d198f2b..2c356cb 100644
--- a/api/test/create_time_controller.cc
+++ b/api/test/create_time_controller.cc
@@ -36,7 +36,7 @@
public:
explicit TimeControllerBasedCallFactory(TimeController* time_controller)
: time_controller_(time_controller) {}
- Call* CreateCall(const Call::Config& config) override {
+ std::unique_ptr<Call> CreateCall(const CallConfig& config) override {
RtpTransportConfig transportConfig = config.ExtractTransportConfig();
return Call::Create(config, time_controller_->GetClock(),
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 17c797c..4cc42fd 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -345,7 +345,6 @@
]
absl_deps = [
"//third_party/abseil-cpp/absl/functional:bind_front",
- "//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
@@ -544,7 +543,6 @@
absl_deps = [
"//third_party/abseil-cpp/absl/container:inlined_vector",
"//third_party/abseil-cpp/absl/functional:any_invocable",
- "//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
"//third_party/abseil-cpp/absl/types:variant",
diff --git a/call/call.cc b/call/call.cc
index fa5d14d..b42c7d1 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -184,7 +184,7 @@
public BitrateAllocator::LimitObserver {
public:
Call(Clock* clock,
- const Call::Config& config,
+ const CallConfig& config,
std::unique_ptr<RtpTransportControllerSendInterface> transport_send,
TaskQueueFactory* task_queue_factory);
~Call() override;
@@ -355,7 +355,7 @@
const int num_cpu_cores_;
const std::unique_ptr<CallStats> call_stats_;
const std::unique_ptr<BitrateAllocator> bitrate_allocator_;
- const Call::Config config_ RTC_GUARDED_BY(worker_thread_);
+ const CallConfig config_ RTC_GUARDED_BY(worker_thread_);
// Maps to config_.trials, can be used from any thread via `trials()`.
const FieldTrialsView& trials_;
@@ -478,20 +478,22 @@
return ss.str();
}
-Call* Call::Create(const Call::Config& config) {
+std::unique_ptr<Call> Call::Create(const CallConfig& config) {
Clock* clock = Clock::GetRealTimeClock();
return Create(config, clock,
RtpTransportControllerSendFactory().Create(
config.ExtractTransportConfig(), clock));
}
-Call* Call::Create(const Call::Config& config,
- Clock* clock,
- std::unique_ptr<RtpTransportControllerSendInterface>
- transportControllerSend) {
+std::unique_ptr<Call> Call::Create(
+ const CallConfig& config,
+ Clock* clock,
+ std::unique_ptr<RtpTransportControllerSendInterface>
+ transportControllerSend) {
RTC_DCHECK(config.task_queue_factory);
- return new internal::Call(clock, config, std::move(transportControllerSend),
- config.task_queue_factory);
+ return std::make_unique<internal::Call>(clock, config,
+ std::move(transportControllerSend),
+ config.task_queue_factory);
}
// This method here to avoid subclasses has to implement this method.
@@ -658,7 +660,7 @@
}
Call::Call(Clock* clock,
- const Call::Config& config,
+ const CallConfig& config,
std::unique_ptr<RtpTransportControllerSendInterface> transport_send,
TaskQueueFactory* task_queue_factory)
: clock_(clock),
diff --git a/call/call.h b/call/call.h
index 3669783..6f8e4cd 100644
--- a/call/call.h
+++ b/call/call.h
@@ -46,8 +46,6 @@
class Call {
public:
- using Config = CallConfig;
-
struct Stats {
std::string ToString(int64_t time_ms) const;
@@ -58,11 +56,12 @@
int64_t rtt_ms = -1;
};
- static Call* Create(const Call::Config& config);
- static Call* Create(const Call::Config& config,
- Clock* clock,
- std::unique_ptr<RtpTransportControllerSendInterface>
- transportControllerSend);
+ static std::unique_ptr<Call> Create(const CallConfig& config);
+ static std::unique_ptr<Call> Create(
+ const CallConfig& config,
+ Clock* clock,
+ std::unique_ptr<RtpTransportControllerSendInterface>
+ transportControllerSend);
virtual AudioSendStream* CreateAudioSendStream(
const AudioSendStream::Config& config) = 0;
diff --git a/call/call_factory.cc b/call/call_factory.cc
index 380e80c..043b11d 100644
--- a/call/call_factory.cc
+++ b/call/call_factory.cc
@@ -17,7 +17,6 @@
#include <utility>
#include <vector>
-#include "absl/memory/memory.h"
#include "absl/types/optional.h"
#include "api/test/simulated_network.h"
#include "api/units/time_delta.h"
@@ -83,7 +82,7 @@
call_thread_.Detach();
}
-Call* CallFactory::CreateCall(const Call::Config& config) {
+std::unique_ptr<Call> CallFactory::CreateCall(const CallConfig& config) {
RTC_DCHECK_RUN_ON(&call_thread_);
RTC_DCHECK(config.trials);
@@ -95,22 +94,22 @@
RtpTransportConfig transportConfig = config.ExtractTransportConfig();
- Call* call =
+ std::unique_ptr<Call> call =
Call::Create(config, Clock::GetRealTimeClock(),
config.rtp_transport_controller_send_factory->Create(
transportConfig, Clock::GetRealTimeClock()));
if (!send_degradation_configs.empty() ||
!receive_degradation_configs.empty()) {
- return new DegradedCall(absl::WrapUnique(call), send_degradation_configs,
- receive_degradation_configs);
+ return std::make_unique<DegradedCall>(
+ std::move(call), send_degradation_configs, receive_degradation_configs);
}
return call;
}
std::unique_ptr<CallFactoryInterface> CreateCallFactory() {
- return std::unique_ptr<CallFactoryInterface>(new CallFactory());
+ return std::make_unique<CallFactory>();
}
} // namespace webrtc
diff --git a/call/call_factory.h b/call/call_factory.h
index 9feed7b..f75b1bd 100644
--- a/call/call_factory.h
+++ b/call/call_factory.h
@@ -11,6 +11,8 @@
#ifndef CALL_CALL_FACTORY_H_
#define CALL_CALL_FACTORY_H_
+#include <memory>
+
#include "api/call/call_factory_interface.h"
#include "api/sequence_checker.h"
#include "call/call.h"
@@ -22,11 +24,10 @@
class CallFactory : public CallFactoryInterface {
public:
CallFactory();
+ ~CallFactory() override = default;
private:
- ~CallFactory() override {}
-
- Call* CreateCall(const CallConfig& config) override;
+ std::unique_ptr<Call> CreateCall(const CallConfig& config) override;
RTC_NO_UNIQUE_ADDRESS SequenceChecker call_thread_;
};
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index 3c6562c..0ba6d05 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -223,12 +223,12 @@
send_audio_state_config.audio_processing =
AudioProcessingBuilder().Create();
send_audio_state_config.audio_device_module = fake_audio_device;
- Call::Config sender_config(send_event_log_.get());
+ CallConfig sender_config(send_event_log_.get());
auto audio_state = AudioState::Create(send_audio_state_config);
fake_audio_device->RegisterAudioCallback(audio_state->audio_transport());
sender_config.audio_state = audio_state;
- Call::Config receiver_config(recv_event_log_.get());
+ CallConfig receiver_config(recv_event_log_.get());
receiver_config.audio_state = audio_state;
CreateCalls(sender_config, receiver_config);
diff --git a/call/call_unittest.cc b/call/call_unittest.cc
index 01476ee..886a15a 100644
--- a/call/call_unittest.cc
+++ b/call/call_unittest.cc
@@ -15,7 +15,6 @@
#include <memory>
#include <utility>
-#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/media_types.h"
@@ -40,6 +39,7 @@
#include "test/mock_transport.h"
#include "test/run_loop.h"
+namespace webrtc {
namespace {
using ::testing::_;
@@ -47,41 +47,38 @@
using ::testing::MockFunction;
using ::testing::NiceMock;
using ::testing::StrictMock;
+using ::webrtc::test::MockAudioDeviceModule;
+using ::webrtc::test::MockAudioMixer;
+using ::webrtc::test::MockAudioProcessing;
+using ::webrtc::test::RunLoop;
struct CallHelper {
explicit CallHelper(bool use_null_audio_processing) {
- task_queue_factory_ = webrtc::CreateDefaultTaskQueueFactory();
- webrtc::AudioState::Config audio_state_config;
- audio_state_config.audio_mixer =
- rtc::make_ref_counted<webrtc::test::MockAudioMixer>();
+ task_queue_factory_ = CreateDefaultTaskQueueFactory();
+ AudioState::Config audio_state_config;
+ audio_state_config.audio_mixer = rtc::make_ref_counted<MockAudioMixer>();
audio_state_config.audio_processing =
use_null_audio_processing
? nullptr
- : rtc::make_ref_counted<
- NiceMock<webrtc::test::MockAudioProcessing>>();
+ : rtc::make_ref_counted<NiceMock<MockAudioProcessing>>();
audio_state_config.audio_device_module =
- rtc::make_ref_counted<webrtc::test::MockAudioDeviceModule>();
- webrtc::Call::Config config(&event_log_);
- config.audio_state = webrtc::AudioState::Create(audio_state_config);
+ rtc::make_ref_counted<MockAudioDeviceModule>();
+ CallConfig config(&event_log_);
+ config.audio_state = AudioState::Create(audio_state_config);
config.task_queue_factory = task_queue_factory_.get();
config.trials = &field_trials_;
- call_.reset(webrtc::Call::Create(config));
+ call_ = Call::Create(config);
}
- webrtc::Call* operator->() { return call_.get(); }
+ Call* operator->() { return call_.get(); }
private:
- webrtc::test::RunLoop loop_;
- webrtc::RtcEventLogNull event_log_;
- webrtc::FieldTrialBasedConfig field_trials_;
- std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
- std::unique_ptr<webrtc::Call> call_;
+ RunLoop loop_;
+ RtcEventLogNull event_log_;
+ FieldTrialBasedConfig field_trials_;
+ std::unique_ptr<TaskQueueFactory> task_queue_factory_;
+ std::unique_ptr<Call> call_;
};
-} // namespace
-
-namespace webrtc {
-
-namespace {
rtc::scoped_refptr<Resource> FindResourceWhoseNameContains(
const std::vector<rtc::scoped_refptr<Resource>>& resources,
diff --git a/media/engine/webrtc_video_engine_unittest.cc b/media/engine/webrtc_video_engine_unittest.cc
index 0f416aa..b98d8e4 100644
--- a/media/engine/webrtc_video_engine_unittest.cc
+++ b/media/engine/webrtc_video_engine_unittest.cc
@@ -19,7 +19,6 @@
#include <vector>
#include "absl/algorithm/container.h"
-#include "absl/memory/memory.h"
#include "absl/strings/match.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/rtp_parameters.h"
@@ -99,6 +98,8 @@
using ::testing::Values;
using ::testing::WithArg;
using ::webrtc::BitrateConstraints;
+using ::webrtc::Call;
+using ::webrtc::CallConfig;
using ::webrtc::kDefaultScalabilityModeStr;
using ::webrtc::RtpExtension;
using ::webrtc::RtpPacket;
@@ -355,8 +356,8 @@
: field_trials_(field_trials),
time_controller_(webrtc::Timestamp::Millis(4711)),
task_queue_factory_(time_controller_.CreateTaskQueueFactory()),
- call_(webrtc::Call::Create([&] {
- webrtc::Call::Config call_config(&event_log_);
+ call_(Call::Create([&] {
+ CallConfig call_config(&event_log_);
call_config.task_queue_factory = task_queue_factory_.get();
call_config.trials = &field_trials_;
return call_config;
@@ -401,7 +402,7 @@
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
// Used in WebRtcVideoEngineVoiceTest, but defined here so it's properly
// initialized when the constructor is called.
- std::unique_ptr<webrtc::Call> call_;
+ std::unique_ptr<Call> call_;
cricket::FakeWebRtcVideoEncoderFactory* encoder_factory_;
cricket::FakeWebRtcVideoDecoderFactory* decoder_factory_;
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
@@ -1443,11 +1444,11 @@
webrtc::GlobalSimulatedTimeController time_controller(
webrtc::Timestamp::Millis(4711));
auto task_queue_factory = time_controller.CreateTaskQueueFactory();
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
webrtc::FieldTrialBasedConfig field_trials;
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
- const auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ const std::unique_ptr<Call> call = Call::Create(call_config);
// Create send channel.
const int send_ssrc = 123;
@@ -1575,10 +1576,9 @@
class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
protected:
- webrtc::Call::Config GetCallConfig(
- webrtc::RtcEventLogNull* event_log,
- webrtc::TaskQueueFactory* task_queue_factory) {
- webrtc::Call::Config call_config(event_log);
+ CallConfig GetCallConfig(webrtc::RtcEventLogNull* event_log,
+ webrtc::TaskQueueFactory* task_queue_factory) {
+ CallConfig call_config(event_log);
call_config.task_queue_factory = task_queue_factory;
call_config.trials = &field_trials_;
return call_config;
@@ -1586,8 +1586,8 @@
WebRtcVideoChannelEncodedFrameCallbackTest()
: task_queue_factory_(time_controller_.CreateTaskQueueFactory()),
- call_(absl::WrapUnique(webrtc::Call::Create(
- GetCallConfig(&event_log_, task_queue_factory_.get())))),
+ call_(Call::Create(
+ GetCallConfig(&event_log_, task_queue_factory_.get()))),
video_bitrate_allocator_factory_(
webrtc::CreateBuiltinVideoBitrateAllocatorFactory()),
engine_(
@@ -1639,7 +1639,7 @@
webrtc::test::ScopedKeyValueConfig field_trials_;
webrtc::RtcEventLogNull event_log_;
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
- std::unique_ptr<webrtc::Call> call_;
+ std::unique_ptr<Call> call_;
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory_;
WebRtcVideoEngine engine_;
@@ -1775,10 +1775,10 @@
void SetUp() override {
// One testcase calls SetUp in a loop, only create call_ once.
if (!call_) {
- webrtc::Call::Config call_config(&event_log_);
+ CallConfig call_config(&event_log_);
call_config.task_queue_factory = task_queue_factory_.get();
call_config.trials = &field_trials_;
- call_.reset(webrtc::Call::Create(call_config));
+ call_ = Call::Create(call_config);
}
cricket::MediaConfig media_config;
@@ -1981,7 +1981,7 @@
webrtc::test::ScopedKeyValueConfig field_trials_;
std::unique_ptr<webrtc::test::ScopedKeyValueConfig> override_field_trials_;
std::unique_ptr<webrtc::TaskQueueFactory> task_queue_factory_;
- std::unique_ptr<webrtc::Call> call_;
+ std::unique_ptr<Call> call_;
std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
video_bitrate_allocator_factory_;
WebRtcVideoEngine engine_;
@@ -6777,7 +6777,7 @@
TEST_F(WebRtcVideoChannelTest, TranslatesCallStatsCorrectly) {
AddSendStream();
AddSendStream();
- webrtc::Call::Stats stats;
+ Call::Stats stats;
stats.rtt_ms = 123;
fake_call_->SetStats(stats);
diff --git a/media/engine/webrtc_voice_engine_unittest.cc b/media/engine/webrtc_voice_engine_unittest.cc
index 0a3c592..b1393ee 100644
--- a/media/engine/webrtc_voice_engine_unittest.cc
+++ b/media/engine/webrtc_voice_engine_unittest.cc
@@ -55,6 +55,8 @@
using ::testing::SaveArg;
using ::testing::StrictMock;
using ::testing::UnorderedElementsAreArray;
+using ::webrtc::Call;
+using ::webrtc::CallConfig;
namespace {
using webrtc::BitrateConstraints;
@@ -3690,10 +3692,10 @@
nullptr, nullptr, field_trials);
engine.Init();
webrtc::RtcEventLogNull event_log;
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
- auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ std::unique_ptr<Call> call = Call::Create(call_config);
std::unique_ptr<cricket::VoiceMediaSendChannelInterface> send_channel =
engine.CreateSendChannel(
call.get(), cricket::MediaConfig(), cricket::AudioOptions(),
@@ -3726,10 +3728,10 @@
nullptr, nullptr, field_trials);
engine.Init();
webrtc::RtcEventLogNull event_log;
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
- auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ std::unique_ptr<Call> call = Call::Create(call_config);
std::unique_ptr<cricket::VoiceMediaSendChannelInterface> send_channel =
engine.CreateSendChannel(
call.get(), cricket::MediaConfig(), cricket::AudioOptions(),
@@ -3816,10 +3818,10 @@
nullptr, nullptr, field_trials);
engine.Init();
webrtc::RtcEventLogNull event_log;
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
- auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ std::unique_ptr<Call> call = Call::Create(call_config);
std::vector<std::unique_ptr<cricket::VoiceMediaSendChannelInterface>>
channels;
@@ -3862,10 +3864,10 @@
nullptr, field_trials);
engine.Init();
webrtc::RtcEventLogNull event_log;
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
- auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ std::unique_ptr<Call> call = Call::Create(call_config);
cricket::WebRtcVoiceReceiveChannel channel(
&engine, cricket::MediaConfig(), cricket::AudioOptions(),
webrtc::CryptoOptions(), call.get(),
@@ -3891,7 +3893,7 @@
field_trials);
engine.Init();
webrtc::RtcEventLogNull event_log;
- webrtc::Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.trials = &field_trials;
call_config.task_queue_factory = task_queue_factory.get();
{
@@ -3901,7 +3903,7 @@
webrtc::test::MockAudioDeviceModule::CreateNice();
call_config.audio_state = webrtc::AudioState::Create(config);
}
- auto call = absl::WrapUnique(webrtc::Call::Create(call_config));
+ std::unique_ptr<Call> call = Call::Create(call_config);
cricket::WebRtcVoiceSendChannel channel(
&engine, cricket::MediaConfig(), cricket::AudioOptions(),
webrtc::CryptoOptions(), call.get(), webrtc::AudioCodecPairId::Create());
diff --git a/pc/peer_connection_factory.cc b/pc/peer_connection_factory.cc
index d933ba6..81780cf 100644
--- a/pc/peer_connection_factory.cc
+++ b/pc/peer_connection_factory.cc
@@ -301,7 +301,7 @@
const PeerConnectionInterface::RTCConfiguration& configuration) {
RTC_DCHECK_RUN_ON(worker_thread());
- webrtc::Call::Config call_config(event_log, network_thread());
+ CallConfig call_config(event_log, network_thread());
if (!media_engine() || !context_->call_factory()) {
return nullptr;
}
@@ -342,8 +342,7 @@
transport_controller_send_factory_.get();
call_config.metronome = metronome_.get();
call_config.pacer_burst_interval = configuration.pacer_burst_interval;
- return std::unique_ptr<Call>(
- context_->call_factory()->CreateCall(call_config));
+ return context_->call_factory()->CreateCall(call_config);
}
bool PeerConnectionFactory::IsTrialEnabled(absl::string_view key) const {
diff --git a/rtc_tools/video_replay.cc b/rtc_tools/video_replay.cc
index c8bfec2..b19850e 100644
--- a/rtc_tools/video_replay.cc
+++ b/rtc_tools/video_replay.cc
@@ -494,10 +494,10 @@
"worker_thread", TaskQueueFactory::Priority::NORMAL));
rtc::Event event;
worker_thread_->PostTask([&]() {
- Call::Config call_config(&event_log_);
+ CallConfig call_config(&event_log_);
call_config.trials = field_trials_.get();
call_config.task_queue_factory = task_queue_factory;
- call_.reset(Call::Create(call_config));
+ call_ = Call::Create(call_config);
// Creation of the streams must happen inside a task queue because it is
// resued as a worker thread.
diff --git a/test/call_test.cc b/test/call_test.cc
index b8a1cd7..2b71608 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -97,7 +97,7 @@
num_audio_streams_ = test->GetNumAudioStreams();
num_flexfec_streams_ = test->GetNumFlexfecStreams();
RTC_DCHECK(num_video_streams_ > 0 || num_audio_streams_ > 0);
- Call::Config send_config(send_event_log_.get());
+ CallConfig send_config(send_event_log_.get());
test->ModifySenderBitrateConfig(&send_config.bitrate_config);
if (num_audio_streams_ > 0) {
CreateFakeAudioDevices(test->CreateCapturer(), test->CreateRenderer());
@@ -117,7 +117,7 @@
}
CreateSenderCall(send_config);
if (test->ShouldCreateReceivers()) {
- Call::Config recv_config(recv_event_log_.get());
+ CallConfig recv_config(recv_event_log_.get());
test->ModifyReceiverBitrateConfig(&recv_config.bitrate_config);
if (num_audio_streams_ > 0) {
AudioState::Config audio_state_config;
@@ -207,35 +207,35 @@
}
void CallTest::CreateCalls() {
- CreateCalls(Call::Config(send_event_log_.get()),
- Call::Config(recv_event_log_.get()));
+ CreateCalls(CallConfig(send_event_log_.get()),
+ CallConfig(recv_event_log_.get()));
}
-void CallTest::CreateCalls(const Call::Config& sender_config,
- const Call::Config& receiver_config) {
+void CallTest::CreateCalls(const CallConfig& sender_config,
+ const CallConfig& receiver_config) {
CreateSenderCall(sender_config);
CreateReceiverCall(receiver_config);
}
void CallTest::CreateSenderCall() {
- CreateSenderCall(Call::Config(send_event_log_.get()));
+ CreateSenderCall(CallConfig(send_event_log_.get()));
}
-void CallTest::CreateSenderCall(const Call::Config& config) {
+void CallTest::CreateSenderCall(const CallConfig& config) {
auto sender_config = config;
sender_config.task_queue_factory = task_queue_factory_.get();
sender_config.network_state_predictor_factory =
network_state_predictor_factory_.get();
sender_config.network_controller_factory = network_controller_factory_.get();
sender_config.trials = &field_trials_;
- sender_call_.reset(Call::Create(sender_config));
+ sender_call_ = Call::Create(sender_config);
}
-void CallTest::CreateReceiverCall(const Call::Config& config) {
+void CallTest::CreateReceiverCall(const CallConfig& config) {
auto receiver_config = config;
receiver_config.task_queue_factory = task_queue_factory_.get();
receiver_config.trials = &field_trials_;
- receiver_call_.reset(Call::Create(receiver_config));
+ receiver_call_ = Call::Create(receiver_config);
}
void CallTest::DestroyCalls() {
diff --git a/test/call_test.h b/test/call_test.h
index 08d0e49..8d2b001 100644
--- a/test/call_test.h
+++ b/test/call_test.h
@@ -63,11 +63,11 @@
void RunBaseTest(BaseTest* test);
void CreateCalls();
- void CreateCalls(const Call::Config& sender_config,
- const Call::Config& receiver_config);
+ void CreateCalls(const CallConfig& sender_config,
+ const CallConfig& receiver_config);
void CreateSenderCall();
- void CreateSenderCall(const Call::Config& config);
- void CreateReceiverCall(const Call::Config& config);
+ void CreateSenderCall(const CallConfig& config);
+ void CreateReceiverCall(const CallConfig& config);
void DestroyCalls();
void CreateVideoSendConfig(VideoSendStream::Config* video_config,
diff --git a/test/fuzzers/utils/rtp_replayer.cc b/test/fuzzers/utils/rtp_replayer.cc
index 83f894d..f6d7119 100644
--- a/test/fuzzers/utils/rtp_replayer.cc
+++ b/test/fuzzers/utils/rtp_replayer.cc
@@ -76,7 +76,7 @@
webrtc::RtcEventLogNull event_log;
std::unique_ptr<TaskQueueFactory> task_queue_factory =
CreateDefaultTaskQueueFactory();
- Call::Config call_config(&event_log);
+ CallConfig call_config(&event_log);
call_config.task_queue_factory = task_queue_factory.get();
FieldTrialBasedConfig field_trials;
call_config.trials = &field_trials;
diff --git a/test/scenario/call_client.cc b/test/scenario/call_client.cc
index d2019ae..fdf36de 100644
--- a/test/scenario/call_client.cc
+++ b/test/scenario/call_client.cc
@@ -59,11 +59,12 @@
return setup;
}
-Call* CreateCall(TimeController* time_controller,
- RtcEventLog* event_log,
- CallClientConfig config,
- LoggingNetworkControllerFactory* network_controller_factory,
- rtc::scoped_refptr<AudioState> audio_state) {
+std::unique_ptr<Call> CreateCall(
+ TimeController* time_controller,
+ RtcEventLog* event_log,
+ CallClientConfig config,
+ LoggingNetworkControllerFactory* network_controller_factory,
+ rtc::scoped_refptr<AudioState> audio_state) {
CallConfig call_config(event_log);
call_config.bitrate_config.max_bitrate_bps =
config.transport.rates.max_rate.bps_or(-1);
@@ -230,9 +231,9 @@
log_writer_factory_.get());
fake_audio_setup_ = InitAudio(time_controller_);
- call_.reset(CreateCall(time_controller_, event_log_.get(), config,
- &network_controller_factory_,
- fake_audio_setup_.audio_state));
+ call_ =
+ CreateCall(time_controller_, event_log_.get(), config,
+ &network_controller_factory_, fake_audio_setup_.audio_state);
transport_ = std::make_unique<NetworkNodeTransport>(clock_, call_.get());
});
}
diff --git a/video/end_to_end_tests/multi_stream_tester.cc b/video/end_to_end_tests/multi_stream_tester.cc
index 8d99329..1eb388c 100644
--- a/video/end_to_end_tests/multi_stream_tester.cc
+++ b/video/end_to_end_tests/multi_stream_tester.cc
@@ -14,7 +14,6 @@
#include <utility>
#include <vector>
-#include "absl/memory/memory.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/task_queue/task_queue_base.h"
@@ -50,7 +49,7 @@
// to make test more stable.
auto task_queue = task_queue_factory->CreateTaskQueue(
"TaskQueue", TaskQueueFactory::Priority::HIGH);
- Call::Config config(&event_log);
+ CallConfig config(&event_log);
test::ScopedKeyValueConfig field_trials;
config.trials = &field_trials;
config.task_queue_factory = task_queue_factory.get();
@@ -69,8 +68,8 @@
InternalDecoderFactory decoder_factory;
SendTask(task_queue.get(), [&]() {
- sender_call = absl::WrapUnique(Call::Create(config));
- receiver_call = absl::WrapUnique(Call::Create(config));
+ sender_call = Call::Create(config);
+ receiver_call = Call::Create(config);
sender_transport = CreateSendTransport(task_queue.get(), sender_call.get());
receiver_transport =
CreateReceiveTransport(task_queue.get(), receiver_call.get());
diff --git a/video/end_to_end_tests/network_state_tests.cc b/video/end_to_end_tests/network_state_tests.cc
index 4d43f76..7bc9f14 100644
--- a/video/end_to_end_tests/network_state_tests.cc
+++ b/video/end_to_end_tests/network_state_tests.cc
@@ -94,7 +94,7 @@
SendTask(task_queue(), [this, network_to_bring_up, &encoder_factory,
transport]() {
- CreateSenderCall(Call::Config(send_event_log_.get()));
+ CreateSenderCall(CallConfig(send_event_log_.get()));
sender_call_->SignalChannelNetworkState(network_to_bring_up, kNetworkUp);
CreateSendConfig(1, 0, 0, transport);
diff --git a/video/end_to_end_tests/stats_tests.cc b/video/end_to_end_tests/stats_tests.cc
index 475a6cd..cc0b328 100644
--- a/video/end_to_end_tests/stats_tests.cc
+++ b/video/end_to_end_tests/stats_tests.cc
@@ -518,9 +518,9 @@
metrics::Reset();
- Call::Config send_config(send_event_log_.get());
+ CallConfig send_config(send_event_log_.get());
test.ModifySenderBitrateConfig(&send_config.bitrate_config);
- Call::Config recv_config(recv_event_log_.get());
+ CallConfig recv_config(recv_event_log_.get());
test.ModifyReceiverBitrateConfig(&recv_config.bitrate_config);
VideoEncoderConfig encoder_config_with_screenshare;
diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc
index 5eae8eb..4086cdf 100644
--- a/video/video_quality_test.cc
+++ b/video/video_quality_test.cc
@@ -1247,8 +1247,8 @@
}
SendTask(task_queue(), [this, ¶ms, &send_transport, &recv_transport]() {
- Call::Config send_call_config(send_event_log_.get());
- Call::Config recv_call_config(recv_event_log_.get());
+ CallConfig send_call_config(send_event_log_.get());
+ CallConfig recv_call_config(recv_event_log_.get());
send_call_config.bitrate_config = params.call.call_bitrate_config;
recv_call_config.bitrate_config = params.call.call_bitrate_config;
if (params_.audio.enabled)
@@ -1366,8 +1366,8 @@
#endif
}
-void VideoQualityTest::InitializeAudioDevice(Call::Config* send_call_config,
- Call::Config* recv_call_config,
+void VideoQualityTest::InitializeAudioDevice(CallConfig* send_call_config,
+ CallConfig* recv_call_config,
bool use_real_adm) {
rtc::scoped_refptr<AudioDeviceModule> audio_device;
if (use_real_adm) {
@@ -1473,11 +1473,11 @@
params_ = params;
CheckParamsAndInjectionComponents();
- // TODO(ivica): Remove bitrate_config and use the default Call::Config(), to
+ // TODO(ivica): Remove bitrate_config and use the default CallConfig(), to
// match the full stack tests.
- Call::Config send_call_config(send_event_log_.get());
+ CallConfig send_call_config(send_event_log_.get());
send_call_config.bitrate_config = params_.call.call_bitrate_config;
- Call::Config recv_call_config(recv_event_log_.get());
+ CallConfig recv_call_config(recv_event_log_.get());
if (params_.audio.enabled)
InitializeAudioDevice(&send_call_config, &recv_call_config,
diff --git a/video/video_quality_test.h b/video/video_quality_test.h
index f66256e..63fa481 100644
--- a/video/video_quality_test.h
+++ b/video/video_quality_test.h
@@ -90,8 +90,8 @@
void DestroyThumbnailStreams();
// Helper method for creating a real ADM (using hardware) for all platforms.
rtc::scoped_refptr<AudioDeviceModule> CreateAudioDevice();
- void InitializeAudioDevice(Call::Config* send_call_config,
- Call::Config* recv_call_config,
+ void InitializeAudioDevice(CallConfig* send_call_config,
+ CallConfig* recv_call_config,
bool use_real_adm);
void SetupAudio(Transport* transport);