From 90705cbc414286806a39f715634d90c161ac9bb3 Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Mon, 1 Apr 2019 09:42:47 +0200 Subject: [PATCH] Move TaskQueueFactory from Call::Create parameter to CallConfig to decouple it from other optional parameters and with plan to make it mandatory Bug: webrtc:10284 Change-Id: I1224abd90d8e06e0ee2d2baaa6d0fd54f8caad2b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130470 Reviewed-by: Niels Moller Commit-Queue: Danil Chapovalov Cr-Commit-Position: refs/heads/master@{#27382} --- call/call.cc | 14 +++++++++----- call/call.h | 4 +--- call/call_config.h | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/call/call.cc b/call/call.cc index 3f7ef5ff22..e458c48391 100644 --- a/call/call.cc +++ b/call/call.cc @@ -424,16 +424,20 @@ std::string Call::Stats::ToString(int64_t time_ms) const { } Call* Call::Create(const Call::Config& config) { - return Create( - config, Clock::GetRealTimeClock(), ProcessThread::Create("PacerThread"), - ProcessThread::Create("ModuleProcessThread"), &GlobalTaskQueueFactory()); + return Create(config, Clock::GetRealTimeClock(), + ProcessThread::Create("PacerThread"), + ProcessThread::Create("ModuleProcessThread")); } Call* Call::Create(const Call::Config& config, Clock* clock, std::unique_ptr call_thread, - std::unique_ptr pacer_thread, - TaskQueueFactory* task_queue_factory) { + std::unique_ptr pacer_thread) { + // TODO(bugs.webrtc.org/10284): DCHECK task_queue_factory dependency is + // always provided in the config. + TaskQueueFactory* task_queue_factory = config.task_queue_factory + ? config.task_queue_factory + : &GlobalTaskQueueFactory(); return new internal::Call( clock, config, absl::make_unique( diff --git a/call/call.h b/call/call.h index 90977dab2c..1c29feec0f 100644 --- a/call/call.h +++ b/call/call.h @@ -16,7 +16,6 @@ #include #include "api/media_types.h" -#include "api/task_queue/task_queue_factory.h" #include "call/audio_receive_stream.h" #include "call/audio_send_stream.h" #include "call/call_config.h" @@ -54,8 +53,7 @@ class Call { static Call* Create(const Call::Config& config, Clock* clock, std::unique_ptr call_thread, - std::unique_ptr pacer_thread, - TaskQueueFactory* task_queue_factory); + std::unique_ptr pacer_thread); virtual AudioSendStream* CreateAudioSendStream( const AudioSendStream::Config& config) = 0; diff --git a/call/call_config.h b/call/call_config.h index 260a3accdd..eaac16b317 100644 --- a/call/call_config.h +++ b/call/call_config.h @@ -13,6 +13,7 @@ #include "api/bitrate_constraints.h" #include "api/fec_controller.h" #include "api/rtc_error.h" +#include "api/task_queue/task_queue_factory.h" #include "api/transport/network_control.h" #include "call/audio_state.h" @@ -45,6 +46,9 @@ struct CallConfig { // FecController to use for this call. FecControllerFactoryInterface* fec_controller_factory = nullptr; + // Task Queue Factory to be used in this call. + TaskQueueFactory* task_queue_factory = nullptr; + // Network controller factory to use for this call. NetworkControllerFactoryInterface* network_controller_factory = nullptr; };