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}
This commit is contained in:
Danil Chapovalov 2023-10-13 13:53:00 +02:00 committed by WebRTC LUCI CQ
parent 9254df0f11
commit a3ce407023
22 changed files with 124 additions and 127 deletions

View File

@ -26,9 +26,9 @@ struct CallConfig;
// 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();

View File

@ -36,7 +36,7 @@ std::unique_ptr<CallFactoryInterface> CreateTimeControllerBasedCallFactory(
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(),

View File

@ -345,7 +345,6 @@ rtc_library("call") {
]
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 @@ if (rtc_include_tests) {
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",

View File

@ -184,7 +184,7 @@ class Call final : public webrtc::Call,
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 @@ class Call final : public webrtc::Call,
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 @@ std::string Call::Stats::ToString(int64_t time_ms) const {
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 @@ void Call::SendStats::SetMinAllocatableRate(BitrateAllocationLimits limits) {
}
Call::Call(Clock* clock,
const Call::Config& config,
const CallConfig& config,
std::unique_ptr<RtpTransportControllerSendInterface> transport_send,
TaskQueueFactory* task_queue_factory)
: clock_(clock),

View File

@ -46,8 +46,6 @@ namespace webrtc {
class Call {
public:
using Config = CallConfig;
struct Stats {
std::string ToString(int64_t time_ms) const;
@ -58,11 +56,12 @@ class Call {
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;

View File

@ -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 @@ CallFactory::CallFactory() {
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 @@ Call* CallFactory::CreateCall(const Call::Config& config) {
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

View File

@ -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 @@ namespace webrtc {
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_;
};

View File

@ -223,12 +223,12 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
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);

View File

@ -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::Contains;
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,

View File

@ -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::StrNe;
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 @@ class WebRtcVideoEngineTest : public ::testing::Test {
: 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 @@ class WebRtcVideoEngineTest : public ::testing::Test {
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 @@ TEST(WebRtcVideoEngineNewVideoCodecFactoryTest, Vp8) {
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 @@ TEST_F(WebRtcVideoEngineTest, SetVideoRtxEnabled) {
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 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
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 @@ class WebRtcVideoChannelEncodedFrameCallbackTest : public ::testing::Test {
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 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
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 @@ class WebRtcVideoChannelBaseTest : public ::testing::Test {
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, GetStatsTranslatesReceivePacketStatsCorrectly) {
TEST_F(WebRtcVideoChannelTest, TranslatesCallStatsCorrectly) {
AddSendStream();
AddSendStream();
webrtc::Call::Stats stats;
Call::Stats stats;
stats.rtt_ms = 123;
fake_call_->SetStats(stats);

View File

@ -55,6 +55,8 @@ using ::testing::ReturnPointee;
using ::testing::SaveArg;
using ::testing::StrictMock;
using ::testing::UnorderedElementsAreArray;
using ::webrtc::Call;
using ::webrtc::CallConfig;
namespace {
using webrtc::BitrateConstraints;
@ -3690,10 +3692,10 @@ TEST(WebRtcVoiceEngineTest, StartupShutdown) {
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 @@ TEST(WebRtcVoiceEngineTest, StartupShutdownWithExternalADM) {
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 @@ TEST(WebRtcVoiceEngineTest, Has32Channels) {
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 @@ TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
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 @@ TEST(WebRtcVoiceEngineTest, SetRtpSendParametersMaxBitrate) {
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 @@ TEST(WebRtcVoiceEngineTest, SetRtpSendParametersMaxBitrate) {
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());

View File

@ -301,7 +301,7 @@ std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
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 @@ std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
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 {

View File

@ -494,10 +494,10 @@ class RtpReplayer final {
"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.

View File

@ -97,7 +97,7 @@ void CallTest::RunBaseTest(BaseTest* test) {
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 @@ void CallTest::RunBaseTest(BaseTest* test) {
}
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::RunBaseTest(BaseTest* test) {
}
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() {

View File

@ -63,11 +63,11 @@ class CallTest : public ::testing::Test, public RtpPacketSinkInterface {
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,

View File

@ -76,7 +76,7 @@ void RtpReplayer::Replay(
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;

View File

@ -59,11 +59,12 @@ CallClientFakeAudio InitAudio(TimeController* time_controller) {
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 @@ CallClient::CallClient(
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());
});
}

View File

@ -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 @@ void MultiStreamTester::RunTest() {
// 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 @@ void MultiStreamTester::RunTest() {
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());

View File

@ -94,7 +94,7 @@ void NetworkStateEndToEndTest::VerifyNewVideoSendStreamsRespectNetworkState(
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);

View File

@ -518,9 +518,9 @@ TEST_F(StatsEndToEndTest, MAYBE_ContentTypeSwitches) {
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;

View File

@ -1247,8 +1247,8 @@ void VideoQualityTest::RunWithAnalyzer(const Params& params) {
}
SendTask(task_queue(), [this, &params, &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 @@ rtc::scoped_refptr<AudioDeviceModule> VideoQualityTest::CreateAudioDevice() {
#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 @@ void VideoQualityTest::RunWithRenderers(const Params& params) {
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,

View File

@ -90,8 +90,8 @@ class VideoQualityTest : public test::CallTest,
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);