Avoid using GlobalTaskQueueFactory for TaskQueueForTest

To remove global task factory, rtc::TaskQueue need to loose it's convenient constructor
TaskQueueForTest can be used instead in tests and keep the convenient constructor.

Also cleanup the TaskQueueForTest a bit:
move the class to webrtc namespace
add default constructor
disallow copy using language construct instead of macro
cleanup build dependencies
rename build target (to match move out of the rtc namespace)

Bug: webrtc:10284
Change-Id: I17fddf3f8d4f363df7d495c28a5b0a28abda1ba7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/127571
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27193}
This commit is contained in:
Danil Chapovalov
2019-03-19 18:08:37 +01:00
committed by Commit Bot
parent 10c5a93eb7
commit d26a916a80
14 changed files with 49 additions and 45 deletions

View File

@ -405,7 +405,7 @@ void VideoCodecTestFixtureImpl::RunTest(
// To emulate operation on a production VideoStreamEncoder, we call the
// codecs on a task queue.
rtc::test::TaskQueueForTest task_queue("VidProc TQ");
TaskQueueForTest task_queue("VidProc TQ");
SetUpAndInitObjects(&task_queue,
static_cast<const int>(rate_profiles[0].target_kbps),
@ -625,7 +625,7 @@ VideoCodecTestStats& VideoCodecTestFixtureImpl::GetStats() {
}
void VideoCodecTestFixtureImpl::SetUpAndInitObjects(
rtc::test::TaskQueueForTest* task_queue,
TaskQueueForTest* task_queue,
int initial_bitrate_kbps,
int initial_framerate_fps) {
config_.codec_settings.minBitrate = 0;
@ -681,7 +681,7 @@ void VideoCodecTestFixtureImpl::SetUpAndInitObjects(
}
void VideoCodecTestFixtureImpl::ReleaseAndCloseObjects(
rtc::test::TaskQueueForTest* task_queue) {
TaskQueueForTest* task_queue) {
task_queue->SendTask([this]() {
processor_.reset();
// The VideoProcessor must be destroyed before the codecs.
@ -702,7 +702,7 @@ void VideoCodecTestFixtureImpl::ReleaseAndCloseObjects(
}
void VideoCodecTestFixtureImpl::PrintSettings(
rtc::test::TaskQueueForTest* task_queue) const {
TaskQueueForTest* task_queue) const {
printf("==> Config\n");
printf("%s\n", config_.ToString().c_str());

View File

@ -62,10 +62,10 @@ class VideoCodecTestFixtureImpl : public VideoCodecTestFixture {
void CreateEncoderAndDecoder();
void DestroyEncoderAndDecoder();
void SetUpAndInitObjects(rtc::test::TaskQueueForTest* task_queue,
void SetUpAndInitObjects(TaskQueueForTest* task_queue,
int initial_bitrate_kbps,
int initial_framerate_fps);
void ReleaseAndCloseObjects(rtc::test::TaskQueueForTest* task_queue);
void ReleaseAndCloseObjects(TaskQueueForTest* task_queue);
void ProcessAllFrames(rtc::TaskQueue* task_queue,
const std::vector<RateProfile>& rate_profiles);
@ -83,7 +83,7 @@ class VideoCodecTestFixtureImpl : public VideoCodecTestFixture {
size_t target_bitrate_kbps,
float input_framerate_fps);
void PrintSettings(rtc::test::TaskQueueForTest* task_queue) const;
void PrintSettings(TaskQueueForTest* task_queue) const;
// Codecs.
const std::unique_ptr<VideoEncoderFactory> encoder_factory_;

View File

@ -77,7 +77,7 @@ class VideoProcessorTest : public testing::Test {
EXPECT_CALL(*decoder_mock_, RegisterDecodeCompleteCallback(_)).Times(1);
}
rtc::test::TaskQueueForTest q_;
TaskQueueForTest q_;
VideoCodecTestFixture::Config config_;