Delete NullEventFactory

A preparation for deleting EventFactory and EventWrapper, to instead
use rtc::Event directly.

Bug: webrtc:3380
Change-Id: I4c40daca9268e57b06d506d91e09365091c42ad6
Reviewed-on: https://webrtc-review.googlesource.com/c/109880
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25545}
This commit is contained in:
Niels Möller 2018-11-07 13:40:24 +01:00 committed by Commit Bot
parent e769ed90c3
commit d5659188a0
5 changed files with 4 additions and 50 deletions

View file

@ -850,7 +850,6 @@ if (rtc_include_tests) {
"session_info_unittest.cc",
"test/stream_generator.cc",
"test/stream_generator.h",
"test/test_util.h",
"timing_unittest.cc",
"utility/default_video_bitrate_allocator_unittest.cc",
"utility/frame_dropper_unittest.cc",

View file

@ -20,7 +20,6 @@
#include "modules/video_coding/media_opt_util.h"
#include "modules/video_coding/packet.h"
#include "modules/video_coding/test/stream_generator.h"
#include "modules/video_coding/test/test_util.h"
#include "rtc_base/location.h"
#include "system_wrappers/include/clock.h"
#include "system_wrappers/include/field_trial.h"
@ -220,9 +219,7 @@ class TestBasicJitterBuffer : public ::testing::TestWithParam<std::string>,
void SetUp() override {
clock_.reset(new SimulatedClock(0));
jitter_buffer_.reset(new VCMJitterBuffer(
clock_.get(),
std::unique_ptr<EventWrapper>(event_factory_.CreateEvent()), this,
this));
clock_.get(), absl::WrapUnique(EventWrapper::Create()), this, this));
jitter_buffer_->Start();
seq_num_ = 1234;
timestamp_ = 0;
@ -313,7 +310,6 @@ class TestBasicJitterBuffer : public ::testing::TestWithParam<std::string>,
uint8_t data_[1500];
std::unique_ptr<VCMPacket> packet_;
std::unique_ptr<SimulatedClock> clock_;
NullEventFactory event_factory_;
std::unique_ptr<VCMJitterBuffer> jitter_buffer_;
};
@ -339,9 +335,7 @@ class TestRunningJitterBuffer : public ::testing::TestWithParam<std::string>,
max_nack_list_size_ = 150;
oldest_packet_to_nack_ = 250;
jitter_buffer_ = new VCMJitterBuffer(
clock_.get(),
std::unique_ptr<EventWrapper>(event_factory_.CreateEvent()), this,
this);
clock_.get(), absl::WrapUnique(EventWrapper::Create()), this, this);
stream_generator_ = new StreamGenerator(0, clock_->TimeInMilliseconds());
jitter_buffer_->Start();
jitter_buffer_->SetNackSettings(max_nack_list_size_, oldest_packet_to_nack_,
@ -433,7 +427,6 @@ class TestRunningJitterBuffer : public ::testing::TestWithParam<std::string>,
VCMJitterBuffer* jitter_buffer_;
StreamGenerator* stream_generator_;
std::unique_ptr<SimulatedClock> clock_;
NullEventFactory event_factory_;
size_t max_nack_list_size_;
int oldest_packet_to_nack_;
uint8_t data_buffer_[kDataBufferSize];

View file

@ -18,7 +18,6 @@
#include "modules/video_coding/packet.h"
#include "modules/video_coding/receiver.h"
#include "modules/video_coding/test/stream_generator.h"
#include "modules/video_coding/test/test_util.h"
#include "modules/video_coding/timing.h"
#include "rtc_base/checks.h"
#include "system_wrappers/include/clock.h"
@ -31,7 +30,7 @@ class TestVCMReceiver : public ::testing::Test {
TestVCMReceiver()
: clock_(new SimulatedClock(0)),
timing_(clock_.get()),
receiver_(&timing_, clock_.get(), &event_factory_) {
receiver_(&timing_, clock_.get(), nullptr) {
stream_generator_.reset(
new StreamGenerator(0, clock_->TimeInMilliseconds()));
}
@ -81,7 +80,6 @@ class TestVCMReceiver : public ::testing::Test {
std::unique_ptr<SimulatedClock> clock_;
VCMTiming timing_;
NullEventFactory event_factory_;
VCMReceiver receiver_;
std::unique_ptr<StreamGenerator> stream_generator_;
};

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_
#define MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_
#include "system_wrappers/include/event_wrapper.h"
class NullEventFactory : public webrtc::EventFactory {
public:
virtual ~NullEventFactory() {}
webrtc::EventWrapper* CreateEvent() override { return new NullEvent; }
private:
// Private class to avoid more dependencies on it in tests.
class NullEvent : public webrtc::EventWrapper {
public:
~NullEvent() override {}
bool Set() override { return true; }
webrtc::EventTypeWrapper Wait(unsigned long max_time) override { // NOLINT
return webrtc::kEventTimeout;
}
};
};
#endif // MODULES_VIDEO_CODING_TEST_TEST_UTIL_H_

View file

@ -14,7 +14,6 @@
#include "api/test/mock_video_decoder.h"
#include "modules/video_coding/include/mock/mock_vcm_callbacks.h"
#include "modules/video_coding/include/video_coding.h"
#include "modules/video_coding/test/test_util.h"
#include "modules/video_coding/timing.h"
#include "modules/video_coding/video_coding_impl.h"
#include "system_wrappers/include/clock.h"
@ -37,7 +36,7 @@ class TestVideoReceiver : public ::testing::Test {
virtual void SetUp() {
timing_.reset(new VCMTiming(&clock_));
receiver_.reset(new VideoReceiver(&clock_, &event_factory_, timing_.get()));
receiver_.reset(new VideoReceiver(&clock_, nullptr, timing_.get()));
receiver_->RegisterExternalDecoder(&decoder_, kUnusedPayloadType);
const size_t kMaxNackListSize = 250;
const int kMaxPacketAgeToNack = 450;
@ -81,7 +80,6 @@ class TestVideoReceiver : public ::testing::Test {
}
SimulatedClock clock_;
NullEventFactory event_factory_;
VideoCodec settings_;
NiceMock<MockVideoDecoder> decoder_;
NiceMock<MockPacketRequestCallback> packet_request_callback_;