From ed50e6c7596dbd02c3b01c93f73d880587183c22 Mon Sep 17 00:00:00 2001 From: Sebastian Jansson Date: Fri, 1 Mar 2019 14:45:21 +0100 Subject: [PATCH] Inject TaskQueueFactory in RtpTransportControllerSend. Bug: webrtc:10365 Change-Id: I1656dcf774fb347afd8b28aa998acff8942cdd9f Reviewed-on: https://webrtc-review.googlesource.com/c/125180 Reviewed-by: Stefan Holmer Cr-Commit-Position: refs/heads/master@{#26928} --- call/BUILD.gn | 3 +++ call/call.cc | 9 +++++---- call/rtp_transport_controller_send.cc | 10 +++++++--- call/rtp_transport_controller_send.h | 4 +++- call/rtp_video_sender_unittest.cc | 8 +++++++- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/call/BUILD.gn b/call/BUILD.gn index 5dec127e6b..d4c7e37ed2 100644 --- a/call/BUILD.gn +++ b/call/BUILD.gn @@ -37,11 +37,13 @@ rtc_source_set("call_interfaces") { "../api:transport_api", "../api/audio:audio_mixer_api", "../api/audio_codecs:audio_codecs_api", + "../api/task_queue", "../api/transport:network_control", "../modules/audio_device:audio_device", "../modules/audio_processing:api", "../modules/audio_processing:audio_processing", "../modules/audio_processing:audio_processing_statistics", + "../modules/utility:utility", "../rtc_base:audio_format_to_string", "../rtc_base:checks", "../rtc_base:rtc_base", @@ -364,6 +366,7 @@ if (rtc_include_tests) { "../api:mock_audio_mixer", "../api:transport_api", "../api/audio_codecs:builtin_audio_decoder_factory", + "../api/task_queue:global_task_queue_factory", "../api/video:video_frame", "../audio:audio", "../logging:rtc_event_log_api", diff --git a/call/call.cc b/call/call.cc index 6655e22ea8..b2f3239e3a 100644 --- a/call/call.cc +++ b/call/call.cc @@ -53,7 +53,6 @@ #include "rtc_base/sequenced_task_checker.h" #include "rtc_base/strings/string_builder.h" #include "rtc_base/synchronization/rw_lock_wrapper.h" -#include "rtc_base/task_queue.h" #include "rtc_base/thread_annotations.h" #include "rtc_base/time_utils.h" #include "rtc_base/trace_event.h" @@ -414,9 +413,11 @@ std::string Call::Stats::ToString(int64_t time_ms) const { Call* Call::Create(const Call::Config& config) { return new internal::Call( - config, absl::make_unique( - Clock::GetRealTimeClock(), config.event_log, - config.network_controller_factory, config.bitrate_config)); + config, + absl::make_unique( + Clock::GetRealTimeClock(), config.event_log, + config.network_controller_factory, config.bitrate_config, + ProcessThread::Create("PacerThread"), &GlobalTaskQueueFactory())); } // This method here to avoid subclasses has to implement this method. diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc index efec9d793c..b07e5ece57 100644 --- a/call/rtp_transport_controller_send.cc +++ b/call/rtp_transport_controller_send.cc @@ -59,11 +59,13 @@ RtpTransportControllerSend::RtpTransportControllerSend( Clock* clock, webrtc::RtcEventLog* event_log, NetworkControllerFactoryInterface* controller_factory, - const BitrateConstraints& bitrate_config) + const BitrateConstraints& bitrate_config, + std::unique_ptr process_thread, + TaskQueueFactory* task_queue_factory) : clock_(clock), pacer_(clock, &packet_router_, event_log), bitrate_configurator_(bitrate_config), - process_thread_(ProcessThread::Create("SendControllerThread")), + process_thread_(std::move(process_thread)), observer_(nullptr), controller_factory_override_(controller_factory), controller_factory_fallback_( @@ -79,7 +81,9 @@ RtpTransportControllerSend::RtpTransportControllerSend( transport_overhead_bytes_per_packet_(0), network_available_(false), retransmission_rate_limiter_(clock, kRetransmitWindowSizeMs), - task_queue_("rtp_send_controller") { + task_queue_(task_queue_factory->CreateTaskQueue( + "rtp_send_controller", + TaskQueueFactory::Priority::NORMAL)) { initial_config_.constraints = ConvertConstraints(bitrate_config, clock_); RTC_DCHECK(bitrate_config.start_bitrate_bps > 0); diff --git a/call/rtp_transport_controller_send.h b/call/rtp_transport_controller_send.h index ca70629330..c8a9f2cd4e 100644 --- a/call/rtp_transport_controller_send.h +++ b/call/rtp_transport_controller_send.h @@ -48,7 +48,9 @@ class RtpTransportControllerSend final Clock* clock, RtcEventLog* event_log, NetworkControllerFactoryInterface* controller_factory, - const BitrateConstraints& bitrate_config); + const BitrateConstraints& bitrate_config, + std::unique_ptr process_thread, + TaskQueueFactory* task_queue_factory); ~RtpTransportControllerSend() override; RtpVideoSenderInterface* CreateRtpVideoSender( diff --git a/call/rtp_video_sender_unittest.cc b/call/rtp_video_sender_unittest.cc index 192d185fe5..84306420a0 100644 --- a/call/rtp_video_sender_unittest.cc +++ b/call/rtp_video_sender_unittest.cc @@ -12,6 +12,7 @@ #include #include "absl/memory/memory.h" +#include "api/task_queue/global_task_queue_factory.h" #include "call/rtp_transport_controller_send.h" #include "call/rtp_video_sender.h" #include "modules/video_coding/fec_controller_default.h" @@ -82,7 +83,12 @@ class RtpVideoSenderTestFixture { : clock_(0), config_(&transport_), send_delay_stats_(&clock_), - transport_controller_(&clock_, &event_log_, nullptr, bitrate_config_), + transport_controller_(&clock_, + &event_log_, + nullptr, + bitrate_config_, + ProcessThread::Create("PacerThread"), + &GlobalTaskQueueFactory()), process_thread_(ProcessThread::Create("test_thread")), call_stats_(&clock_, process_thread_.get()), stats_proxy_(&clock_,