Stop using GlobalTaskQueueFactory in video unittests

instead use DefaultTaskQueueFactory directly

Bug: webrtc:10284
Change-Id: I58ae120cf185553d0145d7feb365deca90a93bc5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132401
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27610}
This commit is contained in:
Danil Chapovalov 2019-04-10 17:01:23 +02:00 committed by Commit Bot
parent 6a0aad9260
commit d3ba236686
5 changed files with 18 additions and 10 deletions

View File

@ -369,7 +369,7 @@ if (rtc_include_tests) {
"../api:rtp_headers",
"../api:transport_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
"../api/task_queue:global_task_queue_factory",
"../api/task_queue:default_task_queue_factory",
"../api/video:video_frame",
"../audio",
"../logging:rtc_event_log_api",

View File

@ -12,7 +12,7 @@
#include <string>
#include "absl/memory/memory.h"
#include "api/task_queue/global_task_queue_factory.h"
#include "api/task_queue/default_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"
@ -80,13 +80,14 @@ class RtpVideoSenderTestFixture {
: clock_(1000000),
config_(&transport_),
send_delay_stats_(&clock_),
task_queue_factory_(CreateDefaultTaskQueueFactory()),
transport_controller_(&clock_,
&event_log_,
nullptr,
nullptr,
bitrate_config_,
ProcessThread::Create("PacerThread"),
&GlobalTaskQueueFactory()),
task_queue_factory_.get()),
process_thread_(ProcessThread::Create("test_thread")),
call_stats_(&clock_, process_thread_.get()),
stats_proxy_(&clock_,
@ -127,6 +128,7 @@ class RtpVideoSenderTestFixture {
VideoSendStream::Config config_;
SendDelayStats send_delay_stats_;
BitrateConstraints bitrate_config_;
const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
RtpTransportControllerSend transport_controller_;
std::unique_ptr<ProcessThread> process_thread_;
CallStats call_stats_;

View File

@ -517,7 +517,6 @@ if (rtc_include_tests) {
"../api:scoped_refptr",
"../api:simulated_network_api",
"../api/task_queue:default_task_queue_factory",
"../api/task_queue:global_task_queue_factory",
"../api/test/video:function_video_factory",
"../api/units:data_rate",
"../api/video:builtin_video_bitrate_allocator_factory",

View File

@ -14,7 +14,7 @@
#include "test/gmock.h"
#include "test/gtest.h"
#include "api/task_queue/global_task_queue_factory.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/video_codecs/video_decoder.h"
#include "call/rtp_stream_receiver_controller.h"
#include "media/base/fake_video_renderer.h"
@ -73,6 +73,7 @@ class VideoReceiveStreamTest : public ::testing::Test {
public:
VideoReceiveStreamTest()
: process_thread_(ProcessThread::Create("TestThread")),
task_queue_factory_(CreateDefaultTaskQueueFactory()),
config_(&mock_transport_),
call_stats_(Clock::GetRealTimeClock(), process_thread_.get()),
h264_decoder_factory_(&mock_h264_video_decoder_),
@ -100,13 +101,14 @@ class VideoReceiveStreamTest : public ::testing::Test {
timing_ = new VCMTiming(clock);
video_receive_stream_.reset(new webrtc::internal::VideoReceiveStream(
&GlobalTaskQueueFactory(), &rtp_stream_receiver_controller_,
task_queue_factory_.get(), &rtp_stream_receiver_controller_,
kDefaultNumCpuCores, &packet_router_, config_.Copy(),
process_thread_.get(), &call_stats_, clock, timing_));
}
protected:
std::unique_ptr<ProcessThread> process_thread_;
const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
VideoReceiveStream::Config config_;
CallStats call_stats_;
MockVideoDecoder mock_h264_video_decoder_;

View File

@ -12,9 +12,10 @@
#include <algorithm>
#include <limits>
#include <memory>
#include <utility>
#include "api/task_queue/global_task_queue_factory.h"
#include "api/task_queue/default_task_queue_factory.h"
#include "api/video/builtin_video_bitrate_allocator_factory.h"
#include "api/video/i420_buffer.h"
#include "api/video/video_bitrate_allocation.h"
@ -99,7 +100,8 @@ class CpuOveruseDetectorProxy : public OveruseFrameDetector {
class VideoStreamEncoderUnderTest : public VideoStreamEncoder {
public:
VideoStreamEncoderUnderTest(SendStatisticsProxy* stats_proxy,
const VideoStreamEncoderSettings& settings)
const VideoStreamEncoderSettings& settings,
TaskQueueFactory* task_queue_factory)
: VideoStreamEncoder(Clock::GetRealTimeClock(),
1 /* number_of_cores */,
stats_proxy,
@ -107,7 +109,7 @@ class VideoStreamEncoderUnderTest : public VideoStreamEncoder {
std::unique_ptr<OveruseFrameDetector>(
overuse_detector_proxy_ =
new CpuOveruseDetectorProxy(stats_proxy)),
&GlobalTaskQueueFactory()) {}
task_queue_factory) {}
void PostTaskAndWait(bool down, AdaptReason reason) {
rtc::Event event;
@ -288,6 +290,7 @@ class VideoStreamEncoderTest : public ::testing::Test {
codec_width_(320),
codec_height_(240),
max_framerate_(kDefaultFramerate),
task_queue_factory_(CreateDefaultTaskQueueFactory()),
fake_encoder_(),
encoder_factory_(&fake_encoder_),
bitrate_allocator_factory_(CreateBuiltinVideoBitrateAllocatorFactory()),
@ -326,7 +329,8 @@ class VideoStreamEncoderTest : public ::testing::Test {
if (video_stream_encoder_)
video_stream_encoder_->Stop();
video_stream_encoder_.reset(new VideoStreamEncoderUnderTest(
stats_proxy_.get(), video_send_config_.encoder_settings));
stats_proxy_.get(), video_send_config_.encoder_settings,
task_queue_factory_.get()));
video_stream_encoder_->SetSink(&sink_, false /* rotation_applied */);
video_stream_encoder_->SetSource(
&video_source_, webrtc::DegradationPreference::MAINTAIN_FRAMERATE);
@ -902,6 +906,7 @@ class VideoStreamEncoderTest : public ::testing::Test {
int codec_width_;
int codec_height_;
int max_framerate_;
const std::unique_ptr<TaskQueueFactory> task_queue_factory_;
TestEncoder fake_encoder_;
test::VideoEncoderProxyFactory encoder_factory_;
std::unique_ptr<VideoBitrateAllocatorFactory> bitrate_allocator_factory_;