Inject TaskQueueFactory in RtpTransportControllerSend.

Bug: webrtc:10365
Change-Id: I1656dcf774fb347afd8b28aa998acff8942cdd9f
Reviewed-on: https://webrtc-review.googlesource.com/c/125180
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26928}
This commit is contained in:
Sebastian Jansson
2019-03-01 14:45:21 +01:00
parent 4765013541
commit ed50e6c759
5 changed files with 25 additions and 9 deletions

View File

@ -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",

View File

@ -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<RtpTransportControllerSend>(
Clock::GetRealTimeClock(), config.event_log,
config.network_controller_factory, config.bitrate_config));
config,
absl::make_unique<RtpTransportControllerSend>(
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.

View File

@ -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<ProcessThread> 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);

View File

@ -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<ProcessThread> process_thread,
TaskQueueFactory* task_queue_factory);
~RtpTransportControllerSend() override;
RtpVideoSenderInterface* CreateRtpVideoSender(

View File

@ -12,6 +12,7 @@
#include <string>
#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_,