aboutsummaryrefslogtreecommitdiff
path: root/webrtc/test
diff options
context:
space:
mode:
Diffstat (limited to 'webrtc/test')
-rw-r--r--webrtc/test/BUILD.gn6
-rw-r--r--webrtc/test/call_test.cc394
-rw-r--r--webrtc/test/call_test.h111
-rw-r--r--webrtc/test/channel_transport/channel_transport.cc6
-rw-r--r--webrtc/test/channel_transport/channel_transport.h (renamed from webrtc/test/channel_transport/include/channel_transport.h)6
-rw-r--r--webrtc/test/channel_transport/udp_socket2_manager_win.cc21
-rw-r--r--webrtc/test/channel_transport/udp_socket2_manager_win.h6
-rw-r--r--webrtc/test/channel_transport/udp_socket2_win.cc10
-rw-r--r--webrtc/test/channel_transport/udp_socket_manager_posix.cc27
-rw-r--r--webrtc/test/channel_transport/udp_socket_manager_posix.h4
-rw-r--r--webrtc/test/common_unittest.cc3
-rw-r--r--webrtc/test/configurable_frame_size_encoder.cc4
-rw-r--r--webrtc/test/direct_transport.cc41
-rw-r--r--webrtc/test/direct_transport.h16
-rw-r--r--webrtc/test/fake_audio_device.cc19
-rw-r--r--webrtc/test/fake_audio_device.h4
-rw-r--r--webrtc/test/fake_decoder.cc6
-rw-r--r--webrtc/test/fake_decoder.h12
-rw-r--r--webrtc/test/fake_encoder.cc12
-rw-r--r--webrtc/test/fake_encoder.h9
-rw-r--r--webrtc/test/fake_network_pipe.cc22
-rw-r--r--webrtc/test/fake_network_pipe.h25
-rw-r--r--webrtc/test/fake_network_pipe_unittest.cc54
-rw-r--r--webrtc/test/fake_texture_frame.cc27
-rw-r--r--webrtc/test/fake_texture_frame.h22
-rw-r--r--webrtc/test/fake_voice_engine.cc70
-rw-r--r--webrtc/test/fake_voice_engine.h504
-rw-r--r--webrtc/test/field_trial.cc36
-rw-r--r--webrtc/test/field_trial.h3
-rw-r--r--webrtc/test/frame_generator_capturer.cc19
-rw-r--r--webrtc/test/frame_generator_capturer.h10
-rw-r--r--webrtc/test/fuzzers/BUILD.gn115
-rw-r--r--webrtc/test/fuzzers/OWNERS1
-rw-r--r--webrtc/test/fuzzers/audio_decoder_fuzzer.cc49
-rw-r--r--webrtc/test/fuzzers/audio_decoder_fuzzer.h31
-rw-r--r--webrtc/test/fuzzers/audio_decoder_ilbc_fuzzer.cc22
-rw-r--r--webrtc/test/fuzzers/audio_decoder_isac_fuzzer.cc22
-rw-r--r--webrtc/test/fuzzers/audio_decoder_isacfix_fuzzer.cc22
-rw-r--r--webrtc/test/fuzzers/audio_decoder_opus_fuzzer.cc23
-rw-r--r--webrtc/test/fuzzers/h264_depacketizer_fuzzer.cc18
-rw-r--r--webrtc/test/fuzzers/producer_fec_fuzzer.cc60
-rw-r--r--webrtc/test/fuzzers/vp8_depacketizer_fuzzer.cc18
-rw-r--r--webrtc/test/fuzzers/vp8_qp_parser_fuzzer.cc17
-rw-r--r--webrtc/test/fuzzers/vp9_depacketizer_fuzzer.cc18
-rw-r--r--webrtc/test/fuzzers/webrtc_fuzzer.gni28
-rw-r--r--webrtc/test/fuzzers/webrtc_fuzzer_main.cc41
-rw-r--r--webrtc/test/gl/gl_renderer.h6
-rw-r--r--webrtc/test/histogram.cc49
-rw-r--r--webrtc/test/histogram.h2
-rw-r--r--webrtc/test/layer_filtering_transport.cc61
-rw-r--r--webrtc/test/layer_filtering_transport.h17
-rw-r--r--webrtc/test/linux/glx_renderer.h6
-rw-r--r--webrtc/test/mac/video_renderer_mac.h6
-rw-r--r--webrtc/test/mock_voe_channel_proxy.h48
-rw-r--r--webrtc/test/mock_voice_engine.h337
-rw-r--r--webrtc/test/null_transport.h6
-rw-r--r--webrtc/test/random.cc57
-rw-r--r--webrtc/test/random.h49
-rw-r--r--webrtc/test/rtp_file_reader.cc2
-rw-r--r--webrtc/test/rtp_file_reader_unittest.cc3
-rw-r--r--webrtc/test/rtp_rtcp_observer.h22
-rw-r--r--webrtc/test/run_loop.h6
-rw-r--r--webrtc/test/statistics.h6
-rw-r--r--webrtc/test/test.gyp24
-rw-r--r--webrtc/test/test_main.cc6
-rw-r--r--webrtc/test/testsupport/fileutils_unittest.cc17
-rw-r--r--webrtc/test/testsupport/gtest_disable.h57
-rw-r--r--webrtc/test/vcm_capturer.cc2
-rw-r--r--webrtc/test/vcm_capturer.h8
-rw-r--r--webrtc/test/video_capturer.h6
-rw-r--r--webrtc/test/video_renderer.h6
-rw-r--r--webrtc/test/webrtc_test_common.gyp24
-rw-r--r--webrtc/test/win/d3d_renderer.h6
73 files changed, 1649 insertions, 1184 deletions
diff --git a/webrtc/test/BUILD.gn b/webrtc/test/BUILD.gn
index ed1dc75078..3ecd903522 100644
--- a/webrtc/test/BUILD.gn
+++ b/webrtc/test/BUILD.gn
@@ -27,6 +27,7 @@ source_set("field_trial") {
deps = [
"..:webrtc_common",
"../system_wrappers",
+ "../system_wrappers:field_trial_default",
]
configs += [ "..:common_config" ]
@@ -58,7 +59,6 @@ source_set("test_support") {
"testsupport/frame_reader.h",
"testsupport/frame_writer.cc",
"testsupport/frame_writer.h",
- "testsupport/gtest_disable.h",
"testsupport/mock/mock_frame_reader.h",
"testsupport/mock/mock_frame_writer.h",
"testsupport/packet_reader.cc",
@@ -70,10 +70,10 @@ source_set("test_support") {
]
deps = [
- "//testing/gmock",
- "//testing/gtest",
"..:gtest_prod",
"../system_wrappers",
+ "//testing/gmock",
+ "//testing/gtest",
]
if (is_android) {
diff --git a/webrtc/test/call_test.cc b/webrtc/test/call_test.cc
index 0a8b686974..e9651e33f5 100644
--- a/webrtc/test/call_test.cc
+++ b/webrtc/test/call_test.cc
@@ -7,8 +7,15 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/base/checks.h"
+#include "webrtc/common.h"
+#include "webrtc/config.h"
#include "webrtc/test/call_test.h"
#include "webrtc/test/encoder_settings.h"
+#include "webrtc/test/testsupport/fileutils.h"
+#include "webrtc/voice_engine/include/voe_base.h"
+#include "webrtc/voice_engine/include/voe_codec.h"
+#include "webrtc/voice_engine/include/voe_network.h"
namespace webrtc {
namespace test {
@@ -19,25 +26,43 @@ const int kVideoRotationRtpExtensionId = 4;
CallTest::CallTest()
: clock_(Clock::GetRealTimeClock()),
- send_config_(nullptr),
- send_stream_(NULL),
- fake_encoder_(clock_) {
-}
+ video_send_config_(nullptr),
+ video_send_stream_(nullptr),
+ audio_send_config_(nullptr),
+ audio_send_stream_(nullptr),
+ fake_encoder_(clock_),
+ num_video_streams_(1),
+ num_audio_streams_(0),
+ fake_send_audio_device_(nullptr),
+ fake_recv_audio_device_(nullptr) {}
CallTest::~CallTest() {
}
-void CallTest::RunBaseTest(BaseTest* test,
- const FakeNetworkPipe::Config& config) {
- CreateSenderCall(test->GetSenderCallConfig());
- if (test->ShouldCreateReceivers())
- CreateReceiverCall(test->GetReceiverCallConfig());
- send_transport_.reset(new PacketTransport(
- sender_call_.get(), test, test::PacketTransport::kSender, config));
- receive_transport_.reset(new PacketTransport(
- nullptr, test, test::PacketTransport::kReceiver, config));
- test->OnTransportsCreated(send_transport_.get(), receive_transport_.get());
+void CallTest::RunBaseTest(BaseTest* test) {
+ num_video_streams_ = test->GetNumVideoStreams();
+ num_audio_streams_ = test->GetNumAudioStreams();
+ RTC_DCHECK(num_video_streams_ > 0 || num_audio_streams_ > 0);
+ Call::Config send_config(test->GetSenderCallConfig());
+ if (num_audio_streams_ > 0) {
+ CreateVoiceEngines();
+ AudioState::Config audio_state_config;
+ audio_state_config.voice_engine = voe_send_.voice_engine;
+ send_config.audio_state = AudioState::Create(audio_state_config);
+ }
+ CreateSenderCall(send_config);
+ if (test->ShouldCreateReceivers()) {
+ Call::Config recv_config(test->GetReceiverCallConfig());
+ if (num_audio_streams_ > 0) {
+ AudioState::Config audio_state_config;
+ audio_state_config.voice_engine = voe_recv_.voice_engine;
+ recv_config.audio_state = AudioState::Create(audio_state_config);
+ }
+ CreateReceiverCall(recv_config);
+ }
test->OnCallsCreated(sender_call_.get(), receiver_call_.get());
+ send_transport_.reset(test->CreateSendTransport(sender_call_.get()));
+ receive_transport_.reset(test->CreateReceiveTransport());
if (test->ShouldCreateReceivers()) {
send_transport_->SetReceiver(receiver_call_->Receiver());
@@ -48,16 +73,34 @@ void CallTest::RunBaseTest(BaseTest* test,
receive_transport_->SetReceiver(nullptr);
}
- CreateSendConfig(test->GetNumStreams(), send_transport_.get());
+ CreateSendConfig(num_video_streams_, num_audio_streams_,
+ send_transport_.get());
if (test->ShouldCreateReceivers()) {
CreateMatchingReceiveConfigs(receive_transport_.get());
}
- test->ModifyConfigs(&send_config_, &receive_configs_, &encoder_config_);
- CreateStreams();
- test->OnStreamsCreated(send_stream_, receive_streams_);
+ if (num_audio_streams_ > 0)
+ SetupVoiceEngineTransports(send_transport_.get(), receive_transport_.get());
+
+ if (num_video_streams_ > 0) {
+ test->ModifyVideoConfigs(&video_send_config_, &video_receive_configs_,
+ &video_encoder_config_);
+ }
+ if (num_audio_streams_ > 0)
+ test->ModifyAudioConfigs(&audio_send_config_, &audio_receive_configs_);
- CreateFrameGeneratorCapturer();
- test->OnFrameGeneratorCapturerCreated(frame_generator_capturer_.get());
+ if (num_video_streams_ > 0) {
+ CreateVideoStreams();
+ test->OnVideoStreamsCreated(video_send_stream_, video_receive_streams_);
+ }
+ if (num_audio_streams_ > 0) {
+ CreateAudioStreams();
+ test->OnAudioStreamsCreated(audio_send_stream_, audio_receive_streams_);
+ }
+
+ if (num_video_streams_ > 0) {
+ CreateFrameGeneratorCapturer();
+ test->OnFrameGeneratorCapturerCreated(frame_generator_capturer_.get());
+ }
Start();
test->PerformTest();
@@ -66,12 +109,28 @@ void CallTest::RunBaseTest(BaseTest* test,
Stop();
DestroyStreams();
+ DestroyCalls();
+ if (num_audio_streams_ > 0)
+ DestroyVoiceEngines();
}
void CallTest::Start() {
- send_stream_->Start();
- for (size_t i = 0; i < receive_streams_.size(); ++i)
- receive_streams_[i]->Start();
+ if (video_send_stream_)
+ video_send_stream_->Start();
+ for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
+ video_recv_stream->Start();
+ if (audio_send_stream_) {
+ fake_send_audio_device_->Start();
+ audio_send_stream_->Start();
+ EXPECT_EQ(0, voe_send_.base->StartSend(voe_send_.channel_id));
+ }
+ for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_)
+ audio_recv_stream->Start();
+ if (!audio_receive_streams_.empty()) {
+ fake_recv_audio_device_->Start();
+ EXPECT_EQ(0, voe_recv_.base->StartPlayout(voe_recv_.channel_id));
+ EXPECT_EQ(0, voe_recv_.base->StartReceive(voe_recv_.channel_id));
+ }
if (frame_generator_capturer_.get() != NULL)
frame_generator_capturer_->Start();
}
@@ -79,9 +138,22 @@ void CallTest::Start() {
void CallTest::Stop() {
if (frame_generator_capturer_.get() != NULL)
frame_generator_capturer_->Stop();
- for (size_t i = 0; i < receive_streams_.size(); ++i)
- receive_streams_[i]->Stop();
- send_stream_->Stop();
+ if (!audio_receive_streams_.empty()) {
+ fake_recv_audio_device_->Stop();
+ EXPECT_EQ(0, voe_recv_.base->StopReceive(voe_recv_.channel_id));
+ EXPECT_EQ(0, voe_recv_.base->StopPlayout(voe_recv_.channel_id));
+ }
+ for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_)
+ audio_recv_stream->Stop();
+ if (audio_send_stream_) {
+ fake_send_audio_device_->Stop();
+ EXPECT_EQ(0, voe_send_.base->StopSend(voe_send_.channel_id));
+ audio_send_stream_->Stop();
+ }
+ for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
+ video_recv_stream->Stop();
+ if (video_send_stream_)
+ video_send_stream_->Stop();
}
void CallTest::CreateCalls(const Call::Config& sender_config,
@@ -99,92 +171,203 @@ void CallTest::CreateReceiverCall(const Call::Config& config) {
}
void CallTest::DestroyCalls() {
- sender_call_.reset(nullptr);
- receiver_call_.reset(nullptr);
+ sender_call_.reset();
+ receiver_call_.reset();
}
-void CallTest::CreateSendConfig(size_t num_streams,
+void CallTest::CreateSendConfig(size_t num_video_streams,
+ size_t num_audio_streams,
Transport* send_transport) {
- assert(num_streams <= kNumSsrcs);
- send_config_ = VideoSendStream::Config(send_transport);
- send_config_.encoder_settings.encoder = &fake_encoder_;
- send_config_.encoder_settings.payload_name = "FAKE";
- send_config_.encoder_settings.payload_type = kFakeSendPayloadType;
- send_config_.rtp.extensions.push_back(
- RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId));
- encoder_config_.streams = test::CreateVideoStreams(num_streams);
- for (size_t i = 0; i < num_streams; ++i)
- send_config_.rtp.ssrcs.push_back(kSendSsrcs[i]);
- send_config_.rtp.extensions.push_back(
- RtpExtension(RtpExtension::kVideoRotation, kVideoRotationRtpExtensionId));
-}
-
-void CallTest::CreateMatchingReceiveConfigs(
- Transport* rtcp_send_transport) {
- assert(!send_config_.rtp.ssrcs.empty());
- assert(receive_configs_.empty());
- assert(allocated_decoders_.empty());
- VideoReceiveStream::Config config(rtcp_send_transport);
- config.rtp.remb = true;
- config.rtp.local_ssrc = kReceiverLocalSsrc;
- for (const RtpExtension& extension : send_config_.rtp.extensions)
- config.rtp.extensions.push_back(extension);
- for (size_t i = 0; i < send_config_.rtp.ssrcs.size(); ++i) {
- VideoReceiveStream::Decoder decoder =
- test::CreateMatchingDecoder(send_config_.encoder_settings);
- allocated_decoders_.push_back(decoder.decoder);
- config.decoders.clear();
- config.decoders.push_back(decoder);
- config.rtp.remote_ssrc = send_config_.rtp.ssrcs[i];
- receive_configs_.push_back(config);
+ RTC_DCHECK(num_video_streams <= kNumSsrcs);
+ RTC_DCHECK_LE(num_audio_streams, 1u);
+ RTC_DCHECK(num_audio_streams == 0 || voe_send_.channel_id >= 0);
+ if (num_video_streams > 0) {
+ video_send_config_ = VideoSendStream::Config(send_transport);
+ video_send_config_.encoder_settings.encoder = &fake_encoder_;
+ video_send_config_.encoder_settings.payload_name = "FAKE";
+ video_send_config_.encoder_settings.payload_type =
+ kFakeVideoSendPayloadType;
+ video_send_config_.rtp.extensions.push_back(
+ RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId));
+ video_encoder_config_.streams = test::CreateVideoStreams(num_video_streams);
+ for (size_t i = 0; i < num_video_streams; ++i)
+ video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[i]);
+ video_send_config_.rtp.extensions.push_back(RtpExtension(
+ RtpExtension::kVideoRotation, kVideoRotationRtpExtensionId));
+ }
+
+ if (num_audio_streams > 0) {
+ audio_send_config_ = AudioSendStream::Config(send_transport);
+ audio_send_config_.voe_channel_id = voe_send_.channel_id;
+ audio_send_config_.rtp.ssrc = kAudioSendSsrc;
+ }
+}
+
+void CallTest::CreateMatchingReceiveConfigs(Transport* rtcp_send_transport) {
+ RTC_DCHECK(video_receive_configs_.empty());
+ RTC_DCHECK(allocated_decoders_.empty());
+ if (num_video_streams_ > 0) {
+ RTC_DCHECK(!video_send_config_.rtp.ssrcs.empty());
+ VideoReceiveStream::Config video_config(rtcp_send_transport);
+ video_config.rtp.remb = true;
+ video_config.rtp.local_ssrc = kReceiverLocalVideoSsrc;
+ for (const RtpExtension& extension : video_send_config_.rtp.extensions)
+ video_config.rtp.extensions.push_back(extension);
+ for (size_t i = 0; i < video_send_config_.rtp.ssrcs.size(); ++i) {
+ VideoReceiveStream::Decoder decoder =
+ test::CreateMatchingDecoder(video_send_config_.encoder_settings);
+ allocated_decoders_.push_back(decoder.decoder);
+ video_config.decoders.clear();
+ video_config.decoders.push_back(decoder);
+ video_config.rtp.remote_ssrc = video_send_config_.rtp.ssrcs[i];
+ video_receive_configs_.push_back(video_config);
+ }
+ }
+
+ RTC_DCHECK(num_audio_streams_ <= 1);
+ if (num_audio_streams_ == 1) {
+ RTC_DCHECK(voe_send_.channel_id >= 0);
+ AudioReceiveStream::Config audio_config;
+ audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc;
+ audio_config.rtcp_send_transport = rtcp_send_transport;
+ audio_config.voe_channel_id = voe_recv_.channel_id;
+ audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc;
+ audio_receive_configs_.push_back(audio_config);
}
}
void CallTest::CreateFrameGeneratorCapturer() {
- VideoStream stream = encoder_config_.streams.back();
- frame_generator_capturer_.reset(
- test::FrameGeneratorCapturer::Create(send_stream_->Input(),
- stream.width,
- stream.height,
- stream.max_framerate,
- clock_));
+ VideoStream stream = video_encoder_config_.streams.back();
+ frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
+ video_send_stream_->Input(), stream.width, stream.height,
+ stream.max_framerate, clock_));
}
-void CallTest::CreateStreams() {
- assert(send_stream_ == NULL);
- assert(receive_streams_.empty());
+void CallTest::CreateFakeAudioDevices() {
+ fake_send_audio_device_.reset(new FakeAudioDevice(
+ clock_, test::ResourcePath("voice_engine/audio_long16", "pcm")));
+ fake_recv_audio_device_.reset(new FakeAudioDevice(
+ clock_, test::ResourcePath("voice_engine/audio_long16", "pcm")));
+}
- send_stream_ =
- sender_call_->CreateVideoSendStream(send_config_, encoder_config_);
+void CallTest::CreateVideoStreams() {
+ RTC_DCHECK(video_send_stream_ == nullptr);
+ RTC_DCHECK(video_receive_streams_.empty());
+ RTC_DCHECK(audio_send_stream_ == nullptr);
+ RTC_DCHECK(audio_receive_streams_.empty());
+
+ video_send_stream_ = sender_call_->CreateVideoSendStream(
+ video_send_config_, video_encoder_config_);
+ for (size_t i = 0; i < video_receive_configs_.size(); ++i) {
+ video_receive_streams_.push_back(
+ receiver_call_->CreateVideoReceiveStream(video_receive_configs_[i]));
+ }
+}
- for (size_t i = 0; i < receive_configs_.size(); ++i) {
- receive_streams_.push_back(
- receiver_call_->CreateVideoReceiveStream(receive_configs_[i]));
+void CallTest::CreateAudioStreams() {
+ audio_send_stream_ = sender_call_->CreateAudioSendStream(audio_send_config_);
+ for (size_t i = 0; i < audio_receive_configs_.size(); ++i) {
+ audio_receive_streams_.push_back(
+ receiver_call_->CreateAudioReceiveStream(audio_receive_configs_[i]));
}
+ CodecInst isac = {kAudioSendPayloadType, "ISAC", 16000, 480, 1, 32000};
+ EXPECT_EQ(0, voe_send_.codec->SetSendCodec(voe_send_.channel_id, isac));
}
void CallTest::DestroyStreams() {
- if (send_stream_ != NULL)
- sender_call_->DestroyVideoSendStream(send_stream_);
- send_stream_ = NULL;
- for (size_t i = 0; i < receive_streams_.size(); ++i)
- receiver_call_->DestroyVideoReceiveStream(receive_streams_[i]);
- receive_streams_.clear();
+ if (video_send_stream_)
+ sender_call_->DestroyVideoSendStream(video_send_stream_);
+ video_send_stream_ = nullptr;
+ for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
+ receiver_call_->DestroyVideoReceiveStream(video_recv_stream);
+
+ if (audio_send_stream_)
+ sender_call_->DestroyAudioSendStream(audio_send_stream_);
+ audio_send_stream_ = nullptr;
+ for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_)
+ receiver_call_->DestroyAudioReceiveStream(audio_recv_stream);
+ video_receive_streams_.clear();
+
allocated_decoders_.clear();
}
-const unsigned int CallTest::kDefaultTimeoutMs = 30 * 1000;
-const unsigned int CallTest::kLongTimeoutMs = 120 * 1000;
-const uint8_t CallTest::kSendPayloadType = 100;
-const uint8_t CallTest::kFakeSendPayloadType = 125;
+void CallTest::CreateVoiceEngines() {
+ CreateFakeAudioDevices();
+ voe_send_.voice_engine = VoiceEngine::Create();
+ voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine);
+ voe_send_.network = VoENetwork::GetInterface(voe_send_.voice_engine);
+ voe_send_.codec = VoECodec::GetInterface(voe_send_.voice_engine);
+ EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr));
+ Config voe_config;
+ voe_config.Set<VoicePacing>(new VoicePacing(true));
+ voe_send_.channel_id = voe_send_.base->CreateChannel(voe_config);
+ EXPECT_GE(voe_send_.channel_id, 0);
+
+ voe_recv_.voice_engine = VoiceEngine::Create();
+ voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine);
+ voe_recv_.network = VoENetwork::GetInterface(voe_recv_.voice_engine);
+ voe_recv_.codec = VoECodec::GetInterface(voe_recv_.voice_engine);
+ EXPECT_EQ(0, voe_recv_.base->Init(fake_recv_audio_device_.get(), nullptr));
+ voe_recv_.channel_id = voe_recv_.base->CreateChannel();
+ EXPECT_GE(voe_recv_.channel_id, 0);
+}
+
+void CallTest::SetupVoiceEngineTransports(PacketTransport* send_transport,
+ PacketTransport* recv_transport) {
+ voe_send_.transport_adapter.reset(
+ new internal::TransportAdapter(send_transport));
+ voe_send_.transport_adapter->Enable();
+ EXPECT_EQ(0, voe_send_.network->RegisterExternalTransport(
+ voe_send_.channel_id, *voe_send_.transport_adapter.get()));
+
+ voe_recv_.transport_adapter.reset(
+ new internal::TransportAdapter(recv_transport));
+ voe_recv_.transport_adapter->Enable();
+ EXPECT_EQ(0, voe_recv_.network->RegisterExternalTransport(
+ voe_recv_.channel_id, *voe_recv_.transport_adapter.get()));
+}
+
+void CallTest::DestroyVoiceEngines() {
+ voe_recv_.base->DeleteChannel(voe_recv_.channel_id);
+ voe_recv_.channel_id = -1;
+ voe_recv_.base->Release();
+ voe_recv_.base = nullptr;
+ voe_recv_.network->Release();
+ voe_recv_.network = nullptr;
+ voe_recv_.codec->Release();
+ voe_recv_.codec = nullptr;
+
+ voe_send_.base->DeleteChannel(voe_send_.channel_id);
+ voe_send_.channel_id = -1;
+ voe_send_.base->Release();
+ voe_send_.base = nullptr;
+ voe_send_.network->Release();
+ voe_send_.network = nullptr;
+ voe_send_.codec->Release();
+ voe_send_.codec = nullptr;
+
+ VoiceEngine::Delete(voe_send_.voice_engine);
+ voe_send_.voice_engine = nullptr;
+ VoiceEngine::Delete(voe_recv_.voice_engine);
+ voe_recv_.voice_engine = nullptr;
+}
+
+const int CallTest::kDefaultTimeoutMs = 30 * 1000;
+const int CallTest::kLongTimeoutMs = 120 * 1000;
+const uint8_t CallTest::kVideoSendPayloadType = 100;
+const uint8_t CallTest::kFakeVideoSendPayloadType = 125;
const uint8_t CallTest::kSendRtxPayloadType = 98;
const uint8_t CallTest::kRedPayloadType = 118;
const uint8_t CallTest::kRtxRedPayloadType = 99;
const uint8_t CallTest::kUlpfecPayloadType = 119;
+const uint8_t CallTest::kAudioSendPayloadType = 103;
const uint32_t CallTest::kSendRtxSsrcs[kNumSsrcs] = {0xBADCAFD, 0xBADCAFE,
0xBADCAFF};
-const uint32_t CallTest::kSendSsrcs[kNumSsrcs] = {0xC0FFED, 0xC0FFEE, 0xC0FFEF};
-const uint32_t CallTest::kReceiverLocalSsrc = 0x123456;
+const uint32_t CallTest::kVideoSendSsrcs[kNumSsrcs] = {0xC0FFED, 0xC0FFEE,
+ 0xC0FFEF};
+const uint32_t CallTest::kAudioSendSsrc = 0xDEADBEEF;
+const uint32_t CallTest::kReceiverLocalVideoSsrc = 0x123456;
+const uint32_t CallTest::kReceiverLocalAudioSsrc = 0x1234567;
const int CallTest::kNackRtpHistoryMs = 1000;
BaseTest::BaseTest(unsigned int timeout_ms) : RtpRtcpObserver(timeout_ms) {
@@ -204,23 +387,40 @@ Call::Config BaseTest::GetReceiverCallConfig() {
void BaseTest::OnCallsCreated(Call* sender_call, Call* receiver_call) {
}
-void BaseTest::OnTransportsCreated(PacketTransport* send_transport,
- PacketTransport* receive_transport) {}
+test::PacketTransport* BaseTest::CreateSendTransport(Call* sender_call) {
+ return new PacketTransport(sender_call, this, test::PacketTransport::kSender,
+ FakeNetworkPipe::Config());
+}
-size_t BaseTest::GetNumStreams() const {
+test::PacketTransport* BaseTest::CreateReceiveTransport() {
+ return new PacketTransport(nullptr, this, test::PacketTransport::kReceiver,
+ FakeNetworkPipe::Config());
+}
+
+size_t BaseTest::GetNumVideoStreams() const {
return 1;
}
-void BaseTest::ModifyConfigs(
+size_t BaseTest::GetNumAudioStreams() const {
+ return 0;
+}
+
+void BaseTest::ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStream::Config>* receive_configs,
- VideoEncoderConfig* encoder_config) {
-}
+ VideoEncoderConfig* encoder_config) {}
-void BaseTest::OnStreamsCreated(
+void BaseTest::OnVideoStreamsCreated(
VideoSendStream* send_stream,
- const std::vector<VideoReceiveStream*>& receive_streams) {
-}
+ const std::vector<VideoReceiveStream*>& receive_streams) {}
+
+void BaseTest::ModifyAudioConfigs(
+ AudioSendStream::Config* send_config,
+ std::vector<AudioReceiveStream::Config>* receive_configs) {}
+
+void BaseTest::OnAudioStreamsCreated(
+ AudioSendStream* send_stream,
+ const std::vector<AudioReceiveStream*>& receive_streams) {}
void BaseTest::OnFrameGeneratorCapturerCreated(
FrameGeneratorCapturer* frame_generator_capturer) {
diff --git a/webrtc/test/call_test.h b/webrtc/test/call_test.h
index cf024d9c65..251d7f6044 100644
--- a/webrtc/test/call_test.h
+++ b/webrtc/test/call_test.h
@@ -7,19 +7,26 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_TEST_COMMON_CALL_TEST_H_
-#define WEBRTC_TEST_COMMON_CALL_TEST_H_
+#ifndef WEBRTC_TEST_CALL_TEST_H_
+#define WEBRTC_TEST_CALL_TEST_H_
#include <vector>
#include "webrtc/call.h"
+#include "webrtc/call/transport_adapter.h"
#include "webrtc/system_wrappers/include/scoped_vector.h"
+#include "webrtc/test/fake_audio_device.h"
#include "webrtc/test/fake_decoder.h"
#include "webrtc/test/fake_encoder.h"
#include "webrtc/test/frame_generator_capturer.h"
#include "webrtc/test/rtp_rtcp_observer.h"
namespace webrtc {
+
+class VoEBase;
+class VoECodec;
+class VoENetwork;
+
namespace test {
class BaseTest;
@@ -27,25 +34,31 @@ class BaseTest;
class CallTest : public ::testing::Test {
public:
CallTest();
- ~CallTest();
+ virtual ~CallTest();
static const size_t kNumSsrcs = 3;
- static const unsigned int kDefaultTimeoutMs;
- static const unsigned int kLongTimeoutMs;
- static const uint8_t kSendPayloadType;
+ static const int kDefaultTimeoutMs;
+ static const int kLongTimeoutMs;
+ static const uint8_t kVideoSendPayloadType;
static const uint8_t kSendRtxPayloadType;
- static const uint8_t kFakeSendPayloadType;
+ static const uint8_t kFakeVideoSendPayloadType;
static const uint8_t kRedPayloadType;
static const uint8_t kRtxRedPayloadType;
static const uint8_t kUlpfecPayloadType;
+ static const uint8_t kAudioSendPayloadType;
static const uint32_t kSendRtxSsrcs[kNumSsrcs];
- static const uint32_t kSendSsrcs[kNumSsrcs];
- static const uint32_t kReceiverLocalSsrc;
+ static const uint32_t kVideoSendSsrcs[kNumSsrcs];
+ static const uint32_t kAudioSendSsrc;
+ static const uint32_t kReceiverLocalVideoSsrc;
+ static const uint32_t kReceiverLocalAudioSsrc;
static const int kNackRtpHistoryMs;
protected:
- void RunBaseTest(BaseTest* test, const FakeNetworkPipe::Config& config);
+ // RunBaseTest overwrites the audio_state and the voice_engine of the send and
+ // receive Call configs to simplify test code and avoid having old VoiceEngine
+ // APIs in the tests.
+ void RunBaseTest(BaseTest* test);
void CreateCalls(const Call::Config& sender_config,
const Call::Config& receiver_config);
@@ -53,12 +66,16 @@ class CallTest : public ::testing::Test {
void CreateReceiverCall(const Call::Config& config);
void DestroyCalls();
- void CreateSendConfig(size_t num_streams, Transport* send_transport);
+ void CreateSendConfig(size_t num_video_streams,
+ size_t num_audio_streams,
+ Transport* send_transport);
void CreateMatchingReceiveConfigs(Transport* rtcp_send_transport);
void CreateFrameGeneratorCapturer();
+ void CreateFakeAudioDevices();
- void CreateStreams();
+ void CreateVideoStreams();
+ void CreateAudioStreams();
void Start();
void Stop();
void DestroyStreams();
@@ -67,18 +84,57 @@ class CallTest : public ::testing::Test {
rtc::scoped_ptr<Call> sender_call_;
rtc::scoped_ptr<PacketTransport> send_transport_;
- VideoSendStream::Config send_config_;
- VideoEncoderConfig encoder_config_;
- VideoSendStream* send_stream_;
+ VideoSendStream::Config video_send_config_;
+ VideoEncoderConfig video_encoder_config_;
+ VideoSendStream* video_send_stream_;
+ AudioSendStream::Config audio_send_config_;
+ AudioSendStream* audio_send_stream_;
rtc::scoped_ptr<Call> receiver_call_;
rtc::scoped_ptr<PacketTransport> receive_transport_;
- std::vector<VideoReceiveStream::Config> receive_configs_;
- std::vector<VideoReceiveStream*> receive_streams_;
+ std::vector<VideoReceiveStream::Config> video_receive_configs_;
+ std::vector<VideoReceiveStream*> video_receive_streams_;
+ std::vector<AudioReceiveStream::Config> audio_receive_configs_;
+ std::vector<AudioReceiveStream*> audio_receive_streams_;
rtc::scoped_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_;
test::FakeEncoder fake_encoder_;
ScopedVector<VideoDecoder> allocated_decoders_;
+ size_t num_video_streams_;
+ size_t num_audio_streams_;
+
+ private:
+ // TODO(holmer): Remove once VoiceEngine is fully refactored to the new API.
+ // These methods are used to set up legacy voice engines and channels which is
+ // necessary while voice engine is being refactored to the new stream API.
+ struct VoiceEngineState {
+ VoiceEngineState()
+ : voice_engine(nullptr),
+ base(nullptr),
+ network(nullptr),
+ codec(nullptr),
+ channel_id(-1),
+ transport_adapter(nullptr) {}
+
+ VoiceEngine* voice_engine;
+ VoEBase* base;
+ VoENetwork* network;
+ VoECodec* codec;
+ int channel_id;
+ rtc::scoped_ptr<internal::TransportAdapter> transport_adapter;
+ };
+
+ void CreateVoiceEngines();
+ void SetupVoiceEngineTransports(PacketTransport* send_transport,
+ PacketTransport* recv_transport);
+ void DestroyVoiceEngines();
+
+ VoiceEngineState voe_send_;
+ VoiceEngineState voe_recv_;
+
+ // The audio devices must outlive the voice engines.
+ rtc::scoped_ptr<test::FakeAudioDevice> fake_send_audio_device_;
+ rtc::scoped_ptr<test::FakeAudioDevice> fake_recv_audio_device_;
};
class BaseTest : public RtpRtcpObserver {
@@ -89,22 +145,31 @@ class BaseTest : public RtpRtcpObserver {
virtual void PerformTest() = 0;
virtual bool ShouldCreateReceivers() const = 0;
- virtual size_t GetNumStreams() const;
+ virtual size_t GetNumVideoStreams() const;
+ virtual size_t GetNumAudioStreams() const;
virtual Call::Config GetSenderCallConfig();
virtual Call::Config GetReceiverCallConfig();
virtual void OnCallsCreated(Call* sender_call, Call* receiver_call);
- virtual void OnTransportsCreated(PacketTransport* send_transport,
- PacketTransport* receive_transport);
- virtual void ModifyConfigs(
+ virtual test::PacketTransport* CreateSendTransport(Call* sender_call);
+ virtual test::PacketTransport* CreateReceiveTransport();
+
+ virtual void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStream::Config>* receive_configs,
VideoEncoderConfig* encoder_config);
- virtual void OnStreamsCreated(
+ virtual void OnVideoStreamsCreated(
VideoSendStream* send_stream,
const std::vector<VideoReceiveStream*>& receive_streams);
+ virtual void ModifyAudioConfigs(
+ AudioSendStream::Config* send_config,
+ std::vector<AudioReceiveStream::Config>* receive_configs);
+ virtual void OnAudioStreamsCreated(
+ AudioSendStream* send_stream,
+ const std::vector<AudioReceiveStream*>& receive_streams);
+
virtual void OnFrameGeneratorCapturerCreated(
FrameGeneratorCapturer* frame_generator_capturer);
};
@@ -126,4 +191,4 @@ class EndToEndTest : public BaseTest {
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_TEST_COMMON_CALL_TEST_H_
+#endif // WEBRTC_TEST_CALL_TEST_H_
diff --git a/webrtc/test/channel_transport/channel_transport.cc b/webrtc/test/channel_transport/channel_transport.cc
index 25eb59d887..38eefe54a2 100644
--- a/webrtc/test/channel_transport/channel_transport.cc
+++ b/webrtc/test/channel_transport/channel_transport.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/test/channel_transport/include/channel_transport.h"
+#include "webrtc/test/channel_transport/channel_transport.h"
#include <stdio.h>
@@ -16,7 +16,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#endif
#include "webrtc/test/channel_transport/udp_transport.h"
-#include "webrtc/video_engine/vie_defines.h"
#include "webrtc/voice_engine/include/voe_network.h"
#if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
@@ -66,10 +65,11 @@ void VoiceChannelTransport::IncomingRTCPPacket(
}
int VoiceChannelTransport::SetLocalReceiver(uint16_t rtp_port) {
+ static const int kNumReceiveSocketBuffers = 500;
int return_value = socket_transport_->InitializeReceiveSockets(this,
rtp_port);
if (return_value == 0) {
- return socket_transport_->StartReceiving(kViENumReceiveSocketBuffers);
+ return socket_transport_->StartReceiving(kNumReceiveSocketBuffers);
}
return return_value;
}
diff --git a/webrtc/test/channel_transport/include/channel_transport.h b/webrtc/test/channel_transport/channel_transport.h
index 8b84517de0..bab7c59181 100644
--- a/webrtc/test/channel_transport/include/channel_transport.h
+++ b/webrtc/test/channel_transport/channel_transport.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_TEST_CHANNEL_TRANSPORT_INCLUDE_CHANNEL_TRANSPORT_H_
-#define WEBRTC_TEST_CHANNEL_TRANSPORT_INCLUDE_CHANNEL_TRANSPORT_H_
+#ifndef WEBRTC_TEST_CHANNEL_TRANSPORT_CHANNEL_TRANSPORT_H_
+#define WEBRTC_TEST_CHANNEL_TRANSPORT_CHANNEL_TRANSPORT_H_
#include "webrtc/test/channel_transport/udp_transport.h"
@@ -53,4 +53,4 @@ class VoiceChannelTransport : public UdpTransportData {
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_TEST_CHANNEL_TRANSPORT_INCLUDE_CHANNEL_TRANSPORT_H_
+#endif // WEBRTC_TEST_CHANNEL_TRANSPORT_CHANNEL_TRANSPORT_H_
diff --git a/webrtc/test/channel_transport/udp_socket2_manager_win.cc b/webrtc/test/channel_transport/udp_socket2_manager_win.cc
index 5a11abbd6e..9f40350287 100644
--- a/webrtc/test/channel_transport/udp_socket2_manager_win.cc
+++ b/webrtc/test/channel_transport/udp_socket2_manager_win.cc
@@ -520,8 +520,8 @@ int32_t UdpSocket2WorkerWindows::_numOfWorkers = 0;
UdpSocket2WorkerWindows::UdpSocket2WorkerWindows(HANDLE ioCompletionHandle)
: _ioCompletionHandle(ioCompletionHandle),
- _init(false)
-{
+ _pThread(Run, this, "UdpSocket2ManagerWindows_thread"),
+ _init(false) {
_workerNumber = _numOfWorkers++;
WEBRTC_TRACE(kTraceMemory, kTraceTransport, -1,
"UdpSocket2WorkerWindows created");
@@ -537,10 +537,9 @@ bool UdpSocket2WorkerWindows::Start()
{
WEBRTC_TRACE(kTraceStateInfo, kTraceTransport, -1,
"Start UdpSocket2WorkerWindows");
- if (!_pThread->Start())
- return false;
+ _pThread.Start();
- _pThread->SetPriority(kRealtimePriority);
+ _pThread.SetPriority(rtc::kRealtimePriority);
return true;
}
@@ -548,18 +547,14 @@ bool UdpSocket2WorkerWindows::Stop()
{
WEBRTC_TRACE(kTraceStateInfo, kTraceTransport, -1,
"Stop UdpSocket2WorkerWindows");
- return _pThread->Stop();
+ _pThread.Stop();
+ return true;
}
int32_t UdpSocket2WorkerWindows::Init()
{
- if(!_init)
- {
- const char* threadName = "UdpSocket2ManagerWindows_thread";
- _pThread = ThreadWrapper::CreateThread(Run, this, threadName);
- _init = true;
- }
- return 0;
+ _init = true;
+ return 0;
}
bool UdpSocket2WorkerWindows::Run(void* obj)
diff --git a/webrtc/test/channel_transport/udp_socket2_manager_win.h b/webrtc/test/channel_transport/udp_socket2_manager_win.h
index c6af03a702..e762dccd0d 100644
--- a/webrtc/test/channel_transport/udp_socket2_manager_win.h
+++ b/webrtc/test/channel_transport/udp_socket2_manager_win.h
@@ -17,7 +17,7 @@
#include "webrtc/system_wrappers/include/atomic32.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/event_wrapper.h"
-#include "webrtc/system_wrappers/include/thread_wrapper.h"
+#include "webrtc/base/platform_thread.h"
#include "webrtc/test/channel_transport/udp_socket2_win.h"
#include "webrtc/test/channel_transport/udp_socket_manager_wrapper.h"
#include "webrtc/test/channel_transport/udp_transport.h"
@@ -47,7 +47,7 @@ struct PerIoContext {
int fromLen;
// Should be set to true if the I/O context was passed to the system by
// a thread not controlled by the socket implementation.
- bool ioInitiatedByThreadWrapper;
+ bool ioInitiatedByPlatformThread;
// TODO (hellner): Not used. Delete it.
PerIoContext* pNextFree;
};
@@ -105,7 +105,7 @@ protected:
bool Process();
private:
HANDLE _ioCompletionHandle;
- rtc::scoped_ptr<ThreadWrapper> _pThread;
+ rtc::PlatformThread _pThread;
static int32_t _numOfWorkers;
int32_t _workerNumber;
volatile bool _stop;
diff --git a/webrtc/test/channel_transport/udp_socket2_win.cc b/webrtc/test/channel_transport/udp_socket2_win.cc
index 4c63dc938d..adeb46a9d2 100644
--- a/webrtc/test/channel_transport/udp_socket2_win.cc
+++ b/webrtc/test/channel_transport/udp_socket2_win.cc
@@ -432,13 +432,13 @@ void UdpSocket2Windows::IOCompleted(PerIoContext* pIOContext,
if(pIOContext == NULL || error == ERROR_OPERATION_ABORTED)
{
if ((pIOContext != NULL) &&
- !pIOContext->ioInitiatedByThreadWrapper &&
+ !pIOContext->ioInitiatedByPlatformThread &&
(error == ERROR_OPERATION_ABORTED) &&
(pIOContext->ioOperation == OP_READ) &&
_outstandingCallsDisabled)
{
- // !pIOContext->initiatedIOByThreadWrapper indicate that the I/O
- // was not initiated by a ThreadWrapper thread.
+ // !pIOContext->initiatedIOByPlatformThread indicate that the I/O
+ // was not initiated by a PlatformThread thread.
// This may happen if the thread that initiated receiving (e.g.
// by calling StartListen())) is deleted before any packets have
// been received.
@@ -519,7 +519,7 @@ void UdpSocket2Windows::IOCompleted(PerIoContext* pIOContext,
{
// The PerIoContext was posted by a thread controlled by the socket
// implementation.
- pIOContext->ioInitiatedByThreadWrapper = true;
+ pIOContext->ioInitiatedByPlatformThread = true;
}
OutstandingCallCompleted();
return;
@@ -546,7 +546,7 @@ int32_t UdpSocket2Windows::PostRecv()
}
// This function may have been called by thread not controlled by the socket
// implementation.
- pIoContext->ioInitiatedByThreadWrapper = false;
+ pIoContext->ioInitiatedByPlatformThread = false;
return PostRecv(pIoContext);
}
diff --git a/webrtc/test/channel_transport/udp_socket_manager_posix.cc b/webrtc/test/channel_transport/udp_socket_manager_posix.cc
index 145efcbc58..6b1a466bf2 100644
--- a/webrtc/test/channel_transport/udp_socket_manager_posix.cc
+++ b/webrtc/test/channel_transport/udp_socket_manager_posix.cc
@@ -184,12 +184,11 @@ bool UdpSocketManagerPosix::RemoveSocket(UdpSocketWrapper* s)
return retVal;
}
-
UdpSocketManagerPosixImpl::UdpSocketManagerPosixImpl()
-{
- _critSectList = CriticalSectionWrapper::CreateCriticalSection();
- _thread = ThreadWrapper::CreateThread(UdpSocketManagerPosixImpl::Run, this,
- "UdpSocketManagerPosixImplThread");
+ : _thread(UdpSocketManagerPosixImpl::Run,
+ this,
+ "UdpSocketManagerPosixImplThread"),
+ _critSectList(CriticalSectionWrapper::CreateCriticalSection()) {
FD_ZERO(&_readFds);
WEBRTC_TRACE(kTraceMemory, kTraceTransport, -1,
"UdpSocketManagerPosix created");
@@ -220,29 +219,19 @@ UdpSocketManagerPosixImpl::~UdpSocketManagerPosixImpl()
bool UdpSocketManagerPosixImpl::Start()
{
- if (!_thread)
- {
- return false;
- }
-
WEBRTC_TRACE(kTraceStateInfo, kTraceTransport, -1,
"Start UdpSocketManagerPosix");
- if (!_thread->Start())
- return false;
- _thread->SetPriority(kRealtimePriority);
+ _thread.Start();
+ _thread.SetPriority(rtc::kRealtimePriority);
return true;
}
bool UdpSocketManagerPosixImpl::Stop()
{
- if (!_thread)
- {
- return true;
- }
-
WEBRTC_TRACE(kTraceStateInfo, kTraceTransport, -1,
"Stop UdpSocketManagerPosix");
- return _thread->Stop();
+ _thread.Stop();
+ return true;
}
bool UdpSocketManagerPosixImpl::Process()
diff --git a/webrtc/test/channel_transport/udp_socket_manager_posix.h b/webrtc/test/channel_transport/udp_socket_manager_posix.h
index 64156fd20f..45e55af99a 100644
--- a/webrtc/test/channel_transport/udp_socket_manager_posix.h
+++ b/webrtc/test/channel_transport/udp_socket_manager_posix.h
@@ -17,8 +17,8 @@
#include <list>
#include <map>
+#include "webrtc/base/platform_thread.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/include/thread_wrapper.h"
#include "webrtc/test/channel_transport/udp_socket_manager_wrapper.h"
#include "webrtc/test/channel_transport/udp_socket_wrapper.h"
@@ -75,7 +75,7 @@ protected:
private:
typedef std::list<UdpSocketWrapper*> SocketList;
typedef std::list<SOCKET> FdList;
- rtc::scoped_ptr<ThreadWrapper> _thread;
+ rtc::PlatformThread _thread;
CriticalSectionWrapper* _critSectList;
fd_set _readFds;
diff --git a/webrtc/test/common_unittest.cc b/webrtc/test/common_unittest.cc
index 082c18c2c7..a239dade73 100644
--- a/webrtc/test/common_unittest.cc
+++ b/webrtc/test/common_unittest.cc
@@ -15,6 +15,7 @@ namespace webrtc {
namespace {
struct MyExperiment {
+ static const ConfigOptionID identifier = ConfigOptionID::kMyExperimentForTest;
static const int kDefaultFactor;
static const int kDefaultOffset;
@@ -56,6 +57,8 @@ TEST(Config, SetNullSetsTheOptionBackToDefault) {
}
struct Algo1_CostFunction {
+ static const ConfigOptionID identifier =
+ ConfigOptionID::kAlgo1CostFunctionForTest;
Algo1_CostFunction() {}
virtual int cost(int x) const {
diff --git a/webrtc/test/configurable_frame_size_encoder.cc b/webrtc/test/configurable_frame_size_encoder.cc
index 2cd47504a5..831e481bd8 100644
--- a/webrtc/test/configurable_frame_size_encoder.cc
+++ b/webrtc/test/configurable_frame_size_encoder.cc
@@ -14,8 +14,8 @@
#include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/common_video/interface/video_image.h"
-#include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
+#include "webrtc/common_video/include/video_image.h"
+#include "webrtc/modules/video_coding/include/video_codec_interface.h"
namespace webrtc {
namespace test {
diff --git a/webrtc/test/direct_transport.cc b/webrtc/test/direct_transport.cc
index 6dcba81c88..591e154b14 100644
--- a/webrtc/test/direct_transport.cc
+++ b/webrtc/test/direct_transport.cc
@@ -18,26 +18,17 @@ namespace webrtc {
namespace test {
DirectTransport::DirectTransport(Call* send_call)
- : send_call_(send_call),
- packet_event_(EventWrapper::Create()),
- thread_(
- ThreadWrapper::CreateThread(NetworkProcess, this, "NetworkProcess")),
- clock_(Clock::GetRealTimeClock()),
- shutting_down_(false),
- fake_network_(FakeNetworkPipe::Config()) {
- EXPECT_TRUE(thread_->Start());
-}
+ : DirectTransport(FakeNetworkPipe::Config(), send_call) {}
DirectTransport::DirectTransport(const FakeNetworkPipe::Config& config,
Call* send_call)
: send_call_(send_call),
- packet_event_(EventWrapper::Create()),
- thread_(
- ThreadWrapper::CreateThread(NetworkProcess, this, "NetworkProcess")),
+ packet_event_(false, false),
+ thread_(NetworkProcess, this, "NetworkProcess"),
clock_(Clock::GetRealTimeClock()),
shutting_down_(false),
- fake_network_(config) {
- EXPECT_TRUE(thread_->Start());
+ fake_network_(clock_, config) {
+ thread_.Start();
}
DirectTransport::~DirectTransport() { StopSending(); }
@@ -52,8 +43,8 @@ void DirectTransport::StopSending() {
shutting_down_ = true;
}
- packet_event_->Set();
- EXPECT_TRUE(thread_->Stop());
+ packet_event_.Set();
+ thread_.Stop();
}
void DirectTransport::SetReceiver(PacketReceiver* receiver) {
@@ -69,16 +60,20 @@ bool DirectTransport::SendRtp(const uint8_t* data,
send_call_->OnSentPacket(sent_packet);
}
fake_network_.SendPacket(data, length);
- packet_event_->Set();
+ packet_event_.Set();
return true;
}
bool DirectTransport::SendRtcp(const uint8_t* data, size_t length) {
fake_network_.SendPacket(data, length);
- packet_event_->Set();
+ packet_event_.Set();
return true;
}
+int DirectTransport::GetAverageDelayMs() {
+ return fake_network_.AverageDelay();
+}
+
bool DirectTransport::NetworkProcess(void* transport) {
return static_cast<DirectTransport*>(transport)->SendPackets();
}
@@ -87,15 +82,7 @@ bool DirectTransport::SendPackets() {
fake_network_.Process();
int64_t wait_time_ms = fake_network_.TimeUntilNextProcess();
if (wait_time_ms > 0) {
- switch (packet_event_->Wait(static_cast<unsigned long>(wait_time_ms))) {
- case kEventSignaled:
- break;
- case kEventTimeout:
- break;
- case kEventError:
- // TODO(pbos): Log a warning here?
- return true;
- }
+ packet_event_.Wait(static_cast<int>(wait_time_ms));
}
rtc::CritScope crit(&lock_);
return shutting_down_ ? false : true;
diff --git a/webrtc/test/direct_transport.h b/webrtc/test/direct_transport.h
index 241a5bc110..d68bc7184e 100644
--- a/webrtc/test/direct_transport.h
+++ b/webrtc/test/direct_transport.h
@@ -7,17 +7,17 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_DIRECT_TRANSPORT_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_DIRECT_TRANSPORT_H_
+#ifndef WEBRTC_TEST_DIRECT_TRANSPORT_H_
+#define WEBRTC_TEST_DIRECT_TRANSPORT_H_
#include <assert.h>
#include <deque>
#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/event.h"
+#include "webrtc/base/platform_thread.h"
#include "webrtc/base/scoped_ptr.h"
-#include "webrtc/system_wrappers/include/event_wrapper.h"
-#include "webrtc/system_wrappers/include/thread_wrapper.h"
#include "webrtc/test/fake_network_pipe.h"
#include "webrtc/transport.h"
@@ -46,14 +46,16 @@ class DirectTransport : public Transport {
const PacketOptions& options) override;
bool SendRtcp(const uint8_t* data, size_t length) override;
+ int GetAverageDelayMs();
+
private:
static bool NetworkProcess(void* transport);
bool SendPackets();
rtc::CriticalSection lock_;
Call* const send_call_;
- rtc::scoped_ptr<EventWrapper> packet_event_;
- rtc::scoped_ptr<ThreadWrapper> thread_;
+ rtc::Event packet_event_;
+ rtc::PlatformThread thread_;
Clock* const clock_;
bool shutting_down_;
@@ -63,4 +65,4 @@ class DirectTransport : public Transport {
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_DIRECT_TRANSPORT_H_
+#endif // WEBRTC_TEST_DIRECT_TRANSPORT_H_
diff --git a/webrtc/test/fake_audio_device.cc b/webrtc/test/fake_audio_device.cc
index e307dd7664..31cebda652 100644
--- a/webrtc/test/fake_audio_device.cc
+++ b/webrtc/test/fake_audio_device.cc
@@ -13,11 +13,11 @@
#include <algorithm>
#include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/modules/media_file/source/media_file_utility.h"
+#include "webrtc/base/platform_thread.h"
+#include "webrtc/modules/media_file/media_file_utility.h"
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/system_wrappers/include/event_wrapper.h"
#include "webrtc/system_wrappers/include/file_wrapper.h"
-#include "webrtc/system_wrappers/include/thread_wrapper.h"
namespace webrtc {
namespace test {
@@ -30,6 +30,7 @@ FakeAudioDevice::FakeAudioDevice(Clock* clock, const std::string& filename)
last_playout_ms_(-1),
clock_(clock),
tick_(EventTimerWrapper::Create()),
+ thread_(FakeAudioDevice::Run, this, "FakeAudioDevice"),
file_utility_(new ModuleFileUtility(0)),
input_stream_(FileWrapper::Create()) {
memset(captured_audio_, 0, sizeof(captured_audio_));
@@ -42,8 +43,7 @@ FakeAudioDevice::FakeAudioDevice(Clock* clock, const std::string& filename)
FakeAudioDevice::~FakeAudioDevice() {
Stop();
- if (thread_.get() != NULL)
- thread_->Stop();
+ thread_.Stop();
}
int32_t FakeAudioDevice::Init() {
@@ -53,15 +53,8 @@ int32_t FakeAudioDevice::Init() {
if (!tick_->StartTimer(true, 10))
return -1;
- thread_ = ThreadWrapper::CreateThread(FakeAudioDevice::Run, this,
- "FakeAudioDevice");
- if (thread_.get() == NULL)
- return -1;
- if (!thread_->Start()) {
- thread_.reset();
- return -1;
- }
- thread_->SetPriority(webrtc::kHighPriority);
+ thread_.Start();
+ thread_.SetPriority(rtc::kHighPriority);
return 0;
}
diff --git a/webrtc/test/fake_audio_device.h b/webrtc/test/fake_audio_device.h
index bdc672892c..7ca657bbb6 100644
--- a/webrtc/test/fake_audio_device.h
+++ b/webrtc/test/fake_audio_device.h
@@ -13,6 +13,7 @@
#include <string>
#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/platform_thread.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_device/include/fake_audio_device.h"
#include "webrtc/typedefs.h"
@@ -23,7 +24,6 @@ class Clock;
class EventTimerWrapper;
class FileWrapper;
class ModuleFileUtility;
-class ThreadWrapper;
namespace test {
@@ -59,7 +59,7 @@ class FakeAudioDevice : public FakeAudioDeviceModule {
Clock* clock_;
rtc::scoped_ptr<EventTimerWrapper> tick_;
mutable rtc::CriticalSection lock_;
- rtc::scoped_ptr<ThreadWrapper> thread_;
+ rtc::PlatformThread thread_;
rtc::scoped_ptr<ModuleFileUtility> file_utility_;
rtc::scoped_ptr<FileWrapper> input_stream_;
};
diff --git a/webrtc/test/fake_decoder.cc b/webrtc/test/fake_decoder.cc
index 63316e0dab..dbdd580e88 100644
--- a/webrtc/test/fake_decoder.cc
+++ b/webrtc/test/fake_decoder.cc
@@ -53,10 +53,16 @@ int32_t FakeDecoder::RegisterDecodeCompleteCallback(
int32_t FakeDecoder::Release() {
return WEBRTC_VIDEO_CODEC_OK;
}
+
int32_t FakeDecoder::Reset() {
return WEBRTC_VIDEO_CODEC_OK;
}
+const char* FakeDecoder::kImplementationName = "fake_decoder";
+const char* FakeDecoder::ImplementationName() const {
+ return kImplementationName;
+}
+
int32_t FakeH264Decoder::Decode(const EncodedImage& input,
bool missing_frames,
const RTPFragmentationHeader* fragmentation,
diff --git a/webrtc/test/fake_decoder.h b/webrtc/test/fake_decoder.h
index 593af512f8..0da961d9a0 100644
--- a/webrtc/test/fake_decoder.h
+++ b/webrtc/test/fake_decoder.h
@@ -8,12 +8,12 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_DECODER_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_DECODER_H_
+#ifndef WEBRTC_TEST_FAKE_DECODER_H_
+#define WEBRTC_TEST_FAKE_DECODER_H_
#include <vector>
-#include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
+#include "webrtc/modules/video_coding/include/video_codec_interface.h"
#include "webrtc/system_wrappers/include/clock.h"
namespace webrtc {
@@ -39,6 +39,10 @@ class FakeDecoder : public VideoDecoder {
int32_t Release() override;
int32_t Reset() override;
+ const char* ImplementationName() const override;
+
+ static const char* kImplementationName;
+
private:
VideoCodec config_;
VideoFrame frame_;
@@ -71,4 +75,4 @@ class FakeNullDecoder : public FakeDecoder {
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_DECODER_H_
+#endif // WEBRTC_TEST_FAKE_DECODER_H_
diff --git a/webrtc/test/fake_encoder.cc b/webrtc/test/fake_encoder.cc
index a3ade6e97a..72df40f9a5 100644
--- a/webrtc/test/fake_encoder.cc
+++ b/webrtc/test/fake_encoder.cc
@@ -12,7 +12,7 @@
#include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
+#include "webrtc/modules/video_coding/include/video_codec_interface.h"
#include "webrtc/system_wrappers/include/sleep.h"
namespace webrtc {
@@ -57,6 +57,11 @@ int32_t FakeEncoder::Encode(const VideoFrame& input_image,
// at the display time of the previous frame.
time_since_last_encode_ms = time_now_ms - last_encode_time_ms_;
}
+ if (time_since_last_encode_ms > 3 * 1000 / config_.maxFramerate) {
+ // Rudimentary check to make sure we don't widely overshoot bitrate target
+ // when resuming encoding after a suspension.
+ time_since_last_encode_ms = 3 * 1000 / config_.maxFramerate;
+ }
size_t bits_available =
static_cast<size_t>(target_bitrate_kbps_ * time_since_last_encode_ms);
@@ -127,6 +132,11 @@ int32_t FakeEncoder::SetRates(uint32_t new_target_bitrate, uint32_t framerate) {
return 0;
}
+const char* FakeEncoder::kImplementationName = "fake_encoder";
+const char* FakeEncoder::ImplementationName() const {
+ return kImplementationName;
+}
+
FakeH264Encoder::FakeH264Encoder(Clock* clock)
: FakeEncoder(clock), callback_(NULL), idr_counter_(0) {
FakeEncoder::RegisterEncodeCompleteCallback(this);
diff --git a/webrtc/test/fake_encoder.h b/webrtc/test/fake_encoder.h
index d677b92e4d..6bff00e2a3 100644
--- a/webrtc/test/fake_encoder.h
+++ b/webrtc/test/fake_encoder.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_ENCODER_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_ENCODER_H_
+#ifndef WEBRTC_TEST_FAKE_ENCODER_H_
+#define WEBRTC_TEST_FAKE_ENCODER_H_
#include <vector>
@@ -39,6 +39,9 @@ class FakeEncoder : public VideoEncoder {
int32_t Release() override;
int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
int32_t SetRates(uint32_t new_target_bitrate, uint32_t framerate) override;
+ const char* ImplementationName() const override;
+
+ static const char* kImplementationName;
protected:
Clock* const clock_;
@@ -82,4 +85,4 @@ class DelayedEncoder : public test::FakeEncoder {
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FAKE_ENCODER_H_
+#endif // WEBRTC_TEST_FAKE_ENCODER_H_
diff --git a/webrtc/test/fake_network_pipe.cc b/webrtc/test/fake_network_pipe.cc
index c36059356a..491a0526b9 100644
--- a/webrtc/test/fake_network_pipe.cc
+++ b/webrtc/test/fake_network_pipe.cc
@@ -16,7 +16,7 @@
#include <algorithm>
#include "webrtc/call.h"
-#include "webrtc/system_wrappers/include/tick_util.h"
+#include "webrtc/system_wrappers/include/clock.h"
namespace webrtc {
@@ -70,14 +70,15 @@ class NetworkPacket {
int64_t arrival_time_;
};
-FakeNetworkPipe::FakeNetworkPipe(const FakeNetworkPipe::Config& config)
- : packet_receiver_(NULL),
+FakeNetworkPipe::FakeNetworkPipe(Clock* clock,
+ const FakeNetworkPipe::Config& config)
+ : clock_(clock),
+ packet_receiver_(NULL),
config_(config),
dropped_packets_(0),
sent_packets_(0),
total_packet_delay_(0),
- next_process_time_(TickTime::MillisecondTimestamp()) {
-}
+ next_process_time_(clock_->TimeInMilliseconds()) {}
FakeNetworkPipe::~FakeNetworkPipe() {
while (!capacity_link_.empty()) {
@@ -112,7 +113,7 @@ void FakeNetworkPipe::SendPacket(const uint8_t* data, size_t data_length) {
return;
}
- int64_t time_now = TickTime::MillisecondTimestamp();
+ int64_t time_now = clock_->TimeInMilliseconds();
// Delay introduced by the link capacity.
int64_t capacity_delay_ms = 0;
@@ -145,11 +146,12 @@ int FakeNetworkPipe::AverageDelay() {
if (sent_packets_ == 0)
return 0;
- return total_packet_delay_ / static_cast<int>(sent_packets_);
+ return static_cast<int>(total_packet_delay_ /
+ static_cast<int64_t>(sent_packets_));
}
void FakeNetworkPipe::Process() {
- int64_t time_now = TickTime::MillisecondTimestamp();
+ int64_t time_now = clock_->TimeInMilliseconds();
std::queue<NetworkPacket*> packets_to_deliver;
{
rtc::CritScope crit(&lock_);
@@ -210,8 +212,8 @@ int64_t FakeNetworkPipe::TimeUntilNextProcess() const {
const int64_t kDefaultProcessIntervalMs = 30;
if (capacity_link_.size() == 0 || delay_link_.size() == 0)
return kDefaultProcessIntervalMs;
- return std::max<int64_t>(
- next_process_time_ - TickTime::MillisecondTimestamp(), 0);
+ return std::max<int64_t>(next_process_time_ - clock_->TimeInMilliseconds(),
+ 0);
}
} // namespace webrtc
diff --git a/webrtc/test/fake_network_pipe.h b/webrtc/test/fake_network_pipe.h
index 74189a594c..5d589d86f0 100644
--- a/webrtc/test/fake_network_pipe.h
+++ b/webrtc/test/fake_network_pipe.h
@@ -16,11 +16,11 @@
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
-#include "webrtc/system_wrappers/include/event_wrapper.h"
#include "webrtc/typedefs.h"
namespace webrtc {
+class Clock;
class CriticalSectionWrapper;
class NetworkPacket;
class PacketReceiver;
@@ -33,26 +33,20 @@ class PacketReceiver;
class FakeNetworkPipe {
public:
struct Config {
- Config()
- : queue_length_packets(0),
- queue_delay_ms(0),
- delay_standard_deviation_ms(0),
- link_capacity_kbps(0),
- loss_percent(0) {
- }
+ Config() {}
// Queue length in number of packets.
- size_t queue_length_packets;
+ size_t queue_length_packets = 0;
// Delay in addition to capacity induced delay.
- int queue_delay_ms;
+ int queue_delay_ms = 0;
// Standard deviation of the extra delay.
- int delay_standard_deviation_ms;
+ int delay_standard_deviation_ms = 0;
// Link capacity in kbps.
- int link_capacity_kbps;
+ int link_capacity_kbps = 0;
// Random packet loss.
- int loss_percent;
+ int loss_percent = 0;
};
- explicit FakeNetworkPipe(const FakeNetworkPipe::Config& config);
+ FakeNetworkPipe(Clock* clock, const FakeNetworkPipe::Config& config);
~FakeNetworkPipe();
// Must not be called in parallel with SendPacket or Process.
@@ -76,6 +70,7 @@ class FakeNetworkPipe {
size_t sent_packets() { return sent_packets_; }
private:
+ Clock* const clock_;
mutable rtc::CriticalSection lock_;
PacketReceiver* packet_receiver_;
std::queue<NetworkPacket*> capacity_link_;
@@ -87,7 +82,7 @@ class FakeNetworkPipe {
// Statistics.
size_t dropped_packets_;
size_t sent_packets_;
- int total_packet_delay_;
+ int64_t total_packet_delay_;
int64_t next_process_time_;
diff --git a/webrtc/test/fake_network_pipe_unittest.cc b/webrtc/test/fake_network_pipe_unittest.cc
index 02438c59f3..ff18993829 100644
--- a/webrtc/test/fake_network_pipe_unittest.cc
+++ b/webrtc/test/fake_network_pipe_unittest.cc
@@ -13,7 +13,7 @@
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/call.h"
-#include "webrtc/system_wrappers/include/tick_util.h"
+#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/test/fake_network_pipe.h"
using ::testing::_;
@@ -39,9 +39,11 @@ class MockReceiver : public PacketReceiver {
};
class FakeNetworkPipeTest : public ::testing::Test {
+ public:
+ FakeNetworkPipeTest() : fake_clock_(12345) {}
+
protected:
virtual void SetUp() {
- TickTime::UseFakeClock(12345);
receiver_.reset(new MockReceiver());
ON_CALL(*receiver_, DeliverPacket(_, _, _, _))
.WillByDefault(Return(PacketReceiver::DELIVERY_OK));
@@ -61,6 +63,7 @@ class FakeNetworkPipeTest : public ::testing::Test {
return 8 * kPacketSize / capacity_kbps;
}
+ SimulatedClock fake_clock_;
rtc::scoped_ptr<MockReceiver> receiver_;
};
@@ -71,7 +74,8 @@ TEST_F(FakeNetworkPipeTest, CapacityTest) {
FakeNetworkPipe::Config config;
config.queue_length_packets = 20;
config.link_capacity_kbps = 80;
- rtc::scoped_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(config));
+ rtc::scoped_ptr<FakeNetworkPipe> pipe(
+ new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
// Add 10 packets of 1000 bytes, = 80 kb, and verify it takes one second to
@@ -89,17 +93,17 @@ TEST_F(FakeNetworkPipeTest, CapacityTest) {
pipe->Process();
// Advance enough time to release one packet.
- TickTime::AdvanceFakeClock(kPacketTimeMs);
+ fake_clock_.AdvanceTimeMilliseconds(kPacketTimeMs);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(1);
pipe->Process();
// Release all but one packet
- TickTime::AdvanceFakeClock(9 * kPacketTimeMs - 1);
+ fake_clock_.AdvanceTimeMilliseconds(9 * kPacketTimeMs - 1);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(8);
pipe->Process();
// And the last one.
- TickTime::AdvanceFakeClock(1);
+ fake_clock_.AdvanceTimeMilliseconds(1);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(1);
pipe->Process();
}
@@ -110,7 +114,8 @@ TEST_F(FakeNetworkPipeTest, ExtraDelayTest) {
config.queue_length_packets = 20;
config.queue_delay_ms = 100;
config.link_capacity_kbps = 80;
- rtc::scoped_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(config));
+ rtc::scoped_ptr<FakeNetworkPipe> pipe(
+ new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
const int kNumPackets = 2;
@@ -122,17 +127,17 @@ TEST_F(FakeNetworkPipeTest, ExtraDelayTest) {
kPacketSize);
// Increase more than kPacketTimeMs, but not more than the extra delay.
- TickTime::AdvanceFakeClock(kPacketTimeMs);
+ fake_clock_.AdvanceTimeMilliseconds(kPacketTimeMs);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(0);
pipe->Process();
// Advance the network delay to get the first packet.
- TickTime::AdvanceFakeClock(config.queue_delay_ms);
+ fake_clock_.AdvanceTimeMilliseconds(config.queue_delay_ms);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(1);
pipe->Process();
// Advance one more kPacketTimeMs to get the last packet.
- TickTime::AdvanceFakeClock(kPacketTimeMs);
+ fake_clock_.AdvanceTimeMilliseconds(kPacketTimeMs);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(1);
pipe->Process();
}
@@ -143,7 +148,8 @@ TEST_F(FakeNetworkPipeTest, QueueLengthTest) {
FakeNetworkPipe::Config config;
config.queue_length_packets = 2;
config.link_capacity_kbps = 80;
- rtc::scoped_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(config));
+ rtc::scoped_ptr<FakeNetworkPipe> pipe(
+ new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
const int kPacketSize = 1000;
@@ -155,7 +161,7 @@ TEST_F(FakeNetworkPipeTest, QueueLengthTest) {
// Increase time enough to deliver all three packets, verify only two are
// delivered.
- TickTime::AdvanceFakeClock(3 * kPacketTimeMs);
+ fake_clock_.AdvanceTimeMilliseconds(3 * kPacketTimeMs);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(2);
pipe->Process();
}
@@ -166,7 +172,8 @@ TEST_F(FakeNetworkPipeTest, StatisticsTest) {
config.queue_length_packets = 2;
config.queue_delay_ms = 20;
config.link_capacity_kbps = 80;
- rtc::scoped_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(config));
+ rtc::scoped_ptr<FakeNetworkPipe> pipe(
+ new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
const int kPacketSize = 1000;
@@ -175,7 +182,8 @@ TEST_F(FakeNetworkPipeTest, StatisticsTest) {
// Send three packets and verify only 2 are delivered.
SendPackets(pipe.get(), 3, kPacketSize);
- TickTime::AdvanceFakeClock(3 * kPacketTimeMs + config.queue_delay_ms);
+ fake_clock_.AdvanceTimeMilliseconds(3 * kPacketTimeMs +
+ config.queue_delay_ms);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(2);
pipe->Process();
@@ -194,7 +202,8 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) {
FakeNetworkPipe::Config config;
config.queue_length_packets = 20;
config.link_capacity_kbps = 80;
- rtc::scoped_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(config));
+ rtc::scoped_ptr<FakeNetworkPipe> pipe(
+ new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
// Add 10 packets of 1000 bytes, = 80 kb, and verify it takes one second to
@@ -212,7 +221,7 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) {
// Advance time in steps to release one packet at a time.
for (int i = 0; i < kNumPackets; ++i) {
- TickTime::AdvanceFakeClock(packet_time_ms);
+ fake_clock_.AdvanceTimeMilliseconds(packet_time_ms);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(1);
pipe->Process();
}
@@ -234,14 +243,14 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithEmptyPipeTest) {
// Advance time in steps to release one packet at a time.
for (int i = 0; i < kNumPackets; ++i) {
- TickTime::AdvanceFakeClock(packet_time_ms);
+ fake_clock_.AdvanceTimeMilliseconds(packet_time_ms);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(1);
pipe->Process();
}
// Check that all the packets were sent.
EXPECT_EQ(static_cast<size_t>(2 * kNumPackets), pipe->sent_packets());
- TickTime::AdvanceFakeClock(pipe->TimeUntilNextProcess());
+ fake_clock_.AdvanceTimeMilliseconds(pipe->TimeUntilNextProcess());
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(0);
pipe->Process();
}
@@ -252,7 +261,8 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) {
FakeNetworkPipe::Config config;
config.queue_length_packets = 20;
config.link_capacity_kbps = 80;
- rtc::scoped_ptr<FakeNetworkPipe> pipe(new FakeNetworkPipe(config));
+ rtc::scoped_ptr<FakeNetworkPipe> pipe(
+ new FakeNetworkPipe(&fake_clock_, config));
pipe->SetReceiver(receiver_.get());
// Add 10 packets of 1000 bytes, = 80 kb.
@@ -280,21 +290,21 @@ TEST_F(FakeNetworkPipeTest, ChangingCapacityWithPacketsInPipeTest) {
// Advance time in steps to release one packet at a time.
for (int i = 0; i < kNumPackets; ++i) {
- TickTime::AdvanceFakeClock(packet_time_1_ms);
+ fake_clock_.AdvanceTimeMilliseconds(packet_time_1_ms);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(1);
pipe->Process();
}
// Advance time in steps to release one packet at a time.
for (int i = 0; i < kNumPackets; ++i) {
- TickTime::AdvanceFakeClock(packet_time_2_ms);
+ fake_clock_.AdvanceTimeMilliseconds(packet_time_2_ms);
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(1);
pipe->Process();
}
// Check that all the packets were sent.
EXPECT_EQ(static_cast<size_t>(2 * kNumPackets), pipe->sent_packets());
- TickTime::AdvanceFakeClock(pipe->TimeUntilNextProcess());
+ fake_clock_.AdvanceTimeMilliseconds(pipe->TimeUntilNextProcess());
EXPECT_CALL(*receiver_, DeliverPacket(_, _, _, _)).Times(0);
pipe->Process();
}
diff --git a/webrtc/test/fake_texture_frame.cc b/webrtc/test/fake_texture_frame.cc
new file mode 100644
index 0000000000..5d46eec4b6
--- /dev/null
+++ b/webrtc/test/fake_texture_frame.cc
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016 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.
+ */
+
+#include "webrtc/test/fake_texture_frame.h"
+
+namespace webrtc {
+namespace test {
+
+VideoFrame FakeNativeHandle::CreateFrame(FakeNativeHandle* native_handle,
+ int width,
+ int height,
+ uint32_t timestamp,
+ int64_t render_time_ms,
+ VideoRotation rotation) {
+ return VideoFrame(new rtc::RefCountedObject<FakeNativeHandleBuffer>(
+ native_handle, width, height),
+ timestamp, render_time_ms, rotation);
+}
+} // namespace test
+} // namespace webrtc
diff --git a/webrtc/test/fake_texture_frame.h b/webrtc/test/fake_texture_frame.h
index dc6abaf745..9575fae469 100644
--- a/webrtc/test/fake_texture_frame.h
+++ b/webrtc/test/fake_texture_frame.h
@@ -11,13 +11,21 @@
#define WEBRTC_TEST_FAKE_TEXTURE_FRAME_H_
#include "webrtc/base/checks.h"
-#include "webrtc/common_video/interface/video_frame_buffer.h"
+#include "webrtc/common_video/include/video_frame_buffer.h"
#include "webrtc/video_frame.h"
namespace webrtc {
namespace test {
-class FakeNativeHandle {};
+class FakeNativeHandle {
+ public:
+ static VideoFrame CreateFrame(FakeNativeHandle* native_handle,
+ int width,
+ int height,
+ uint32_t timestamp,
+ int64_t render_time_ms,
+ VideoRotation rotation);
+};
class FakeNativeHandleBuffer : public NativeHandleBuffer {
public:
@@ -41,16 +49,6 @@ class FakeNativeHandleBuffer : public NativeHandleBuffer {
}
};
-static VideoFrame CreateFakeNativeHandleFrame(FakeNativeHandle* native_handle,
- int width,
- int height,
- uint32_t timestamp,
- int64_t render_time_ms,
- VideoRotation rotation) {
- return VideoFrame(new rtc::RefCountedObject<FakeNativeHandleBuffer>(
- native_handle, width, height),
- timestamp, render_time_ms, rotation);
-}
} // namespace test
} // namespace webrtc
#endif // WEBRTC_TEST_FAKE_TEXTURE_FRAME_H_
diff --git a/webrtc/test/fake_voice_engine.cc b/webrtc/test/fake_voice_engine.cc
deleted file mode 100644
index 1a32e082b7..0000000000
--- a/webrtc/test/fake_voice_engine.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2015 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.
- */
-
-#include "webrtc/test/fake_voice_engine.h"
-
-namespace {
-
-webrtc::AudioDecodingCallStats MakeAudioDecodingCallStats() {
- webrtc::AudioDecodingCallStats stats;
- stats.calls_to_silence_generator = 234;
- stats.calls_to_neteq = 567;
- stats.decoded_normal = 890;
- stats.decoded_plc = 123;
- stats.decoded_cng = 456;
- stats.decoded_plc_cng = 789;
- return stats;
-}
-} // namespace
-
-namespace webrtc {
-namespace test {
-
-const int FakeVoiceEngine::kSendChannelId = 1;
-const int FakeVoiceEngine::kRecvChannelId = 2;
-const uint32_t FakeVoiceEngine::kSendSsrc = 665;
-const uint32_t FakeVoiceEngine::kRecvSsrc = 667;
-const int FakeVoiceEngine::kSendEchoDelayMedian = 254;
-const int FakeVoiceEngine::kSendEchoDelayStdDev = -3;
-const int FakeVoiceEngine::kSendEchoReturnLoss = -65;
-const int FakeVoiceEngine::kSendEchoReturnLossEnhancement = 101;
-const int FakeVoiceEngine::kRecvJitterBufferDelay = -7;
-const int FakeVoiceEngine::kRecvPlayoutBufferDelay = 302;
-const unsigned int FakeVoiceEngine::kSendSpeechInputLevel = 96;
-const unsigned int FakeVoiceEngine::kRecvSpeechOutputLevel = 99;
-
-const CallStatistics FakeVoiceEngine::kSendCallStats = {
- 1345, 1678, 1901, 1234, 112, 13456, 17890, 1567, -1890, -1123
-};
-
-const CodecInst FakeVoiceEngine::kSendCodecInst = {
- -121, "codec_name_send", 48000, -231, -451, -671
-};
-
-const ReportBlock FakeVoiceEngine::kSendReportBlock = {
- 456, 780, 123, 567, 890, 132, 143, 13354
-};
-
-const CallStatistics FakeVoiceEngine::kRecvCallStats = {
- 345, 678, 901, 234, -12, 3456, 7890, 567, 890, 123
-};
-
-const CodecInst FakeVoiceEngine::kRecvCodecInst = {
- 123, "codec_name_recv", 96000, -187, -198, -103
-};
-
-const NetworkStatistics FakeVoiceEngine::kRecvNetworkStats = {
- 123, 456, false, 0, 0, 789, 12, 345, 678, 901, -1, -1, -1, -1, -1, 0
-};
-
-const AudioDecodingCallStats FakeVoiceEngine::kRecvAudioDecodingCallStats =
- MakeAudioDecodingCallStats();
-} // namespace test
-} // namespace webrtc
diff --git a/webrtc/test/fake_voice_engine.h b/webrtc/test/fake_voice_engine.h
deleted file mode 100644
index 8f08929720..0000000000
--- a/webrtc/test/fake_voice_engine.h
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Copyright (c) 2015 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 WEBRTC_AUDIO_FAKE_VOICE_ENGINE_H_
-#define WEBRTC_AUDIO_FAKE_VOICE_ENGINE_H_
-
-#include <vector>
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-#include "webrtc/voice_engine/voice_engine_impl.h"
-
-namespace webrtc {
-namespace test {
-
-// NOTE: This class inherits from VoiceEngineImpl so that its clients will be
-// able to get the various interfaces as usual, via T::GetInterface().
-class FakeVoiceEngine final : public VoiceEngineImpl {
- public:
- static const int kSendChannelId;
- static const int kRecvChannelId;
- static const uint32_t kSendSsrc;
- static const uint32_t kRecvSsrc;
- static const int kSendEchoDelayMedian;
- static const int kSendEchoDelayStdDev;
- static const int kSendEchoReturnLoss;
- static const int kSendEchoReturnLossEnhancement;
- static const int kRecvJitterBufferDelay;
- static const int kRecvPlayoutBufferDelay;
- static const unsigned int kSendSpeechInputLevel;
- static const unsigned int kRecvSpeechOutputLevel;
- static const CallStatistics kSendCallStats;
- static const CodecInst kSendCodecInst;
- static const ReportBlock kSendReportBlock;
- static const CallStatistics kRecvCallStats;
- static const CodecInst kRecvCodecInst;
- static const NetworkStatistics kRecvNetworkStats;
- static const AudioDecodingCallStats kRecvAudioDecodingCallStats;
-
- FakeVoiceEngine() : VoiceEngineImpl(new Config(), true) {
- // Increase ref count so this object isn't automatically deleted whenever
- // interfaces are Release():d.
- ++_ref_count;
- }
- ~FakeVoiceEngine() override {
- // Decrease ref count before base class d-tor is called; otherwise it will
- // trigger an assertion.
- --_ref_count;
- }
-
- // VoEAudioProcessing
- int SetNsStatus(bool enable, NsModes mode = kNsUnchanged) override {
- return -1;
- }
- int GetNsStatus(bool& enabled, NsModes& mode) override { return -1; }
- int SetAgcStatus(bool enable, AgcModes mode = kAgcUnchanged) override {
- return -1;
- }
- int GetAgcStatus(bool& enabled, AgcModes& mode) override { return -1; }
- int SetAgcConfig(AgcConfig config) override { return -1; }
- int GetAgcConfig(AgcConfig& config) override { return -1; }
- int SetEcStatus(bool enable, EcModes mode = kEcUnchanged) override {
- return -1;
- }
- int GetEcStatus(bool& enabled, EcModes& mode) override { return -1; }
- int EnableDriftCompensation(bool enable) override { return -1; }
- bool DriftCompensationEnabled() override { return false; }
- void SetDelayOffsetMs(int offset) override {}
- int DelayOffsetMs() override { return -1; }
- int SetAecmMode(AecmModes mode = kAecmSpeakerphone,
- bool enableCNG = true) override { return -1; }
- int GetAecmMode(AecmModes& mode, bool& enabledCNG) override { return -1; }
- int EnableHighPassFilter(bool enable) override { return -1; }
- bool IsHighPassFilterEnabled() override { return false; }
- int SetRxNsStatus(int channel,
- bool enable,
- NsModes mode = kNsUnchanged) override { return -1; }
- int GetRxNsStatus(int channel, bool& enabled, NsModes& mode) override {
- return -1;
- }
- int SetRxAgcStatus(int channel,
- bool enable,
- AgcModes mode = kAgcUnchanged) override { return -1; }
- int GetRxAgcStatus(int channel, bool& enabled, AgcModes& mode) override {
- return -1;
- }
- int SetRxAgcConfig(int channel, AgcConfig config) override { return -1; }
- int GetRxAgcConfig(int channel, AgcConfig& config) override { return -1; }
- int RegisterRxVadObserver(int channel,
- VoERxVadCallback& observer) override { return -1; }
- int DeRegisterRxVadObserver(int channel) override { return -1; }
- int VoiceActivityIndicator(int channel) override { return -1; }
- int SetEcMetricsStatus(bool enable) override { return -1; }
- int GetEcMetricsStatus(bool& enabled) override {
- enabled = true;
- return 0;
- }
- int GetEchoMetrics(int& ERL, int& ERLE, int& RERL, int& A_NLP) override {
- ERL = kSendEchoReturnLoss;
- ERLE = kSendEchoReturnLossEnhancement;
- RERL = -123456789;
- A_NLP = 123456789;
- return 0;
- }
- int GetEcDelayMetrics(int& delay_median,
- int& delay_std,
- float& fraction_poor_delays) override {
- delay_median = kSendEchoDelayMedian;
- delay_std = kSendEchoDelayStdDev;
- fraction_poor_delays = -12345.7890f;
- return 0;
- }
- int StartDebugRecording(const char* fileNameUTF8) override { return -1; }
- int StartDebugRecording(FILE* file_handle) override { return -1; }
- int StopDebugRecording() override { return -1; }
- int SetTypingDetectionStatus(bool enable) override { return -1; }
- int GetTypingDetectionStatus(bool& enabled) override { return -1; }
- int TimeSinceLastTyping(int& seconds) override { return -1; }
- int SetTypingDetectionParameters(int timeWindow,
- int costPerTyping,
- int reportingThreshold,
- int penaltyDecay,
- int typeEventDelay = 0) override {
- return -1;
- }
- void EnableStereoChannelSwapping(bool enable) override {}
- bool IsStereoChannelSwappingEnabled() override { return false; }
-
- // VoEBase
- int RegisterVoiceEngineObserver(VoiceEngineObserver& observer) override {
- return -1;
- }
- int DeRegisterVoiceEngineObserver() override { return -1; }
- int Init(AudioDeviceModule* external_adm = NULL,
- AudioProcessing* audioproc = NULL) override { return -1; }
- AudioProcessing* audio_processing() override { return nullptr; }
- int Terminate() override { return -1; }
- int CreateChannel() override { return -1; }
- int CreateChannel(const Config& config) override { return -1; }
- int DeleteChannel(int channel) override { return -1; }
- int StartReceive(int channel) override { return -1; }
- int StopReceive(int channel) override { return -1; }
- int StartPlayout(int channel) override { return -1; }
- int StopPlayout(int channel) override { return -1; }
- int StartSend(int channel) override { return -1; }
- int StopSend(int channel) override { return -1; }
- int GetVersion(char version[1024]) override { return -1; }
- int LastError() override { return -1; }
- AudioTransport* audio_transport() { return nullptr; }
- int AssociateSendChannel(int channel, int accociate_send_channel) override {
- return -1;
- }
-
- // VoECodec
- int NumOfCodecs() override { return -1; }
- int GetCodec(int index, CodecInst& codec) override { return -1; }
- int SetSendCodec(int channel, const CodecInst& codec) override { return -1; }
- int GetSendCodec(int channel, CodecInst& codec) override {
- EXPECT_EQ(channel, kSendChannelId);
- codec = kSendCodecInst;
- return 0;
- }
- int SetBitRate(int channel, int bitrate_bps) override { return -1; }
- int GetRecCodec(int channel, CodecInst& codec) override {
- EXPECT_EQ(channel, kRecvChannelId);
- codec = kRecvCodecInst;
- return 0;
- }
- int SetRecPayloadType(int channel, const CodecInst& codec) override {
- return -1;
- }
- int GetRecPayloadType(int channel, CodecInst& codec) override { return -1; }
- int SetSendCNPayloadType(int channel, int type,
- PayloadFrequencies frequency = kFreq16000Hz) override { return -1; }
- int SetVADStatus(int channel,
- bool enable,
- VadModes mode = kVadConventional,
- bool disableDTX = false) override { return -1; }
- int GetVADStatus(int channel,
- bool& enabled,
- VadModes& mode,
- bool& disabledDTX) override { return -1; }
- int SetOpusMaxPlaybackRate(int channel, int frequency_hz) override {
- return -1;
- }
- int SetOpusDtx(int channel, bool enable_dtx) override { return -1; }
- RtcEventLog* GetEventLog() override { return nullptr; }
-
- // VoEDtmf
- int SendTelephoneEvent(int channel,
- int eventCode,
- bool outOfBand = true,
- int lengthMs = 160,
- int attenuationDb = 10) override { return -1; }
- int SetSendTelephoneEventPayloadType(int channel,
- unsigned char type) override {
- return -1;
- }
- int GetSendTelephoneEventPayloadType(int channel,
- unsigned char& type) override {
- return -1;
- }
- int SetDtmfFeedbackStatus(bool enable,
- bool directFeedback = false) override { return -1; }
- int GetDtmfFeedbackStatus(bool& enabled, bool& directFeedback) override {
- return -1;
- }
- int PlayDtmfTone(int eventCode,
- int lengthMs = 200,
- int attenuationDb = 10) override { return -1; }
-
- // VoEExternalMedia
- int RegisterExternalMediaProcessing(
- int channel,
- ProcessingTypes type,
- VoEMediaProcess& processObject) override { return -1; }
- int DeRegisterExternalMediaProcessing(int channel,
- ProcessingTypes type) override {
- return -1;
- }
- int GetAudioFrame(int channel,
- int desired_sample_rate_hz,
- AudioFrame* frame) override { return -1; }
- int SetExternalMixing(int channel, bool enable) override { return -1; }
-
- // VoEFile
- int StartPlayingFileLocally(
- int channel,
- const char fileNameUTF8[1024],
- bool loop = false,
- FileFormats format = kFileFormatPcm16kHzFile,
- float volumeScaling = 1.0,
- int startPointMs = 0,
- int stopPointMs = 0) override { return -1; }
- int StartPlayingFileLocally(
- int channel,
- InStream* stream,
- FileFormats format = kFileFormatPcm16kHzFile,
- float volumeScaling = 1.0,
- int startPointMs = 0,
- int stopPointMs = 0) override { return -1; }
- int StopPlayingFileLocally(int channel) override { return -1; }
- int IsPlayingFileLocally(int channel) override { return -1; }
- int StartPlayingFileAsMicrophone(
- int channel,
- const char fileNameUTF8[1024],
- bool loop = false,
- bool mixWithMicrophone = false,
- FileFormats format = kFileFormatPcm16kHzFile,
- float volumeScaling = 1.0) override { return -1; }
- int StartPlayingFileAsMicrophone(
- int channel,
- InStream* stream,
- bool mixWithMicrophone = false,
- FileFormats format = kFileFormatPcm16kHzFile,
- float volumeScaling = 1.0) override { return -1; }
- int StopPlayingFileAsMicrophone(int channel) override { return -1; }
- int IsPlayingFileAsMicrophone(int channel) override { return -1; }
- int StartRecordingPlayout(int channel,
- const char* fileNameUTF8,
- CodecInst* compression = NULL,
- int maxSizeBytes = -1) override { return -1; }
- int StopRecordingPlayout(int channel) override { return -1; }
- int StartRecordingPlayout(int channel,
- OutStream* stream,
- CodecInst* compression = NULL) override {
- return -1;
- }
- int StartRecordingMicrophone(const char* fileNameUTF8,
- CodecInst* compression = NULL,
- int maxSizeBytes = -1) override { return -1; }
- int StartRecordingMicrophone(OutStream* stream,
- CodecInst* compression = NULL) override {
- return -1;
- }
- int StopRecordingMicrophone() override { return -1; }
-
- // VoEHardware
- int GetNumOfRecordingDevices(int& devices) override { return -1; }
-
- // Gets the number of audio devices available for playout.
- int GetNumOfPlayoutDevices(int& devices) override { return -1; }
-
- // Gets the name of a specific recording device given by an |index|.
- // On Windows Vista/7, it also retrieves an additional unique ID
- // (GUID) for the recording device.
- int GetRecordingDeviceName(int index,
- char strNameUTF8[128],
- char strGuidUTF8[128]) override { return -1; }
-
- // Gets the name of a specific playout device given by an |index|.
- // On Windows Vista/7, it also retrieves an additional unique ID
- // (GUID) for the playout device.
- int GetPlayoutDeviceName(int index,
- char strNameUTF8[128],
- char strGuidUTF8[128]) override { return -1; }
-
- // Sets the audio device used for recording.
- int SetRecordingDevice(
- int index,
- StereoChannel recordingChannel = kStereoBoth) override { return -1; }
-
- // Sets the audio device used for playout.
- int SetPlayoutDevice(int index) override { return -1; }
-
- // Sets the type of audio device layer to use.
- int SetAudioDeviceLayer(AudioLayers audioLayer) override { return -1; }
-
- // Gets the currently used (active) audio device layer.
- int GetAudioDeviceLayer(AudioLayers& audioLayer) override { return -1; }
-
- // Native sample rate controls (samples/sec)
- int SetRecordingSampleRate(unsigned int samples_per_sec) override {
- return -1;
- }
- int RecordingSampleRate(unsigned int* samples_per_sec) const override {
- return -1;
- }
- int SetPlayoutSampleRate(unsigned int samples_per_sec) override {
- return -1;
- }
- int PlayoutSampleRate(unsigned int* samples_per_sec) const override {
- return -1;
- }
-
- // Queries and controls platform audio effects on Android devices.
- bool BuiltInAECIsAvailable() const override { return false; }
- int EnableBuiltInAEC(bool enable) override { return -1; }
- bool BuiltInAGCIsAvailable() const override { return false; }
- int EnableBuiltInAGC(bool enable) override { return -1; }
- bool BuiltInNSIsAvailable() const override { return false; }
- int EnableBuiltInNS(bool enable) override { return -1; }
-
- // VoENetwork
- int RegisterExternalTransport(int channel, Transport& transport) override {
- return -1;
- }
- int DeRegisterExternalTransport(int channel) override { return -1; }
- int ReceivedRTPPacket(int channel,
- const void* data,
- size_t length) override { return -1; }
- int ReceivedRTPPacket(int channel,
- const void* data,
- size_t length,
- const PacketTime& packet_time) override { return -1; }
- int ReceivedRTCPPacket(int channel,
- const void* data,
- size_t length) { return -1; }
-
- // VoENetEqStats
- int GetNetworkStatistics(int channel, NetworkStatistics& stats) override {
- EXPECT_EQ(channel, kRecvChannelId);
- stats = kRecvNetworkStats;
- return 0;
- }
- int GetDecodingCallStatistics(int channel,
- AudioDecodingCallStats* stats) const override {
- EXPECT_EQ(channel, kRecvChannelId);
- EXPECT_NE(nullptr, stats);
- *stats = kRecvAudioDecodingCallStats;
- return 0;
- }
-
- // VoERTP_RTCP
- int SetLocalSSRC(int channel, unsigned int ssrc) override { return -1; }
- int GetLocalSSRC(int channel, unsigned int& ssrc) override {
- EXPECT_EQ(channel, kSendChannelId);
- ssrc = 0;
- return 0;
- }
- int GetRemoteSSRC(int channel, unsigned int& ssrc) override {
- EXPECT_EQ(channel, kRecvChannelId);
- ssrc = 0;
- return 0;
- }
- int SetSendAudioLevelIndicationStatus(int channel,
- bool enable,
- unsigned char id = 1) override {
- return -1;
- }
- int SetSendAbsoluteSenderTimeStatus(int channel,
- bool enable,
- unsigned char id) override { return -1; }
- int SetReceiveAbsoluteSenderTimeStatus(int channel,
- bool enable,
- unsigned char id) override {
- return -1;
- }
- int SetRTCPStatus(int channel, bool enable) override { return -1; }
- int GetRTCPStatus(int channel, bool& enabled) override { return -1; }
- int SetRTCP_CNAME(int channel, const char cName[256]) override { return -1; }
- int GetRTCP_CNAME(int channel, char cName[256]) { return -1; }
- int GetRemoteRTCP_CNAME(int channel, char cName[256]) override { return -1; }
- int GetRemoteRTCPData(int channel,
- unsigned int& NTPHigh,
- unsigned int& NTPLow,
- unsigned int& timestamp,
- unsigned int& playoutTimestamp,
- unsigned int* jitter = NULL,
- unsigned short* fractionLost = NULL) override {
- return -1;
- }
- int GetRTPStatistics(int channel,
- unsigned int& averageJitterMs,
- unsigned int& maxJitterMs,
- unsigned int& discardedPackets) override { return -1; }
- int GetRTCPStatistics(int channel, CallStatistics& stats) override {
- if (channel == kSendChannelId) {
- stats = kSendCallStats;
- } else {
- EXPECT_EQ(channel, kRecvChannelId);
- stats = kRecvCallStats;
- }
- return 0;
- }
- int GetRemoteRTCPReportBlocks(
- int channel,
- std::vector<ReportBlock>* receive_blocks) override {
- EXPECT_EQ(channel, kSendChannelId);
- EXPECT_NE(receive_blocks, nullptr);
- EXPECT_EQ(receive_blocks->size(), 0u);
- webrtc::ReportBlock block = kSendReportBlock;
- receive_blocks->push_back(block); // Has wrong SSRC.
- block.source_SSRC = kSendSsrc;
- receive_blocks->push_back(block); // Correct block.
- block.fraction_lost = 0;
- receive_blocks->push_back(block); // Duplicate SSRC, bad fraction_lost.
- return 0;
- }
- int SetNACKStatus(int channel, bool enable, int maxNoPackets) override {
- return -1;
- }
-
- // VoEVideoSync
- int GetPlayoutBufferSize(int& buffer_ms) override { return -1; }
- int SetMinimumPlayoutDelay(int channel, int delay_ms) override { return -1; }
- int SetInitialPlayoutDelay(int channel, int delay_ms) override { return -1; }
- int GetDelayEstimate(int channel,
- int* jitter_buffer_delay_ms,
- int* playout_buffer_delay_ms) override {
- EXPECT_EQ(channel, kRecvChannelId);
- *jitter_buffer_delay_ms = kRecvJitterBufferDelay;
- *playout_buffer_delay_ms = kRecvPlayoutBufferDelay;
- return 0;
- }
- int GetLeastRequiredDelayMs(int channel) const override { return -1; }
- int SetInitTimestamp(int channel, unsigned int timestamp) override {
- return -1;
- }
- int SetInitSequenceNumber(int channel, short sequenceNumber) override {
- return -1;
- }
- int GetPlayoutTimestamp(int channel, unsigned int& timestamp) override {
- return -1;
- }
- int GetRtpRtcp(int channel,
- RtpRtcp** rtpRtcpModule,
- RtpReceiver** rtp_receiver) override { return -1; }
-
- // VoEVolumeControl
- int SetSpeakerVolume(unsigned int volume) override { return -1; }
- int GetSpeakerVolume(unsigned int& volume) override { return -1; }
- int SetMicVolume(unsigned int volume) override { return -1; }
- int GetMicVolume(unsigned int& volume) override { return -1; }
- int SetInputMute(int channel, bool enable) override { return -1; }
- int GetInputMute(int channel, bool& enabled) override { return -1; }
- int GetSpeechInputLevel(unsigned int& level) override { return -1; }
- int GetSpeechOutputLevel(int channel, unsigned int& level) override {
- return -1;
- }
- int GetSpeechInputLevelFullRange(unsigned int& level) override {
- level = kSendSpeechInputLevel;
- return 0;
- }
- int GetSpeechOutputLevelFullRange(int channel,
- unsigned int& level) override {
- EXPECT_EQ(channel, kRecvChannelId);
- level = kRecvSpeechOutputLevel;
- return 0;
- }
- int SetChannelOutputVolumeScaling(int channel, float scaling) override {
- return -1;
- }
- int GetChannelOutputVolumeScaling(int channel, float& scaling) override {
- return -1;
- }
- int SetOutputVolumePan(int channel, float left, float right) override {
- return -1;
- }
- int GetOutputVolumePan(int channel, float& left, float& right) override {
- return -1;
- }
-};
-} // namespace test
-} // namespace webrtc
-
-#endif // WEBRTC_AUDIO_FAKE_VOICE_ENGINE_H_
diff --git a/webrtc/test/field_trial.cc b/webrtc/test/field_trial.cc
index 613fb67679..c40d0783d8 100644
--- a/webrtc/test/field_trial.cc
+++ b/webrtc/test/field_trial.cc
@@ -18,27 +18,13 @@
#include <string>
#include "webrtc/system_wrappers/include/field_trial.h"
+#include "webrtc/system_wrappers/include/field_trial_default.h"
namespace webrtc {
namespace {
-// Clients of this library have show a clear intent to setup field trials by
-// linking with it. As so try to crash if they forget to call
-// InitFieldTrialsFromString before webrtc tries to access a field trial.
bool field_trials_initiated_ = false;
-std::map<std::string, std::string> field_trials_;
} // namespace
-namespace field_trial {
-std::string FindFullName(const std::string& trial_name) {
- assert(field_trials_initiated_);
- std::map<std::string, std::string>::const_iterator it =
- field_trials_.find(trial_name);
- if (it == field_trials_.end())
- return std::string();
- return it->second;
-}
-} // namespace field_trial
-
namespace test {
// Note: this code is copied from src/base/metrics/field_trial.cc since the aim
// is to mimic chromium --force-fieldtrials.
@@ -53,6 +39,7 @@ void InitFieldTrialsFromString(const std::string& trials_string) {
return;
size_t next_item = 0;
+ std::map<std::string, std::string> field_trials;
while (next_item < trials_string.length()) {
size_t name_end = trials_string.find(kPersistentStringSeparator, next_item);
if (name_end == trials_string.npos || next_item == name_end)
@@ -67,15 +54,18 @@ void InitFieldTrialsFromString(const std::string& trials_string) {
next_item = group_name_end + 1;
// Fail if duplicate with different group name.
- if (field_trials_.find(name) != field_trials_.end() &&
- field_trials_.find(name)->second != group_name)
+ if (field_trials.find(name) != field_trials.end() &&
+ field_trials.find(name)->second != group_name) {
break;
+ }
- field_trials_[name] = group_name;
+ field_trials[name] = group_name;
// Successfully parsed all field trials from the string.
- if (next_item == trials_string.length())
+ if (next_item == trials_string.length()) {
+ webrtc::field_trial::InitFieldTrialsFromString(trials_string.c_str());
return;
+ }
}
// Using fprintf as LOG does not print when this is called early in main.
fprintf(stderr, "Invalid field trials string.\n");
@@ -85,18 +75,18 @@ void InitFieldTrialsFromString(const std::string& trials_string) {
}
ScopedFieldTrials::ScopedFieldTrials(const std::string& config)
- : previous_field_trials_(field_trials_) {
+ : previous_field_trials_(webrtc::field_trial::GetFieldTrialString()) {
assert(field_trials_initiated_);
field_trials_initiated_ = false;
- field_trials_.clear();
- InitFieldTrialsFromString(config);
+ current_field_trials_ = config;
+ InitFieldTrialsFromString(current_field_trials_);
}
ScopedFieldTrials::~ScopedFieldTrials() {
// Should still be initialized, since InitFieldTrials is called from ctor.
// That's why we don't restore the flag.
assert(field_trials_initiated_);
- field_trials_ = previous_field_trials_;
+ webrtc::field_trial::InitFieldTrialsFromString(previous_field_trials_);
}
} // namespace test
diff --git a/webrtc/test/field_trial.h b/webrtc/test/field_trial.h
index d448f3411d..735aa1f833 100644
--- a/webrtc/test/field_trial.h
+++ b/webrtc/test/field_trial.h
@@ -39,7 +39,8 @@ class ScopedFieldTrials {
explicit ScopedFieldTrials(const std::string& config);
~ScopedFieldTrials();
private:
- const std::map<std::string, std::string> previous_field_trials_;
+ std::string current_field_trials_;
+ const char* previous_field_trials_;
};
} // namespace test
diff --git a/webrtc/test/frame_generator_capturer.cc b/webrtc/test/frame_generator_capturer.cc
index 70e2c85698..35ce6168a2 100644
--- a/webrtc/test/frame_generator_capturer.cc
+++ b/webrtc/test/frame_generator_capturer.cc
@@ -11,11 +11,11 @@
#include "webrtc/test/frame_generator_capturer.h"
#include "webrtc/base/criticalsection.h"
-#include "webrtc/test/frame_generator.h"
+#include "webrtc/base/platform_thread.h"
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/system_wrappers/include/event_wrapper.h"
#include "webrtc/system_wrappers/include/sleep.h"
-#include "webrtc/system_wrappers/include/thread_wrapper.h"
+#include "webrtc/test/frame_generator.h"
#include "webrtc/video_send_stream.h"
namespace webrtc {
@@ -65,6 +65,7 @@ FrameGeneratorCapturer::FrameGeneratorCapturer(Clock* clock,
clock_(clock),
sending_(false),
tick_(EventTimerWrapper::Create()),
+ thread_(FrameGeneratorCapturer::Run, this, "FrameGeneratorCapturer"),
frame_generator_(frame_generator),
target_fps_(target_fps),
first_frame_capture_time_(-1) {
@@ -76,8 +77,7 @@ FrameGeneratorCapturer::FrameGeneratorCapturer(Clock* clock,
FrameGeneratorCapturer::~FrameGeneratorCapturer() {
Stop();
- if (thread_.get() != NULL)
- thread_->Stop();
+ thread_.Stop();
}
bool FrameGeneratorCapturer::Init() {
@@ -88,15 +88,8 @@ bool FrameGeneratorCapturer::Init() {
if (!tick_->StartTimer(true, 1000 / target_fps_))
return false;
- thread_ = ThreadWrapper::CreateThread(FrameGeneratorCapturer::Run, this,
- "FrameGeneratorCapturer");
- if (thread_.get() == NULL)
- return false;
- if (!thread_->Start()) {
- thread_.reset();
- return false;
- }
- thread_->SetPriority(webrtc::kHighPriority);
+ thread_.Start();
+ thread_.SetPriority(rtc::kHighPriority);
return true;
}
diff --git a/webrtc/test/frame_generator_capturer.h b/webrtc/test/frame_generator_capturer.h
index aff906dfa2..6bd0e0b327 100644
--- a/webrtc/test/frame_generator_capturer.h
+++ b/webrtc/test/frame_generator_capturer.h
@@ -7,12 +7,13 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_
+#ifndef WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_
+#define WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_
#include <string>
#include "webrtc/base/criticalsection.h"
+#include "webrtc/base/platform_thread.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/test/video_capturer.h"
#include "webrtc/typedefs.h"
@@ -21,7 +22,6 @@ namespace webrtc {
class CriticalSectionWrapper;
class EventTimerWrapper;
-class ThreadWrapper;
namespace test {
@@ -64,7 +64,7 @@ class FrameGeneratorCapturer : public VideoCapturer {
rtc::scoped_ptr<EventTimerWrapper> tick_;
rtc::CriticalSection lock_;
- rtc::scoped_ptr<ThreadWrapper> thread_;
+ rtc::PlatformThread thread_;
rtc::scoped_ptr<FrameGenerator> frame_generator_;
int target_fps_;
@@ -74,4 +74,4 @@ class FrameGeneratorCapturer : public VideoCapturer {
} // test
} // webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_FRAME_GENERATOR_CAPTURER_H_
+#endif // WEBRTC_TEST_FRAME_GENERATOR_CAPTURER_H_
diff --git a/webrtc/test/fuzzers/BUILD.gn b/webrtc/test/fuzzers/BUILD.gn
new file mode 100644
index 0000000000..6a43548ec9
--- /dev/null
+++ b/webrtc/test/fuzzers/BUILD.gn
@@ -0,0 +1,115 @@
+# Copyright (c) 2015 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.
+
+import("//build/config/features.gni")
+import("webrtc_fuzzer.gni")
+
+static_library("webrtc_fuzzer_main") {
+ public_configs = [ "../..:common_inherited_config" ]
+ sources = [
+ "webrtc_fuzzer_main.cc",
+ ]
+ deps = [
+ "../../system_wrappers:field_trial_default",
+ "../../system_wrappers:metrics_default",
+ "//testing/libfuzzer:libfuzzer_main",
+ ]
+}
+
+webrtc_fuzzer_test("h264_depacketizer_fuzzer") {
+ sources = [
+ "h264_depacketizer_fuzzer.cc",
+ ]
+ deps = [
+ "../../modules/rtp_rtcp",
+ ]
+}
+
+webrtc_fuzzer_test("vp8_depacketizer_fuzzer") {
+ sources = [
+ "vp8_depacketizer_fuzzer.cc",
+ ]
+ deps = [
+ "../../modules/rtp_rtcp",
+ ]
+}
+
+webrtc_fuzzer_test("vp9_depacketizer_fuzzer") {
+ sources = [
+ "vp9_depacketizer_fuzzer.cc",
+ ]
+ deps = [
+ "../../modules/rtp_rtcp",
+ ]
+}
+
+webrtc_fuzzer_test("vp8_qp_parser_fuzzer") {
+ sources = [
+ "vp8_qp_parser_fuzzer.cc",
+ ]
+ deps = [
+ "../../modules/video_coding/",
+ ]
+}
+
+webrtc_fuzzer_test("producer_fec_fuzzer") {
+ sources = [
+ "producer_fec_fuzzer.cc",
+ ]
+ deps = [
+ "../../modules/rtp_rtcp/",
+ ]
+}
+
+source_set("audio_decoder_fuzzer") {
+ public_configs = [ "../..:common_inherited_config" ]
+ sources = [
+ "audio_decoder_fuzzer.cc",
+ "audio_decoder_fuzzer.h",
+ ]
+}
+
+webrtc_fuzzer_test("audio_decoder_ilbc_fuzzer") {
+ sources = [
+ "audio_decoder_ilbc_fuzzer.cc",
+ ]
+ deps = [
+ ":audio_decoder_fuzzer",
+ "../../modules/audio_coding:ilbc",
+ ]
+}
+
+webrtc_fuzzer_test("audio_decoder_isac_fuzzer") {
+ sources = [
+ "audio_decoder_isac_fuzzer.cc",
+ ]
+ deps = [
+ ":audio_decoder_fuzzer",
+ "../../modules/audio_coding:isac",
+ ]
+}
+
+webrtc_fuzzer_test("audio_decoder_isacfix_fuzzer") {
+ sources = [
+ "audio_decoder_isacfix_fuzzer.cc",
+ ]
+ deps = [
+ ":audio_decoder_fuzzer",
+ "../../modules/audio_coding:isac_fix",
+ ]
+}
+
+webrtc_fuzzer_test("audio_decoder_opus_fuzzer") {
+ sources = [
+ "audio_decoder_opus_fuzzer.cc",
+ ]
+ deps = [
+ ":audio_decoder_fuzzer",
+ "../../modules/audio_coding:webrtc_opus",
+ ]
+}
diff --git a/webrtc/test/fuzzers/OWNERS b/webrtc/test/fuzzers/OWNERS
new file mode 100644
index 0000000000..6782b61fca
--- /dev/null
+++ b/webrtc/test/fuzzers/OWNERS
@@ -0,0 +1 @@
+pbos@webrtc.org
diff --git a/webrtc/test/fuzzers/audio_decoder_fuzzer.cc b/webrtc/test/fuzzers/audio_decoder_fuzzer.cc
new file mode 100644
index 0000000000..fb5adb6cd8
--- /dev/null
+++ b/webrtc/test/fuzzers/audio_decoder_fuzzer.cc
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+#include "webrtc/test/fuzzers/audio_decoder_fuzzer.h"
+
+#include "webrtc/base/checks.h"
+#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
+
+namespace webrtc {
+namespace {
+size_t PacketSizeFromTwoBytes(const uint8_t* data, size_t size) {
+ if (size < 2)
+ return 0;
+ return static_cast<size_t>((data[0] << 8) + data[1]);
+}
+} // namespace
+
+// This function reads two bytes from the beginning of |data|, interprets them
+// as the first packet length, and reads this many bytes if available. The
+// payload is inserted into the decoder, and the process continues until no more
+// data is available.
+void FuzzAudioDecoder(const uint8_t* data,
+ size_t size,
+ AudioDecoder* decoder,
+ int sample_rate_hz,
+ size_t max_decoded_bytes,
+ int16_t* decoded) {
+ const uint8_t* data_ptr = data;
+ size_t remaining_size = size;
+ size_t packet_len = PacketSizeFromTwoBytes(data_ptr, remaining_size);
+ while (packet_len != 0 && packet_len <= remaining_size - 2) {
+ data_ptr += 2;
+ remaining_size -= 2;
+ AudioDecoder::SpeechType speech_type;
+ decoder->Decode(data_ptr, packet_len, sample_rate_hz, max_decoded_bytes,
+ decoded, &speech_type);
+ data_ptr += packet_len;
+ remaining_size -= packet_len;
+ packet_len = PacketSizeFromTwoBytes(data_ptr, remaining_size);
+ }
+}
+} // namespace webrtc
diff --git a/webrtc/test/fuzzers/audio_decoder_fuzzer.h b/webrtc/test/fuzzers/audio_decoder_fuzzer.h
new file mode 100644
index 0000000000..cdd8574300
--- /dev/null
+++ b/webrtc/test/fuzzers/audio_decoder_fuzzer.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2015 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 WEBRTC_TEST_FUZZERS_AUDIO_DECODER_FUZZER_H_
+#define WEBRTC_TEST_FUZZERS_AUDIO_DECODER_FUZZER_H_
+
+#include <stddef.h>
+
+#include "webrtc/typedefs.h"
+
+namespace webrtc {
+
+class AudioDecoder;
+
+void FuzzAudioDecoder(const uint8_t* data,
+ size_t size,
+ AudioDecoder* decoder,
+ int sample_rate_hz,
+ size_t max_decoded_bytes,
+ int16_t* decoded);
+
+} // namespace webrtc
+
+#endif // WEBRTC_TEST_FUZZERS_AUDIO_DECODER_FUZZER_H_
diff --git a/webrtc/test/fuzzers/audio_decoder_ilbc_fuzzer.cc b/webrtc/test/fuzzers/audio_decoder_ilbc_fuzzer.cc
new file mode 100644
index 0000000000..d2a87f0cb6
--- /dev/null
+++ b/webrtc/test/fuzzers/audio_decoder_ilbc_fuzzer.cc
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+#include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
+#include "webrtc/test/fuzzers/audio_decoder_fuzzer.h"
+
+namespace webrtc {
+void FuzzOneInput(const uint8_t* data, size_t size) {
+ AudioDecoderIlbc dec;
+ static const int kSampleRateHz = 8000;
+ static const size_t kAllocatedOuputSizeSamples = kSampleRateHz / 10;
+ int16_t output[kAllocatedOuputSizeSamples];
+ FuzzAudioDecoder(data, size, &dec, kSampleRateHz, sizeof(output), output);
+}
+} // namespace webrtc
diff --git a/webrtc/test/fuzzers/audio_decoder_isac_fuzzer.cc b/webrtc/test/fuzzers/audio_decoder_isac_fuzzer.cc
new file mode 100644
index 0000000000..984cfda398
--- /dev/null
+++ b/webrtc/test/fuzzers/audio_decoder_isac_fuzzer.cc
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isac.h"
+#include "webrtc/test/fuzzers/audio_decoder_fuzzer.h"
+
+namespace webrtc {
+void FuzzOneInput(const uint8_t* data, size_t size) {
+ AudioDecoderIsac dec(nullptr);
+ const int sample_rate_hz = size % 2 == 0 ? 16000 : 32000; // 16 or 32 kHz.
+ static const size_t kAllocatedOuputSizeSamples = 32000 / 10; // 100 ms.
+ int16_t output[kAllocatedOuputSizeSamples];
+ FuzzAudioDecoder(data, size, &dec, sample_rate_hz, sizeof(output), output);
+}
+} // namespace webrtc
diff --git a/webrtc/test/fuzzers/audio_decoder_isacfix_fuzzer.cc b/webrtc/test/fuzzers/audio_decoder_isacfix_fuzzer.cc
new file mode 100644
index 0000000000..83fb8c2d62
--- /dev/null
+++ b/webrtc/test/fuzzers/audio_decoder_isacfix_fuzzer.cc
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isacfix.h"
+#include "webrtc/test/fuzzers/audio_decoder_fuzzer.h"
+
+namespace webrtc {
+void FuzzOneInput(const uint8_t* data, size_t size) {
+ AudioDecoderIsacFix dec(nullptr);
+ static const int kSampleRateHz = 16000;
+ static const size_t kAllocatedOuputSizeSamples = 16000 / 10; // 100 ms.
+ int16_t output[kAllocatedOuputSizeSamples];
+ FuzzAudioDecoder(data, size, &dec, kSampleRateHz, sizeof(output), output);
+}
+} // namespace webrtc
diff --git a/webrtc/test/fuzzers/audio_decoder_opus_fuzzer.cc b/webrtc/test/fuzzers/audio_decoder_opus_fuzzer.cc
new file mode 100644
index 0000000000..3d70ec507d
--- /dev/null
+++ b/webrtc/test/fuzzers/audio_decoder_opus_fuzzer.cc
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+#include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h"
+#include "webrtc/test/fuzzers/audio_decoder_fuzzer.h"
+
+namespace webrtc {
+void FuzzOneInput(const uint8_t* data, size_t size) {
+ const size_t channels = (size % 2) + 1; // 1 or 2 channels.
+ AudioDecoderOpus dec(channels);
+ const int kSampleRateHz = 48000;
+ const size_t kAllocatedOuputSizeSamples = kSampleRateHz / 10; // 100 ms.
+ int16_t output[kAllocatedOuputSizeSamples];
+ FuzzAudioDecoder(data, size, &dec, kSampleRateHz, sizeof(output), output);
+}
+} // namespace webrtc
diff --git a/webrtc/test/fuzzers/h264_depacketizer_fuzzer.cc b/webrtc/test/fuzzers/h264_depacketizer_fuzzer.cc
new file mode 100644
index 0000000000..ca73d9495f
--- /dev/null
+++ b/webrtc/test/fuzzers/h264_depacketizer_fuzzer.cc
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#include "webrtc/modules/rtp_rtcp/source/rtp_format_h264.h"
+
+namespace webrtc {
+void FuzzOneInput(const uint8_t* data, size_t size) {
+ RtpDepacketizerH264 depacketizer;
+ RtpDepacketizer::ParsedPayload parsed_payload;
+ depacketizer.Parse(&parsed_payload, data, size);
+}
+} // namespace webrtc
diff --git a/webrtc/test/fuzzers/producer_fec_fuzzer.cc b/webrtc/test/fuzzers/producer_fec_fuzzer.cc
new file mode 100644
index 0000000000..7322fed4bf
--- /dev/null
+++ b/webrtc/test/fuzzers/producer_fec_fuzzer.cc
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#include "webrtc/base/checks.h"
+#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
+#include "webrtc/modules/rtp_rtcp/source/producer_fec.h"
+
+namespace webrtc {
+
+void FuzzOneInput(const uint8_t* data, size_t size) {
+ ForwardErrorCorrection fec;
+ ProducerFec producer(&fec);
+ size_t i = 0;
+ if (size < 4)
+ return;
+ FecProtectionParams params = {data[i++] % 128, data[i++] % 1,
+ static_cast<int>(data[i++] % 10),
+ kFecMaskBursty};
+ producer.SetFecParameters(&params, 0);
+ uint16_t seq_num = data[i++];
+
+ while (i + 3 < size) {
+ size_t rtp_header_length = data[i++] % 10 + 12;
+ size_t payload_size = data[i++] % 10;
+ if (i + payload_size + rtp_header_length + 2 > size)
+ break;
+ rtc::scoped_ptr<uint8_t[]> packet(
+ new uint8_t[payload_size + rtp_header_length]);
+ memcpy(packet.get(), &data[i], payload_size + rtp_header_length);
+ ByteWriter<uint16_t>::WriteBigEndian(&packet[2], seq_num++);
+ i += payload_size + rtp_header_length;
+ // Make sure sequence numbers are increasing.
+ const int kRedPayloadType = 98;
+ rtc::scoped_ptr<RedPacket> red_packet(producer.BuildRedPacket(
+ packet.get(), payload_size, rtp_header_length, kRedPayloadType));
+ bool protect = static_cast<bool>(data[i++] % 2);
+ if (protect) {
+ producer.AddRtpPacketAndGenerateFec(packet.get(), payload_size,
+ rtp_header_length);
+ }
+ uint16_t num_fec_packets = producer.NumAvailableFecPackets();
+ std::vector<RedPacket*> fec_packets;
+ if (num_fec_packets > 0) {
+ fec_packets =
+ producer.GetFecPackets(kRedPayloadType, 99, 100, rtp_header_length);
+ RTC_CHECK_EQ(num_fec_packets, fec_packets.size());
+ }
+ for (RedPacket* fec_packet : fec_packets) {
+ delete fec_packet;
+ }
+ }
+}
+} // namespace webrtc
diff --git a/webrtc/test/fuzzers/vp8_depacketizer_fuzzer.cc b/webrtc/test/fuzzers/vp8_depacketizer_fuzzer.cc
new file mode 100644
index 0000000000..d048372456
--- /dev/null
+++ b/webrtc/test/fuzzers/vp8_depacketizer_fuzzer.cc
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
+
+namespace webrtc {
+void FuzzOneInput(const uint8_t* data, size_t size) {
+ RtpDepacketizerVp8 depacketizer;
+ RtpDepacketizer::ParsedPayload parsed_payload;
+ depacketizer.Parse(&parsed_payload, data, size);
+}
+} // namespace webrtc
diff --git a/webrtc/test/fuzzers/vp8_qp_parser_fuzzer.cc b/webrtc/test/fuzzers/vp8_qp_parser_fuzzer.cc
new file mode 100644
index 0000000000..5135f1a471
--- /dev/null
+++ b/webrtc/test/fuzzers/vp8_qp_parser_fuzzer.cc
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#include "webrtc/modules/video_coding/utility/vp8_header_parser.h"
+
+namespace webrtc {
+void FuzzOneInput(const uint8_t* data, size_t size) {
+ int qp;
+ vp8::GetQp(data, size, &qp);
+}
+} // namespace webrtc
diff --git a/webrtc/test/fuzzers/vp9_depacketizer_fuzzer.cc b/webrtc/test/fuzzers/vp9_depacketizer_fuzzer.cc
new file mode 100644
index 0000000000..02a7cc0f81
--- /dev/null
+++ b/webrtc/test/fuzzers/vp9_depacketizer_fuzzer.cc
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+#include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h"
+
+namespace webrtc {
+void FuzzOneInput(const uint8_t* data, size_t size) {
+ RtpDepacketizerVp9 depacketizer;
+ RtpDepacketizer::ParsedPayload parsed_payload;
+ depacketizer.Parse(&parsed_payload, data, size);
+}
+} // namespace webrtc
diff --git a/webrtc/test/fuzzers/webrtc_fuzzer.gni b/webrtc/test/fuzzers/webrtc_fuzzer.gni
new file mode 100644
index 0000000000..d264392c07
--- /dev/null
+++ b/webrtc/test/fuzzers/webrtc_fuzzer.gni
@@ -0,0 +1,28 @@
+# Copyright (c) 2015 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.
+
+import("//testing/test.gni")
+
+template("webrtc_fuzzer_test") {
+ assert(defined(invoker.sources), "Need sources in $target_name.")
+
+ test(target_name) {
+ forward_variables_from(invoker, [ "sources" ])
+ deps = [
+ ":webrtc_fuzzer_main",
+ ]
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+ if (is_clang) {
+ # Suppress warnings from Chrome's Clang plugins.
+ # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
+ configs -= [ "//build/config/clang:find_bad_constructs" ]
+ }
+ }
+}
diff --git a/webrtc/test/fuzzers/webrtc_fuzzer_main.cc b/webrtc/test/fuzzers/webrtc_fuzzer_main.cc
new file mode 100644
index 0000000000..50a513c094
--- /dev/null
+++ b/webrtc/test/fuzzers/webrtc_fuzzer_main.cc
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+// This file is intended to provide a common interface for fuzzing functions.
+// It's intended to set sane defaults, such as removing logging for further
+// fuzzing efficiency.
+
+#include "webrtc/base/logging.h"
+
+namespace {
+bool g_initialized = false;
+void InitializeWebRtcFuzzDefaults() {
+ if (g_initialized)
+ return;
+
+ // Remove default logging to prevent huge slowdowns.
+ // TODO(pbos): Disable in Chromium: http://crbug.com/561667
+#if !defined(WEBRTC_CHROMIUM_BUILD)
+ rtc::LogMessage::LogToDebug(rtc::LS_NONE);
+#endif // !defined(WEBRTC_CHROMIUM_BUILD)
+
+ g_initialized = true;
+}
+}
+
+namespace webrtc {
+extern void FuzzOneInput(const uint8_t* data, size_t size);
+} // namespace webrtc
+
+extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+ InitializeWebRtcFuzzDefaults();
+ webrtc::FuzzOneInput(data, size);
+ return 0;
+}
diff --git a/webrtc/test/gl/gl_renderer.h b/webrtc/test/gl/gl_renderer.h
index 27749468a2..7682d3c918 100644
--- a/webrtc/test/gl/gl_renderer.h
+++ b/webrtc/test/gl/gl_renderer.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_GL_GL_RENDERER_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_GL_GL_RENDERER_H_
+#ifndef WEBRTC_TEST_GL_GL_RENDERER_H_
+#define WEBRTC_TEST_GL_GL_RENDERER_H_
#ifdef WEBRTC_MAC
#include <OpenGL/gl.h>
@@ -48,4 +48,4 @@ class GlRenderer : public VideoRenderer {
} // test
} // webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_GL_GL_RENDERER_H_
+#endif // WEBRTC_TEST_GL_GL_RENDERER_H_
diff --git a/webrtc/test/histogram.cc b/webrtc/test/histogram.cc
index 6fcdb6864f..2893e4389a 100644
--- a/webrtc/test/histogram.cc
+++ b/webrtc/test/histogram.cc
@@ -12,6 +12,7 @@
#include <map>
+#include "webrtc/base/checks.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/thread_annotations.h"
#include "webrtc/system_wrappers/include/metrics.h"
@@ -22,10 +23,10 @@
namespace webrtc {
namespace {
struct SampleInfo {
- SampleInfo(int sample)
- : last(sample), total(1) {}
- int last; // Last added sample.
- int total; // Total number of added samples.
+ SampleInfo(const std::string& name) : name_(name), last_(-1), total_(0) {}
+ const std::string name_;
+ int last_; // Last added sample.
+ int total_; // Total number of added samples.
};
rtc::CriticalSection histogram_crit_;
@@ -36,21 +37,33 @@ std::map<std::string, SampleInfo> histograms_ GUARDED_BY(histogram_crit_);
namespace metrics {
Histogram* HistogramFactoryGetCounts(const std::string& name, int min, int max,
- int bucket_count) { return NULL; }
+ int bucket_count) {
+ rtc::CritScope cs(&histogram_crit_);
+ if (histograms_.find(name) == histograms_.end()) {
+ histograms_.insert(std::make_pair(name, SampleInfo(name)));
+ }
+ auto it = histograms_.find(name);
+ return reinterpret_cast<Histogram*>(&it->second);
+}
Histogram* HistogramFactoryGetEnumeration(const std::string& name,
- int boundary) { return NULL; }
+ int boundary) {
+ rtc::CritScope cs(&histogram_crit_);
+ if (histograms_.find(name) == histograms_.end()) {
+ histograms_.insert(std::make_pair(name, SampleInfo(name)));
+ }
+ auto it = histograms_.find(name);
+ return reinterpret_cast<Histogram*>(&it->second);
+}
void HistogramAdd(
Histogram* histogram_pointer, const std::string& name, int sample) {
rtc::CritScope cs(&histogram_crit_);
- auto it = histograms_.find(name);
- if (it == histograms_.end()) {
- histograms_.insert(std::make_pair(name, SampleInfo(sample)));
- return;
- }
- it->second.last = sample;
- ++it->second.total;
+ SampleInfo* ptr = reinterpret_cast<SampleInfo*>(histogram_pointer);
+ // The name should not vary.
+ RTC_CHECK(ptr->name_ == name);
+ ptr->last_ = sample;
+ ++ptr->total_;
}
} // namespace metrics
@@ -61,7 +74,7 @@ int LastHistogramSample(const std::string& name) {
if (it == histograms_.end()) {
return -1;
}
- return it->second.last;
+ return it->second.last_;
}
int NumHistogramSamples(const std::string& name) {
@@ -70,13 +83,15 @@ int NumHistogramSamples(const std::string& name) {
if (it == histograms_.end()) {
return 0;
}
- return it->second.total;
+ return it->second.total_;
}
void ClearHistograms() {
rtc::CritScope cs(&histogram_crit_);
- histograms_.clear();
+ for (auto& it : histograms_) {
+ it.second.last_ = -1;
+ it.second.total_ = 0;
+ }
}
} // namespace test
} // namespace webrtc
-
diff --git a/webrtc/test/histogram.h b/webrtc/test/histogram.h
index 44ce32b4f4..3c8e743aa1 100644
--- a/webrtc/test/histogram.h
+++ b/webrtc/test/histogram.h
@@ -23,7 +23,7 @@ int LastHistogramSample(const std::string& name);
// Returns the number of added samples to a histogram.
int NumHistogramSamples(const std::string& name);
-// Removes all histograms.
+// Removes all histogram samples.
void ClearHistograms();
} // namespace test
diff --git a/webrtc/test/layer_filtering_transport.cc b/webrtc/test/layer_filtering_transport.cc
index a4ebf47f93..41d63ad6e7 100644
--- a/webrtc/test/layer_filtering_transport.cc
+++ b/webrtc/test/layer_filtering_transport.cc
@@ -9,8 +9,7 @@
*/
#include "webrtc/base/checks.h"
-#include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
-#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
+#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_format.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
@@ -24,33 +23,35 @@ LayerFilteringTransport::LayerFilteringTransport(
Call* send_call,
uint8_t vp8_video_payload_type,
uint8_t vp9_video_payload_type,
- uint8_t tl_discard_threshold,
- uint8_t sl_discard_threshold)
+ int selected_tl,
+ int selected_sl)
: test::DirectTransport(config, send_call),
vp8_video_payload_type_(vp8_video_payload_type),
vp9_video_payload_type_(vp9_video_payload_type),
- tl_discard_threshold_(tl_discard_threshold),
- sl_discard_threshold_(sl_discard_threshold) {}
+ selected_tl_(selected_tl),
+ selected_sl_(selected_sl),
+ discarded_last_packet_(false) {}
-uint16_t LayerFilteringTransport::NextSequenceNumber(uint32_t ssrc) {
- auto it = current_seq_nums_.find(ssrc);
- if (it == current_seq_nums_.end())
- return current_seq_nums_[ssrc] = 10000;
- return ++it->second;
+bool LayerFilteringTransport::DiscardedLastPacket() const {
+ return discarded_last_packet_;
}
bool LayerFilteringTransport::SendRtp(const uint8_t* packet,
size_t length,
const PacketOptions& options) {
- if (tl_discard_threshold_ == 0 && sl_discard_threshold_ == 0) {
+ if (selected_tl_ == -1 && selected_sl_ == -1) {
// Nothing to change, forward the packet immediately.
return test::DirectTransport::SendRtp(packet, length, options);
}
bool set_marker_bit = false;
- rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
+ RtpUtility::RtpHeaderParser parser(packet, length);
RTPHeader header;
- parser->Parse(packet, length, &header);
+ parser.Parse(&header);
+
+ RTC_DCHECK_LE(length, static_cast<size_t>(IP_PACKET_SIZE));
+ uint8_t temp_buffer[IP_PACKET_SIZE];
+ memcpy(temp_buffer, packet, length);
if (header.payloadType == vp8_video_payload_type_ ||
header.payloadType == vp9_video_payload_type_) {
@@ -65,40 +66,38 @@ bool LayerFilteringTransport::SendRtp(const uint8_t* packet,
RtpDepacketizer::Create(is_vp8 ? kRtpVideoVp8 : kRtpVideoVp9));
RtpDepacketizer::ParsedPayload parsed_payload;
if (depacketizer->Parse(&parsed_payload, payload, payload_data_length)) {
- const uint8_t temporalIdx =
+ const int temporal_idx = static_cast<int>(
is_vp8 ? parsed_payload.type.Video.codecHeader.VP8.temporalIdx
- : parsed_payload.type.Video.codecHeader.VP9.temporal_idx;
- const uint8_t spatialIdx =
+ : parsed_payload.type.Video.codecHeader.VP9.temporal_idx);
+ const int spatial_idx = static_cast<int>(
is_vp8 ? kNoSpatialIdx
- : parsed_payload.type.Video.codecHeader.VP9.spatial_idx;
- if (sl_discard_threshold_ > 0 &&
- spatialIdx == sl_discard_threshold_ - 1 &&
+ : parsed_payload.type.Video.codecHeader.VP9.spatial_idx);
+ if (selected_sl_ >= 0 && spatial_idx == selected_sl_ &&
parsed_payload.type.Video.codecHeader.VP9.end_of_frame) {
// This layer is now the last in the superframe.
set_marker_bit = true;
- }
- if ((tl_discard_threshold_ > 0 && temporalIdx != kNoTemporalIdx &&
- temporalIdx >= tl_discard_threshold_) ||
- (sl_discard_threshold_ > 0 && spatialIdx != kNoSpatialIdx &&
- spatialIdx >= sl_discard_threshold_)) {
- return true; // Discard the packet.
+ } else if ((selected_tl_ >= 0 && temporal_idx != kNoTemporalIdx &&
+ temporal_idx > selected_tl_) ||
+ (selected_sl_ >= 0 && spatial_idx != kNoSpatialIdx &&
+ spatial_idx > selected_sl_)) {
+ // Truncate packet to a padding packet.
+ length = header.headerLength + 1;
+ temp_buffer[0] |= (1 << 5); // P = 1.
+ temp_buffer[1] &= 0x7F; // M = 0.
+ discarded_last_packet_ = true;
+ temp_buffer[header.headerLength] = 1; // One byte of padding.
}
} else {
RTC_NOTREACHED() << "Parse error";
}
}
- uint8_t temp_buffer[IP_PACKET_SIZE];
- memcpy(temp_buffer, packet, length);
-
// We are discarding some of the packets (specifically, whole layers), so
// make sure the marker bit is set properly, and that sequence numbers are
// continuous.
if (set_marker_bit)
temp_buffer[1] |= kRtpMarkerBitMask;
- uint16_t seq_num = NextSequenceNumber(header.ssrc);
- ByteWriter<uint16_t>::WriteBigEndian(&temp_buffer[2], seq_num);
return test::DirectTransport::SendRtp(temp_buffer, length, options);
}
diff --git a/webrtc/test/layer_filtering_transport.h b/webrtc/test/layer_filtering_transport.h
index 3f2389a51b..d453556235 100644
--- a/webrtc/test/layer_filtering_transport.h
+++ b/webrtc/test/layer_filtering_transport.h
@@ -26,23 +26,22 @@ class LayerFilteringTransport : public test::DirectTransport {
Call* send_call,
uint8_t vp8_video_payload_type,
uint8_t vp9_video_payload_type,
- uint8_t tl_discard_threshold,
- uint8_t sl_discard_threshold);
+ int selected_tl,
+ int selected_sl);
+ bool DiscardedLastPacket() const;
bool SendRtp(const uint8_t* data,
size_t length,
const PacketOptions& options) override;
private:
- uint16_t NextSequenceNumber(uint32_t ssrc);
// Used to distinguish between VP8 and VP9.
const uint8_t vp8_video_payload_type_;
const uint8_t vp9_video_payload_type_;
- // Discard all temporal/spatial layers with id greater or equal the
- // threshold. 0 to disable.
- const uint8_t tl_discard_threshold_;
- const uint8_t sl_discard_threshold_;
- // Current sequence number for each SSRC separately.
- std::map<uint32_t, uint16_t> current_seq_nums_;
+ // Discard or invalidate all temporal/spatial layers with id greater than the
+ // selected one. -1 to disable filtering.
+ const int selected_tl_;
+ const int selected_sl_;
+ bool discarded_last_packet_;
};
} // namespace test
diff --git a/webrtc/test/linux/glx_renderer.h b/webrtc/test/linux/glx_renderer.h
index 517f22a038..c117281cf1 100644
--- a/webrtc/test/linux/glx_renderer.h
+++ b/webrtc/test/linux/glx_renderer.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_LINUX_GLX_RENDERER_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_LINUX_GLX_RENDERER_H_
+#ifndef WEBRTC_TEST_LINUX_GLX_RENDERER_H_
+#define WEBRTC_TEST_LINUX_GLX_RENDERER_H_
#include <GL/glx.h>
#include <X11/Xlib.h>
@@ -45,4 +45,4 @@ class GlxRenderer : public GlRenderer {
} // test
} // webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_LINUX_GLX_RENDERER_H_
+#endif // WEBRTC_TEST_LINUX_GLX_RENDERER_H_
diff --git a/webrtc/test/mac/video_renderer_mac.h b/webrtc/test/mac/video_renderer_mac.h
index 2e55538954..7baf794744 100644
--- a/webrtc/test/mac/video_renderer_mac.h
+++ b/webrtc/test/mac/video_renderer_mac.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_MAC_VIDEO_RENDERER_MAC_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_MAC_VIDEO_RENDERER_MAC_H_
+#ifndef WEBRTC_TEST_MAC_VIDEO_RENDERER_MAC_H_
+#define WEBRTC_TEST_MAC_VIDEO_RENDERER_MAC_H_
#include "webrtc/base/constructormagic.h"
#include "webrtc/test/gl/gl_renderer.h"
@@ -38,4 +38,4 @@ class MacRenderer : public GlRenderer {
} // test
} // webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_MAC_VIDEO_RENDERER_MAC_H_
+#endif // WEBRTC_TEST_MAC_VIDEO_RENDERER_MAC_H_
diff --git a/webrtc/test/mock_voe_channel_proxy.h b/webrtc/test/mock_voe_channel_proxy.h
new file mode 100644
index 0000000000..b5d79c18ea
--- /dev/null
+++ b/webrtc/test/mock_voe_channel_proxy.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015 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 WEBRTC_TEST_MOCK_VOE_CHANNEL_PROXY_H_
+#define WEBRTC_TEST_MOCK_VOE_CHANNEL_PROXY_H_
+
+#include <string>
+#include "testing/gmock/include/gmock/gmock.h"
+#include "webrtc/voice_engine/channel_proxy.h"
+
+namespace webrtc {
+namespace test {
+
+class MockVoEChannelProxy : public voe::ChannelProxy {
+ public:
+ MOCK_METHOD1(SetRTCPStatus, void(bool enable));
+ MOCK_METHOD1(SetLocalSSRC, void(uint32_t ssrc));
+ MOCK_METHOD1(SetRTCP_CNAME, void(const std::string& c_name));
+ MOCK_METHOD2(SetSendAbsoluteSenderTimeStatus, void(bool enable, int id));
+ MOCK_METHOD2(SetSendAudioLevelIndicationStatus, void(bool enable, int id));
+ MOCK_METHOD1(EnableSendTransportSequenceNumber, void(int id));
+ MOCK_METHOD2(SetReceiveAbsoluteSenderTimeStatus, void(bool enable, int id));
+ MOCK_METHOD2(SetReceiveAudioLevelIndicationStatus, void(bool enable, int id));
+ MOCK_METHOD3(SetCongestionControlObjects,
+ void(RtpPacketSender* rtp_packet_sender,
+ TransportFeedbackObserver* transport_feedback_observer,
+ PacketRouter* seq_num_allocator));
+ MOCK_CONST_METHOD0(GetRTCPStatistics, CallStatistics());
+ MOCK_CONST_METHOD0(GetRemoteRTCPReportBlocks, std::vector<ReportBlock>());
+ MOCK_CONST_METHOD0(GetNetworkStatistics, NetworkStatistics());
+ MOCK_CONST_METHOD0(GetDecodingCallStatistics, AudioDecodingCallStats());
+ MOCK_CONST_METHOD0(GetSpeechOutputLevelFullRange, int32_t());
+ MOCK_CONST_METHOD0(GetDelayEstimate, uint32_t());
+ MOCK_METHOD1(SetSendTelephoneEventPayloadType, bool(int payload_type));
+ MOCK_METHOD2(SendTelephoneEventOutband, bool(uint8_t event,
+ uint32_t duration_ms));
+};
+} // namespace test
+} // namespace webrtc
+
+#endif // WEBRTC_TEST_MOCK_VOE_CHANNEL_PROXY_H_
diff --git a/webrtc/test/mock_voice_engine.h b/webrtc/test/mock_voice_engine.h
new file mode 100644
index 0000000000..28a75f8063
--- /dev/null
+++ b/webrtc/test/mock_voice_engine.h
@@ -0,0 +1,337 @@
+/*
+ * Copyright (c) 2015 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 WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_
+#define WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_
+
+#include "testing/gmock/include/gmock/gmock.h"
+#include "webrtc/test/mock_voe_channel_proxy.h"
+#include "webrtc/voice_engine/voice_engine_impl.h"
+
+namespace webrtc {
+namespace test {
+
+// NOTE: This class inherits from VoiceEngineImpl so that its clients will be
+// able to get the various interfaces as usual, via T::GetInterface().
+class MockVoiceEngine : public VoiceEngineImpl {
+ public:
+ MockVoiceEngine() : VoiceEngineImpl(new Config(), true) {
+ // Increase ref count so this object isn't automatically deleted whenever
+ // interfaces are Release():d.
+ ++_ref_count;
+ // We add this default behavior to make the mock easier to use in tests. It
+ // will create a NiceMock of a voe::ChannelProxy.
+ ON_CALL(*this, ChannelProxyFactory(testing::_))
+ .WillByDefault(
+ testing::Invoke([](int channel_id) {
+ return new testing::NiceMock<MockVoEChannelProxy>();
+ }));
+ }
+ ~MockVoiceEngine() override {
+ // Decrease ref count before base class d-tor is called; otherwise it will
+ // trigger an assertion.
+ --_ref_count;
+ }
+ // Allows injecting a ChannelProxy factory.
+ MOCK_METHOD1(ChannelProxyFactory, voe::ChannelProxy*(int channel_id));
+
+ // VoiceEngineImpl
+ rtc::scoped_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id) override {
+ return rtc::scoped_ptr<voe::ChannelProxy>(ChannelProxyFactory(channel_id));
+ }
+
+ // VoEAudioProcessing
+ MOCK_METHOD2(SetNsStatus, int(bool enable, NsModes mode));
+ MOCK_METHOD2(GetNsStatus, int(bool& enabled, NsModes& mode));
+ MOCK_METHOD2(SetAgcStatus, int(bool enable, AgcModes mode));
+ MOCK_METHOD2(GetAgcStatus, int(bool& enabled, AgcModes& mode));
+ MOCK_METHOD1(SetAgcConfig, int(AgcConfig config));
+ MOCK_METHOD1(GetAgcConfig, int(AgcConfig& config));
+ MOCK_METHOD2(SetEcStatus, int(bool enable, EcModes mode));
+ MOCK_METHOD2(GetEcStatus, int(bool& enabled, EcModes& mode));
+ MOCK_METHOD1(EnableDriftCompensation, int(bool enable));
+ MOCK_METHOD0(DriftCompensationEnabled, bool());
+ MOCK_METHOD1(SetDelayOffsetMs, void(int offset));
+ MOCK_METHOD0(DelayOffsetMs, int());
+ MOCK_METHOD2(SetAecmMode, int(AecmModes mode, bool enableCNG));
+ MOCK_METHOD2(GetAecmMode, int(AecmModes& mode, bool& enabledCNG));
+ MOCK_METHOD1(EnableHighPassFilter, int(bool enable));
+ MOCK_METHOD0(IsHighPassFilterEnabled, bool());
+ MOCK_METHOD3(SetRxNsStatus, int(int channel, bool enable, NsModes mode));
+ MOCK_METHOD3(GetRxNsStatus, int(int channel, bool& enabled, NsModes& mode));
+ MOCK_METHOD3(SetRxAgcStatus, int(int channel, bool enable, AgcModes mode));
+ MOCK_METHOD3(GetRxAgcStatus, int(int channel, bool& enabled, AgcModes& mode));
+ MOCK_METHOD2(SetRxAgcConfig, int(int channel, AgcConfig config));
+ MOCK_METHOD2(GetRxAgcConfig, int(int channel, AgcConfig& config));
+ MOCK_METHOD2(RegisterRxVadObserver,
+ int(int channel, VoERxVadCallback& observer));
+ MOCK_METHOD1(DeRegisterRxVadObserver, int(int channel));
+ MOCK_METHOD1(VoiceActivityIndicator, int(int channel));
+ MOCK_METHOD1(SetEcMetricsStatus, int(bool enable));
+ MOCK_METHOD1(GetEcMetricsStatus, int(bool& enabled));
+ MOCK_METHOD4(GetEchoMetrics, int(int& ERL, int& ERLE, int& RERL, int& A_NLP));
+ MOCK_METHOD3(GetEcDelayMetrics,
+ int(int& delay_median,
+ int& delay_std,
+ float& fraction_poor_delays));
+ MOCK_METHOD1(StartDebugRecording, int(const char* fileNameUTF8));
+ MOCK_METHOD1(StartDebugRecording, int(FILE* file_handle));
+ MOCK_METHOD0(StopDebugRecording, int());
+ MOCK_METHOD1(SetTypingDetectionStatus, int(bool enable));
+ MOCK_METHOD1(GetTypingDetectionStatus, int(bool& enabled));
+ MOCK_METHOD1(TimeSinceLastTyping, int(int& seconds));
+ MOCK_METHOD5(SetTypingDetectionParameters,
+ int(int timeWindow,
+ int costPerTyping,
+ int reportingThreshold,
+ int penaltyDecay,
+ int typeEventDelay));
+ MOCK_METHOD1(EnableStereoChannelSwapping, void(bool enable));
+ MOCK_METHOD0(IsStereoChannelSwappingEnabled, bool());
+
+ // VoEBase
+ MOCK_METHOD1(RegisterVoiceEngineObserver, int(VoiceEngineObserver& observer));
+ MOCK_METHOD0(DeRegisterVoiceEngineObserver, int());
+ MOCK_METHOD2(Init,
+ int(AudioDeviceModule* external_adm,
+ AudioProcessing* audioproc));
+ MOCK_METHOD0(audio_processing, AudioProcessing*());
+ MOCK_METHOD0(Terminate, int());
+ MOCK_METHOD0(CreateChannel, int());
+ MOCK_METHOD1(CreateChannel, int(const Config& config));
+ MOCK_METHOD1(DeleteChannel, int(int channel));
+ MOCK_METHOD1(StartReceive, int(int channel));
+ MOCK_METHOD1(StopReceive, int(int channel));
+ MOCK_METHOD1(StartPlayout, int(int channel));
+ MOCK_METHOD1(StopPlayout, int(int channel));
+ MOCK_METHOD1(StartSend, int(int channel));
+ MOCK_METHOD1(StopSend, int(int channel));
+ MOCK_METHOD1(GetVersion, int(char version[1024]));
+ MOCK_METHOD0(LastError, int());
+ MOCK_METHOD0(audio_transport, AudioTransport*());
+ MOCK_METHOD2(AssociateSendChannel,
+ int(int channel, int accociate_send_channel));
+
+ // VoECodec
+ MOCK_METHOD0(NumOfCodecs, int());
+ MOCK_METHOD2(GetCodec, int(int index, CodecInst& codec));
+ MOCK_METHOD2(SetSendCodec, int(int channel, const CodecInst& codec));
+ MOCK_METHOD2(GetSendCodec, int(int channel, CodecInst& codec));
+ MOCK_METHOD2(SetBitRate, int(int channel, int bitrate_bps));
+ MOCK_METHOD2(GetRecCodec, int(int channel, CodecInst& codec));
+ MOCK_METHOD2(SetRecPayloadType, int(int channel, const CodecInst& codec));
+ MOCK_METHOD2(GetRecPayloadType, int(int channel, CodecInst& codec));
+ MOCK_METHOD3(SetSendCNPayloadType,
+ int(int channel, int type, PayloadFrequencies frequency));
+ MOCK_METHOD2(SetFECStatus, int(int channel, bool enable));
+ MOCK_METHOD2(GetFECStatus, int(int channel, bool& enabled));
+ MOCK_METHOD4(SetVADStatus,
+ int(int channel, bool enable, VadModes mode, bool disableDTX));
+ MOCK_METHOD4(
+ GetVADStatus,
+ int(int channel, bool& enabled, VadModes& mode, bool& disabledDTX));
+ MOCK_METHOD2(SetOpusMaxPlaybackRate, int(int channel, int frequency_hz));
+ MOCK_METHOD2(SetOpusDtx, int(int channel, bool enable_dtx));
+ MOCK_METHOD0(GetEventLog, RtcEventLog*());
+
+ // VoEDtmf
+ MOCK_METHOD5(SendTelephoneEvent,
+ int(int channel,
+ int eventCode,
+ bool outOfBand,
+ int lengthMs,
+ int attenuationDb));
+ MOCK_METHOD2(SetSendTelephoneEventPayloadType,
+ int(int channel, unsigned char type));
+ MOCK_METHOD2(GetSendTelephoneEventPayloadType,
+ int(int channel, unsigned char& type));
+ MOCK_METHOD2(SetDtmfFeedbackStatus, int(bool enable, bool directFeedback));
+ MOCK_METHOD2(GetDtmfFeedbackStatus, int(bool& enabled, bool& directFeedback));
+ MOCK_METHOD3(PlayDtmfTone,
+ int(int eventCode, int lengthMs, int attenuationDb));
+
+ // VoEExternalMedia
+ MOCK_METHOD3(RegisterExternalMediaProcessing,
+ int(int channel,
+ ProcessingTypes type,
+ VoEMediaProcess& processObject));
+ MOCK_METHOD2(DeRegisterExternalMediaProcessing,
+ int(int channel, ProcessingTypes type));
+ MOCK_METHOD3(GetAudioFrame,
+ int(int channel, int desired_sample_rate_hz, AudioFrame* frame));
+ MOCK_METHOD2(SetExternalMixing, int(int channel, bool enable));
+
+ // VoEFile
+ MOCK_METHOD7(StartPlayingFileLocally,
+ int(int channel,
+ const char fileNameUTF8[1024],
+ bool loop,
+ FileFormats format,
+ float volumeScaling,
+ int startPointMs,
+ int stopPointMs));
+ MOCK_METHOD6(StartPlayingFileLocally,
+ int(int channel,
+ InStream* stream,
+ FileFormats format,
+ float volumeScaling,
+ int startPointMs,
+ int stopPointMs));
+ MOCK_METHOD1(StopPlayingFileLocally, int(int channel));
+ MOCK_METHOD1(IsPlayingFileLocally, int(int channel));
+ MOCK_METHOD6(StartPlayingFileAsMicrophone,
+ int(int channel,
+ const char fileNameUTF8[1024],
+ bool loop,
+ bool mixWithMicrophone,
+ FileFormats format,
+ float volumeScaling));
+ MOCK_METHOD5(StartPlayingFileAsMicrophone,
+ int(int channel,
+ InStream* stream,
+ bool mixWithMicrophone,
+ FileFormats format,
+ float volumeScaling));
+ MOCK_METHOD1(StopPlayingFileAsMicrophone, int(int channel));
+ MOCK_METHOD1(IsPlayingFileAsMicrophone, int(int channel));
+ MOCK_METHOD4(StartRecordingPlayout,
+ int(int channel,
+ const char* fileNameUTF8,
+ CodecInst* compression,
+ int maxSizeBytes));
+ MOCK_METHOD1(StopRecordingPlayout, int(int channel));
+ MOCK_METHOD3(StartRecordingPlayout,
+ int(int channel, OutStream* stream, CodecInst* compression));
+ MOCK_METHOD3(StartRecordingMicrophone,
+ int(const char* fileNameUTF8,
+ CodecInst* compression,
+ int maxSizeBytes));
+ MOCK_METHOD2(StartRecordingMicrophone,
+ int(OutStream* stream, CodecInst* compression));
+ MOCK_METHOD0(StopRecordingMicrophone, int());
+
+ // VoEHardware
+ MOCK_METHOD1(GetNumOfRecordingDevices, int(int& devices));
+ MOCK_METHOD1(GetNumOfPlayoutDevices, int(int& devices));
+ MOCK_METHOD3(GetRecordingDeviceName,
+ int(int index, char strNameUTF8[128], char strGuidUTF8[128]));
+ MOCK_METHOD3(GetPlayoutDeviceName,
+ int(int index, char strNameUTF8[128], char strGuidUTF8[128]));
+ MOCK_METHOD2(SetRecordingDevice,
+ int(int index, StereoChannel recordingChannel));
+ MOCK_METHOD1(SetPlayoutDevice, int(int index));
+ MOCK_METHOD1(SetAudioDeviceLayer, int(AudioLayers audioLayer));
+ MOCK_METHOD1(GetAudioDeviceLayer, int(AudioLayers& audioLayer));
+ MOCK_METHOD1(SetRecordingSampleRate, int(unsigned int samples_per_sec));
+ MOCK_CONST_METHOD1(RecordingSampleRate, int(unsigned int* samples_per_sec));
+ MOCK_METHOD1(SetPlayoutSampleRate, int(unsigned int samples_per_sec));
+ MOCK_CONST_METHOD1(PlayoutSampleRate, int(unsigned int* samples_per_sec));
+ MOCK_CONST_METHOD0(BuiltInAECIsAvailable, bool());
+ MOCK_METHOD1(EnableBuiltInAEC, int(bool enable));
+ MOCK_CONST_METHOD0(BuiltInAGCIsAvailable, bool());
+ MOCK_METHOD1(EnableBuiltInAGC, int(bool enable));
+ MOCK_CONST_METHOD0(BuiltInNSIsAvailable, bool());
+ MOCK_METHOD1(EnableBuiltInNS, int(bool enable));
+
+ // VoENetEqStats
+ MOCK_METHOD2(GetNetworkStatistics,
+ int(int channel, NetworkStatistics& stats));
+ MOCK_CONST_METHOD2(GetDecodingCallStatistics,
+ int(int channel, AudioDecodingCallStats* stats));
+
+ // VoENetwork
+ MOCK_METHOD2(RegisterExternalTransport,
+ int(int channel, Transport& transport));
+ MOCK_METHOD1(DeRegisterExternalTransport, int(int channel));
+ MOCK_METHOD3(ReceivedRTPPacket,
+ int(int channel, const void* data, size_t length));
+ MOCK_METHOD4(ReceivedRTPPacket,
+ int(int channel,
+ const void* data,
+ size_t length,
+ const PacketTime& packet_time));
+ MOCK_METHOD3(ReceivedRTCPPacket,
+ int(int channel, const void* data, size_t length));
+
+ // VoERTP_RTCP
+ MOCK_METHOD2(SetLocalSSRC, int(int channel, unsigned int ssrc));
+ MOCK_METHOD2(GetLocalSSRC, int(int channel, unsigned int& ssrc));
+ MOCK_METHOD2(GetRemoteSSRC, int(int channel, unsigned int& ssrc));
+ MOCK_METHOD3(SetSendAudioLevelIndicationStatus,
+ int(int channel, bool enable, unsigned char id));
+ MOCK_METHOD3(SetReceiveAudioLevelIndicationStatus,
+ int(int channel, bool enable, unsigned char id));
+ MOCK_METHOD3(SetSendAbsoluteSenderTimeStatus,
+ int(int channel, bool enable, unsigned char id));
+ MOCK_METHOD3(SetReceiveAbsoluteSenderTimeStatus,
+ int(int channel, bool enable, unsigned char id));
+ MOCK_METHOD2(SetRTCPStatus, int(int channel, bool enable));
+ MOCK_METHOD2(GetRTCPStatus, int(int channel, bool& enabled));
+ MOCK_METHOD2(SetRTCP_CNAME, int(int channel, const char cName[256]));
+ MOCK_METHOD2(GetRTCP_CNAME, int(int channel, char cName[256]));
+ MOCK_METHOD2(GetRemoteRTCP_CNAME, int(int channel, char cName[256]));
+ MOCK_METHOD7(GetRemoteRTCPData,
+ int(int channel,
+ unsigned int& NTPHigh,
+ unsigned int& NTPLow,
+ unsigned int& timestamp,
+ unsigned int& playoutTimestamp,
+ unsigned int* jitter,
+ unsigned short* fractionLost));
+ MOCK_METHOD4(GetRTPStatistics,
+ int(int channel,
+ unsigned int& averageJitterMs,
+ unsigned int& maxJitterMs,
+ unsigned int& discardedPackets));
+ MOCK_METHOD2(GetRTCPStatistics, int(int channel, CallStatistics& stats));
+ MOCK_METHOD2(GetRemoteRTCPReportBlocks,
+ int(int channel, std::vector<ReportBlock>* receive_blocks));
+ MOCK_METHOD3(SetREDStatus, int(int channel, bool enable, int redPayloadtype));
+ MOCK_METHOD3(GetREDStatus,
+ int(int channel, bool& enable, int& redPayloadtype));
+ MOCK_METHOD3(SetNACKStatus, int(int channel, bool enable, int maxNoPackets));
+
+ // VoEVideoSync
+ MOCK_METHOD1(GetPlayoutBufferSize, int(int& buffer_ms));
+ MOCK_METHOD2(SetMinimumPlayoutDelay, int(int channel, int delay_ms));
+ MOCK_METHOD3(GetDelayEstimate,
+ int(int channel,
+ int* jitter_buffer_delay_ms,
+ int* playout_buffer_delay_ms));
+ MOCK_CONST_METHOD1(GetLeastRequiredDelayMs, int(int channel));
+ MOCK_METHOD2(SetInitTimestamp, int(int channel, unsigned int timestamp));
+ MOCK_METHOD2(SetInitSequenceNumber, int(int channel, short sequenceNumber));
+ MOCK_METHOD2(GetPlayoutTimestamp, int(int channel, unsigned int& timestamp));
+ MOCK_METHOD3(GetRtpRtcp,
+ int(int channel,
+ RtpRtcp** rtpRtcpModule,
+ RtpReceiver** rtp_receiver));
+
+ // VoEVolumeControl
+ MOCK_METHOD1(SetSpeakerVolume, int(unsigned int volume));
+ MOCK_METHOD1(GetSpeakerVolume, int(unsigned int& volume));
+ MOCK_METHOD1(SetMicVolume, int(unsigned int volume));
+ MOCK_METHOD1(GetMicVolume, int(unsigned int& volume));
+ MOCK_METHOD2(SetInputMute, int(int channel, bool enable));
+ MOCK_METHOD2(GetInputMute, int(int channel, bool& enabled));
+ MOCK_METHOD1(GetSpeechInputLevel, int(unsigned int& level));
+ MOCK_METHOD2(GetSpeechOutputLevel, int(int channel, unsigned int& level));
+ MOCK_METHOD1(GetSpeechInputLevelFullRange, int(unsigned int& level));
+ MOCK_METHOD2(GetSpeechOutputLevelFullRange,
+ int(int channel, unsigned& level));
+ MOCK_METHOD2(SetChannelOutputVolumeScaling, int(int channel, float scaling));
+ MOCK_METHOD2(GetChannelOutputVolumeScaling, int(int channel, float& scaling));
+ MOCK_METHOD3(SetOutputVolumePan, int(int channel, float left, float right));
+ MOCK_METHOD3(GetOutputVolumePan, int(int channel, float& left, float& right));
+};
+} // namespace test
+} // namespace webrtc
+
+#endif // WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_
diff --git a/webrtc/test/null_transport.h b/webrtc/test/null_transport.h
index f4b704634d..c49883e1dc 100644
--- a/webrtc/test/null_transport.h
+++ b/webrtc/test/null_transport.h
@@ -7,8 +7,8 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_NULL_TRANSPORT_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_NULL_TRANSPORT_H_
+#ifndef WEBRTC_TEST_NULL_TRANSPORT_H_
+#define WEBRTC_TEST_NULL_TRANSPORT_H_
#include "webrtc/transport.h"
@@ -27,4 +27,4 @@ class NullTransport : public Transport {
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_NULL_TRANSPORT_H_
+#endif // WEBRTC_TEST_NULL_TRANSPORT_H_
diff --git a/webrtc/test/random.cc b/webrtc/test/random.cc
deleted file mode 100644
index c4c405f6b8..0000000000
--- a/webrtc/test/random.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2015 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.
- */
-
-#include "webrtc/test/random.h"
-
-#include <math.h>
-
-#include "webrtc/base/checks.h"
-
-namespace webrtc {
-
-namespace test {
-
-Random::Random(uint32_t seed) : a_(0x531FDB97 ^ seed), b_(0x6420ECA8 + seed) {
-}
-
-float Random::Rand() {
- const double kScale = 1.0f / (static_cast<uint64_t>(1) << 32);
- double result = kScale * b_;
- a_ ^= b_;
- b_ += a_;
- return static_cast<float>(result);
-}
-
-int Random::Rand(int low, int high) {
- RTC_DCHECK(low <= high);
- float uniform = Rand() * (high - low + 1) + low;
- return static_cast<int>(uniform);
-}
-
-int Random::Gaussian(int mean, int standard_deviation) {
- // Creating a Normal distribution variable from two independent uniform
- // variables based on the Box-Muller transform, which is defined on the
- // interval (0, 1], hence the mask+add below.
- const double kPi = 3.14159265358979323846;
- const double kScale = 1.0 / 0x80000000ul;
- double u1 = kScale * ((a_ & 0x7ffffffful) + 1);
- double u2 = kScale * ((b_ & 0x7ffffffful) + 1);
- a_ ^= b_;
- b_ += a_;
- return static_cast<int>(
- mean + standard_deviation * sqrt(-2 * log(u1)) * cos(2 * kPi * u2));
-}
-
-int Random::Exponential(float lambda) {
- float uniform = Rand();
- return static_cast<int>(-log(uniform) / lambda);
-}
-} // namespace test
-} // namespace webrtc
diff --git a/webrtc/test/random.h b/webrtc/test/random.h
deleted file mode 100644
index 5cc54f2129..0000000000
--- a/webrtc/test/random.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2015 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 WEBRTC_TEST_RANDOM_H_
-#define WEBRTC_TEST_RANDOM_H_
-
-#include "webrtc/typedefs.h"
-#include "webrtc/base/constructormagic.h"
-
-namespace webrtc {
-
-namespace test {
-
-class Random {
- public:
- explicit Random(uint32_t seed);
-
- // Return pseudo-random number in the interval [0.0, 1.0).
- float Rand();
-
- // Return pseudo-random number mapped to the interval [low, high].
- int Rand(int low, int high);
-
- // Normal Distribution.
- int Gaussian(int mean, int standard_deviation);
-
- // Exponential Distribution.
- int Exponential(float lambda);
-
- // TODO(solenberg): Random from histogram.
- // template<typename T> int Distribution(const std::vector<T> histogram) {
-
- private:
- uint32_t a_;
- uint32_t b_;
-
- RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Random);
-};
-} // namespace test
-} // namespace webrtc
-
-#endif // WEBRTC_TEST_RANDOM_H_
diff --git a/webrtc/test/rtp_file_reader.cc b/webrtc/test/rtp_file_reader.cc
index cb0e40705f..1413f00797 100644
--- a/webrtc/test/rtp_file_reader.cc
+++ b/webrtc/test/rtp_file_reader.cc
@@ -458,7 +458,7 @@ class PcapReader : public RtpFileReaderImpl {
rtp_parser.ParseRtcp(&marker.rtp_header);
packets_.push_back(marker);
} else {
- if (!rtp_parser.Parse(marker.rtp_header, NULL)) {
+ if (!rtp_parser.Parse(&marker.rtp_header, nullptr)) {
DEBUG_LOG("Not recognized as RTP/RTCP");
return kResultSkip;
}
diff --git a/webrtc/test/rtp_file_reader_unittest.cc b/webrtc/test/rtp_file_reader_unittest.cc
index 929813f999..15a456ccf6 100644
--- a/webrtc/test/rtp_file_reader_unittest.cc
+++ b/webrtc/test/rtp_file_reader_unittest.cc
@@ -85,7 +85,8 @@ class TestPcapFileReader : public ::testing::Test {
while (rtp_packet_source_->NextPacket(&packet)) {
RtpUtility::RtpHeaderParser rtp_header_parser(packet.data, packet.length);
webrtc::RTPHeader header;
- if (!rtp_header_parser.RTCP() && rtp_header_parser.Parse(header, NULL)) {
+ if (!rtp_header_parser.RTCP() &&
+ rtp_header_parser.Parse(&header, nullptr)) {
pps[header.ssrc]++;
}
}
diff --git a/webrtc/test/rtp_rtcp_observer.h b/webrtc/test/rtp_rtcp_observer.h
index 89b6dd06bd..5eb88d3f0d 100644
--- a/webrtc/test/rtp_rtcp_observer.h
+++ b/webrtc/test/rtp_rtcp_observer.h
@@ -7,8 +7,8 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_RTP_RTCP_OBSERVER_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_RTP_RTCP_OBSERVER_H_
+#ifndef WEBRTC_TEST_RTP_RTCP_OBSERVER_H_
+#define WEBRTC_TEST_RTP_RTCP_OBSERVER_H_
#include <map>
#include <vector>
@@ -16,7 +16,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/criticalsection.h"
-#include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
+#include "webrtc/base/event.h"
+#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
#include "webrtc/test/constants.h"
#include "webrtc/test/direct_transport.h"
#include "webrtc/typedefs.h"
@@ -36,10 +37,7 @@ class RtpRtcpObserver {
virtual ~RtpRtcpObserver() {}
- virtual EventTypeWrapper Wait() {
- EventTypeWrapper result = observation_complete_->Wait(timeout_ms_);
- return result;
- }
+ virtual bool Wait() { return observation_complete_.Wait(timeout_ms_); }
virtual Action OnSendRtp(const uint8_t* packet, size_t length) {
return SEND_PACKET;
@@ -58,8 +56,8 @@ class RtpRtcpObserver {
}
protected:
- explicit RtpRtcpObserver(unsigned int event_timeout_ms)
- : observation_complete_(EventWrapper::Create()),
+ explicit RtpRtcpObserver(int event_timeout_ms)
+ : observation_complete_(false, false),
parser_(RtpHeaderParser::Create()),
timeout_ms_(event_timeout_ms) {
parser_->RegisterRtpHeaderExtension(kRtpExtensionTransmissionTimeOffset,
@@ -70,11 +68,11 @@ class RtpRtcpObserver {
kTransportSequenceNumberExtensionId);
}
- const rtc::scoped_ptr<EventWrapper> observation_complete_;
+ rtc::Event observation_complete_;
const rtc::scoped_ptr<RtpHeaderParser> parser_;
private:
- unsigned int timeout_ms_;
+ const int timeout_ms_;
};
class PacketTransport : public test::DirectTransport {
@@ -138,4 +136,4 @@ class PacketTransport : public test::DirectTransport {
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_RTP_RTCP_OBSERVER_H_
+#endif // WEBRTC_TEST_RTP_RTCP_OBSERVER_H_
diff --git a/webrtc/test/run_loop.h b/webrtc/test/run_loop.h
index 31012525e2..238e2dc282 100644
--- a/webrtc/test/run_loop.h
+++ b/webrtc/test/run_loop.h
@@ -7,8 +7,8 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_RUN_LOOP_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_RUN_LOOP_H_
+#ifndef WEBRTC_TEST_RUN_LOOP_H_
+#define WEBRTC_TEST_RUN_LOOP_H_
namespace webrtc {
namespace test {
@@ -19,4 +19,4 @@ void PressEnterToContinue();
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_RUN_LOOP_H_
+#endif // WEBRTC_TEST_RUN_LOOP_H_
diff --git a/webrtc/test/statistics.h b/webrtc/test/statistics.h
index 0fc3a04ea9..d4a111e061 100644
--- a/webrtc/test/statistics.h
+++ b/webrtc/test/statistics.h
@@ -7,8 +7,8 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_STATISTICS_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_STATISTICS_H_
+#ifndef WEBRTC_TEST_STATISTICS_H_
+#define WEBRTC_TEST_STATISTICS_H_
#include "webrtc/typedefs.h"
@@ -33,4 +33,4 @@ class Statistics {
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_STATISTICS_H_
+#endif // WEBRTC_TEST_STATISTICS_H_
diff --git a/webrtc/test/test.gyp b/webrtc/test/test.gyp
index 0d251dffdd..5bb7793842 100644
--- a/webrtc/test/test.gyp
+++ b/webrtc/test/test.gyp
@@ -22,7 +22,7 @@
],
'sources': [
'channel_transport/channel_transport.cc',
- 'channel_transport/include/channel_transport.h',
+ 'channel_transport/channel_transport.h',
'channel_transport/traffic_control_win.cc',
'channel_transport/traffic_control_win.h',
'channel_transport/udp_socket_manager_posix.cc',
@@ -41,11 +41,29 @@
'channel_transport/udp_transport_impl.cc',
'channel_transport/udp_transport_impl.h',
],
+ 'conditions': [
+ ['OS=="win" and clang==1', {
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'AdditionalOptions': [
+ # Disable warnings failing when compiling with Clang on Windows.
+ # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
+ '-Wno-parentheses-equality',
+ '-Wno-reorder',
+ '-Wno-tautological-constant-out-of-range-compare',
+ '-Wno-unused-private-field',
+ ],
+ },
+ },
+ }],
+ ], # conditions.
},
{
- 'target_name': 'frame_generator',
+ 'target_name': 'fake_video_frames',
'type': 'static_library',
'sources': [
+ 'fake_texture_frame.cc',
+ 'fake_texture_frame.h',
'frame_generator.cc',
'frame_generator.h',
],
@@ -79,6 +97,7 @@
],
'dependencies': [
'<(webrtc_root)/common.gyp:webrtc_common',
+ '<(webrtc_root)/system_wrappers/system_wrappers.gyp:field_trial_default',
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
],
},
@@ -124,7 +143,6 @@
'testsupport/frame_reader.h',
'testsupport/frame_writer.cc',
'testsupport/frame_writer.h',
- 'testsupport/gtest_disable.h',
'testsupport/iosfileutils.mm',
'testsupport/mock/mock_frame_reader.h',
'testsupport/mock/mock_frame_writer.h',
diff --git a/webrtc/test/test_main.cc b/webrtc/test/test_main.cc
index 733831f5be..a435575f88 100644
--- a/webrtc/test/test_main.cc
+++ b/webrtc/test/test_main.cc
@@ -10,6 +10,7 @@
#include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "webrtc/base/logging.h"
#include "webrtc/test/field_trial.h"
#include "webrtc/test/testsupport/fileutils.h"
@@ -21,6 +22,11 @@ DEFINE_string(force_fieldtrials, "",
int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
+ // Default to LS_INFO, even for release builds to provide better test logging.
+ // TODO(pbos): Consider adding a command-line override.
+ if (rtc::LogMessage::GetLogToDebug() > rtc::LS_INFO)
+ rtc::LogMessage::LogToDebug(rtc::LS_INFO);
+
// AllowCommandLineParsing allows us to ignore flags passed on to us by
// Chromium build bots without having to explicitly disable them.
google::AllowCommandLineReparsing();
diff --git a/webrtc/test/testsupport/fileutils_unittest.cc b/webrtc/test/testsupport/fileutils_unittest.cc
index dff7f2249b..e205db3ecf 100644
--- a/webrtc/test/testsupport/fileutils_unittest.cc
+++ b/webrtc/test/testsupport/fileutils_unittest.cc
@@ -16,7 +16,6 @@
#include <string>
#include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/test/testsupport/gtest_disable.h"
#ifdef WIN32
#define chdir _chdir
@@ -66,7 +65,14 @@ TEST_F(FileUtilsTest, ProjectRootPath) {
}
// Similar to the above test, but for the output dir
-TEST_F(FileUtilsTest, DISABLED_ON_ANDROID(OutputPathFromUnchangedWorkingDir)) {
+#if defined(WEBRTC_ANDROID)
+#define MAYBE_OutputPathFromUnchangedWorkingDir \
+ DISABLED_OutputPathFromUnchangedWorkingDir
+#else
+#define MAYBE_OutputPathFromUnchangedWorkingDir \
+ OutputPathFromUnchangedWorkingDir
+#endif
+TEST_F(FileUtilsTest, MAYBE_OutputPathFromUnchangedWorkingDir) {
std::string path = webrtc::test::OutputPath();
std::string expected_end = "out";
expected_end = kPathDelimiter + expected_end + kPathDelimiter;
@@ -75,7 +81,12 @@ TEST_F(FileUtilsTest, DISABLED_ON_ANDROID(OutputPathFromUnchangedWorkingDir)) {
// Tests with current working directory set to a directory higher up in the
// directory tree than the project root dir.
-TEST_F(FileUtilsTest, DISABLED_ON_ANDROID(OutputPathFromRootWorkingDir)) {
+#if defined(WEBRTC_ANDROID)
+#define MAYBE_OutputPathFromRootWorkingDir DISABLED_OutputPathFromRootWorkingDir
+#else
+#define MAYBE_OutputPathFromRootWorkingDir OutputPathFromRootWorkingDir
+#endif
+TEST_F(FileUtilsTest, MAYBE_OutputPathFromRootWorkingDir) {
ASSERT_EQ(0, chdir(kPathDelimiter));
ASSERT_EQ("./", webrtc::test::OutputPath());
}
diff --git a/webrtc/test/testsupport/gtest_disable.h b/webrtc/test/testsupport/gtest_disable.h
deleted file mode 100644
index fdc56acc05..0000000000
--- a/webrtc/test/testsupport/gtest_disable.h
+++ /dev/null
@@ -1,57 +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 TEST_TESTSUPPORT_INCLUDE_GTEST_DISABLE_H_
-#define TEST_TESTSUPPORT_INCLUDE_GTEST_DISABLE_H_
-
-// Helper macros for platform disables. These can be chained. Example use:
-// TEST_F(ViEStandardIntegrationTest,
-// DISABLED_ON_LINUX(RunsBaseTestWithoutErrors)) { // ...
-//
-// Or, you can disable a whole test class by wrapping all mentions of the test
-// class name inside one of these macros.
-//
-// The platform #defines we are looking at here are set by the build system.
-#ifdef WEBRTC_LINUX
-#define DISABLED_ON_LINUX(test) DISABLED_##test
-#else
-#define DISABLED_ON_LINUX(test) test
-#endif
-
-#ifdef WEBRTC_MAC
-#define DISABLED_ON_MAC(test) DISABLED_##test
-#else
-#define DISABLED_ON_MAC(test) test
-#endif
-
-#ifdef _WIN32
-#define DISABLED_ON_WIN(test) DISABLED_##test
-#else
-#define DISABLED_ON_WIN(test) test
-#endif
-
-// Using some extra magic here to be able to chain Android and iOS macros.
-// http://stackoverflow.com/questions/8231966/why-do-i-need-double-layer-of-indirection-for-macros
-#ifdef WEBRTC_ANDROID
-#define DISABLED_ON_ANDROID_HIDDEN(test) DISABLED_##test
-#define DISABLED_ON_ANDROID(test) DISABLED_ON_ANDROID_HIDDEN(test)
-#else
-#define DISABLED_ON_ANDROID_HIDDEN(test) test
-#define DISABLED_ON_ANDROID(test) DISABLED_ON_ANDROID_HIDDEN(test)
-#endif
-
-#ifdef WEBRTC_IOS
-#define DISABLED_ON_IOS_HIDDEN(test) DISABLED_##test
-#define DISABLED_ON_IOS(test) DISABLED_ON_IOS_HIDDEN(test)
-#else
-#define DISABLED_ON_IOS_HIDDEN(test) test
-#define DISABLED_ON_IOS(test) DISABLED_ON_IOS_HIDDEN(test)
-#endif
-
-#endif // TEST_TESTSUPPORT_INCLUDE_GTEST_DISABLE_H_
diff --git a/webrtc/test/vcm_capturer.cc b/webrtc/test/vcm_capturer.cc
index 1c6b91915e..0a82236c98 100644
--- a/webrtc/test/vcm_capturer.cc
+++ b/webrtc/test/vcm_capturer.cc
@@ -10,7 +10,7 @@
#include "webrtc/test/vcm_capturer.h"
-#include "webrtc/modules/video_capture/include/video_capture_factory.h"
+#include "webrtc/modules/video_capture/video_capture_factory.h"
#include "webrtc/video_send_stream.h"
namespace webrtc {
diff --git a/webrtc/test/vcm_capturer.h b/webrtc/test/vcm_capturer.h
index 53d61fc53a..6c30dd50e0 100644
--- a/webrtc/test/vcm_capturer.h
+++ b/webrtc/test/vcm_capturer.h
@@ -7,13 +7,13 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_
+#ifndef WEBRTC_TEST_VCM_CAPTURER_H_
+#define WEBRTC_TEST_VCM_CAPTURER_H_
#include "webrtc/base/criticalsection.h"
#include "webrtc/common_types.h"
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
-#include "webrtc/modules/video_capture/include/video_capture.h"
+#include "webrtc/modules/video_capture/video_capture.h"
#include "webrtc/test/video_capturer.h"
namespace webrtc {
@@ -47,4 +47,4 @@ class VcmCapturer : public VideoCapturer, public VideoCaptureDataCallback {
} // test
} // webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_VCM_CAPTURER_H_
+#endif // WEBRTC_TEST_VCM_CAPTURER_H_
diff --git a/webrtc/test/video_capturer.h b/webrtc/test/video_capturer.h
index 3fe86f1998..169fd7151d 100644
--- a/webrtc/test/video_capturer.h
+++ b/webrtc/test/video_capturer.h
@@ -7,8 +7,8 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_VIDEO_CAPTURER_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_VIDEO_CAPTURER_H_
+#ifndef WEBRTC_TEST_VIDEO_CAPTURER_H_
+#define WEBRTC_TEST_VIDEO_CAPTURER_H_
#include <stddef.h>
@@ -39,4 +39,4 @@ class VideoCapturer {
} // test
} // webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_VIDEO_CAPTURER_H_
+#endif // WEBRTC_TEST_VIDEO_CAPTURER_H_
diff --git a/webrtc/test/video_renderer.h b/webrtc/test/video_renderer.h
index c8623270a7..3739522d7a 100644
--- a/webrtc/test/video_renderer.h
+++ b/webrtc/test/video_renderer.h
@@ -7,8 +7,8 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_VIDEO_RENDERER_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_VIDEO_RENDERER_H_
+#ifndef WEBRTC_TEST_VIDEO_RENDERER_H_
+#define WEBRTC_TEST_VIDEO_RENDERER_H_
#include <stddef.h>
@@ -36,4 +36,4 @@ class VideoRenderer : public webrtc::VideoRenderer {
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_VIDEO_RENDERER_H_
+#endif // WEBRTC_TEST_VIDEO_RENDERER_H_
diff --git a/webrtc/test/webrtc_test_common.gyp b/webrtc/test/webrtc_test_common.gyp
index d075cb470b..07ea2c9b74 100644
--- a/webrtc/test/webrtc_test_common.gyp
+++ b/webrtc/test/webrtc_test_common.gyp
@@ -32,17 +32,15 @@
'fake_encoder.h',
'fake_network_pipe.cc',
'fake_network_pipe.h',
- 'fake_voice_engine.cc',
- 'fake_voice_engine.h',
'frame_generator_capturer.cc',
'frame_generator_capturer.h',
'layer_filtering_transport.cc',
'layer_filtering_transport.h',
'mock_transport.h',
+ 'mock_voe_channel_proxy.h',
+ 'mock_voice_engine.h',
'null_transport.cc',
'null_transport.h',
- 'random.cc',
- 'random.h',
'rtp_rtcp_observer.h',
'run_loop.cc',
'run_loop.h',
@@ -62,13 +60,14 @@
}],
],
'dependencies': [
+ '<(DEPTH)/testing/gmock.gyp:gmock',
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
'<(webrtc_root)/base/base.gyp:rtc_base',
'<(webrtc_root)/common.gyp:webrtc_common',
'<(webrtc_root)/modules/modules.gyp:media_file',
'<(webrtc_root)/modules/modules.gyp:video_render',
- '<(webrtc_root)/test/test.gyp:frame_generator',
+ '<(webrtc_root)/test/test.gyp:fake_video_frames',
'<(webrtc_root)/test/test.gyp:test_support',
'<(webrtc_root)/test/test.gyp:rtp_test_utils',
'<(webrtc_root)/webrtc.gyp:webrtc',
@@ -116,11 +115,24 @@
'<(directx_sdk_path)/Include',
],
}],
+ ['OS=="win" and clang==1', {
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'AdditionalOptions': [
+ # Disable warnings failing when compiling with Clang on Windows.
+ # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
+ '-Wno-bool-conversion',
+ '-Wno-comment',
+ '-Wno-delete-non-virtual-dtor',
+ ],
+ },
+ },
+ }],
],
'dependencies': [
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(webrtc_root)/modules/modules.gyp:media_file',
- '<(webrtc_root)/test/test.gyp:frame_generator',
+ '<(webrtc_root)/test/test.gyp:fake_video_frames',
'<(webrtc_root)/test/test.gyp:test_support',
],
'direct_dependent_settings': {
diff --git a/webrtc/test/win/d3d_renderer.h b/webrtc/test/win/d3d_renderer.h
index 46ce266460..cf2319edc4 100644
--- a/webrtc/test/win/d3d_renderer.h
+++ b/webrtc/test/win/d3d_renderer.h
@@ -7,8 +7,8 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_WIN_D3D_RENDERER_H_
-#define WEBRTC_VIDEO_ENGINE_TEST_COMMON_WIN_D3D_RENDERER_H_
+#ifndef WEBRTC_TEST_WIN_D3D_RENDERER_H_
+#define WEBRTC_TEST_WIN_D3D_RENDERER_H_
#include <Windows.h>
#include <d3d9.h>
@@ -51,4 +51,4 @@ class D3dRenderer : public VideoRenderer {
} // namespace test
} // namespace webrtc
-#endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_WIN_D3D_RENDERER_H_
+#endif // WEBRTC_TEST_WIN_D3D_RENDERER_H_