Initial revision of a ViE fuzz test. The idea is to inject randomized RTP packets and see what the video engine does.
There are some small refactorings in here, but the real focus of this CL is in vie_autotest_rtp_fuzz.cc. This patch is mostly here to get a discussion going. On my initial test the video engine doesn't recover, at least within 10 seconds of running with untampered packets. Not sure if this is according to specification though. Ideas: - Generate random packets with correct RTP headers to get further into the code. - Don't generate fresh random data, but rather corrupt bits here and there in small amounts. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/383001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1714 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a52838b684
commit
8bfee84144
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* 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
|
||||
@ -149,32 +149,61 @@ enum SecurityLevels
|
||||
kEncryptionAndAuthentication = 3
|
||||
};
|
||||
|
||||
// Interface for encrypting and decrypting regular data and rtp/rtcp packets.
|
||||
// Implement this interface if you wish to provide an encryption scheme to
|
||||
// the voice or video engines.
|
||||
class Encryption
|
||||
{
|
||||
public:
|
||||
// Encrypt the given data.
|
||||
//
|
||||
// Args:
|
||||
// channel: The channel to encrypt data for.
|
||||
// in_data: The data to encrypt. This data is bytes_in bytes long.
|
||||
// out_data: The buffer to write the encrypted data to. You may write more
|
||||
// bytes of encrypted data than what you got as input, up to a maximum
|
||||
// of webrtc::kViEMaxMtu if you are encrypting in the video engine, or
|
||||
// webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine.
|
||||
// bytes_in: The number of bytes in the input buffer.
|
||||
// bytes_out: The number of bytes written in out_data.
|
||||
virtual void encrypt(
|
||||
int channel_no,
|
||||
int channel,
|
||||
unsigned char* in_data,
|
||||
unsigned char* out_data,
|
||||
int bytes_in,
|
||||
int* bytes_out) = 0;
|
||||
|
||||
// Decrypts the given data. This should reverse the effects of encrypt().
|
||||
//
|
||||
// Args:
|
||||
// channel_no: The channel to decrypt data for.
|
||||
// in_data: The data to decrypt. This data is bytes_in bytes long.
|
||||
// out_data: The buffer to write the decrypted data to. You may write more
|
||||
// bytes of decrypted data than what you got as input, up to a maximum
|
||||
// of webrtc::kViEMaxMtu if you are encrypting in the video engine, or
|
||||
// webrtc::kVoiceEngineMaxIpPacketSizeBytes for the voice engine.
|
||||
// bytes_in: The number of bytes in the input buffer.
|
||||
// bytes_out: The number of bytes written in out_data.
|
||||
virtual void decrypt(
|
||||
int channel_no,
|
||||
int channel,
|
||||
unsigned char* in_data,
|
||||
unsigned char* out_data,
|
||||
int bytes_in,
|
||||
int* bytes_out) = 0;
|
||||
|
||||
// Encrypts a RTCP packet. Otherwise, this method has the same contract as
|
||||
// encrypt().
|
||||
virtual void encrypt_rtcp(
|
||||
int channel_no,
|
||||
int channel,
|
||||
unsigned char* in_data,
|
||||
unsigned char* out_data,
|
||||
int bytes_in,
|
||||
int* bytes_out) = 0;
|
||||
|
||||
// Decrypts a RTCP packet. Otherwise, this method has the same contract as
|
||||
// decrypt().
|
||||
virtual void decrypt_rtcp(
|
||||
int channel_no,
|
||||
int channel,
|
||||
unsigned char* in_data,
|
||||
unsigned char* out_data,
|
||||
int bytes_in,
|
||||
@ -507,10 +536,9 @@ union VideoCodecUnion
|
||||
VideoCodecGeneric Generic;
|
||||
};
|
||||
|
||||
/*
|
||||
* Simulcast is when the same stream is encoded multiple times with different
|
||||
* settings such as resolution.
|
||||
*/
|
||||
|
||||
// Simulcast is when the same stream is encoded multiple times with different
|
||||
// settings such as resolution.
|
||||
struct SimulcastStream
|
||||
{
|
||||
unsigned short width;
|
||||
|
28
src/video_engine/test/auto_test/automated/legacy_fixture.cc
Normal file
28
src/video_engine/test/auto_test/automated/legacy_fixture.cc
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "video_engine/test/auto_test/automated/legacy_fixture.h"
|
||||
|
||||
#include "video_engine/test/auto_test/interface/vie_autotest.h"
|
||||
|
||||
void LegacyFixture::SetUpTestCase() {
|
||||
TwoWindowsFixture::SetUpTestCase();
|
||||
|
||||
// Create the test cases
|
||||
tests_ = new ViEAutoTest(window_1_, window_2_);
|
||||
}
|
||||
|
||||
void LegacyFixture::TearDownTestCase() {
|
||||
delete tests_;
|
||||
|
||||
TwoWindowsFixture::TearDownTestCase();
|
||||
}
|
||||
|
||||
ViEAutoTest* LegacyFixture::tests_ = NULL;
|
29
src/video_engine/test/auto_test/automated/legacy_fixture.h
Normal file
29
src/video_engine/test/auto_test/automated/legacy_fixture.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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 SRC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_
|
||||
#define SRC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_
|
||||
|
||||
#include "video_engine/test/auto_test/automated/two_windows_fixture.h"
|
||||
|
||||
// Inherited by old-style standard integration tests based on ViEAutoTest.
|
||||
class LegacyFixture : public TwoWindowsFixture {
|
||||
public:
|
||||
// Initializes ViEAutoTest in addition to the work done by ViEIntegrationTest.
|
||||
static void SetUpTestCase();
|
||||
|
||||
// Releases anything allocated by SetupTestCase.
|
||||
static void TearDownTestCase();
|
||||
|
||||
protected:
|
||||
static ViEAutoTest* tests_;
|
||||
};
|
||||
|
||||
#endif // SRC_VIDEO_ENGINE_TEST_AUTO_TEST_AUTOMATED_VIE_LEGACY_FIXTURE_H_
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "video_engine/test/auto_test/automated/two_windows_fixture.h"
|
||||
|
||||
#include "video_engine/test/auto_test/helpers/vie_window_creator.h"
|
||||
#include "video_engine/test/auto_test/interface/vie_autotest_window_manager_interface.h"
|
||||
|
||||
void TwoWindowsFixture::SetUpTestCase() {
|
||||
window_creator_ = new ViEWindowCreator();
|
||||
|
||||
ViEAutoTestWindowManagerInterface* window_manager =
|
||||
window_creator_->CreateTwoWindows();
|
||||
|
||||
window_1_ = window_manager->GetWindow1();
|
||||
window_2_ = window_manager->GetWindow2();
|
||||
}
|
||||
|
||||
void TwoWindowsFixture::TearDownTestCase() {
|
||||
window_creator_->TerminateWindows();
|
||||
delete window_creator_;
|
||||
}
|
||||
|
||||
ViEWindowCreator* TwoWindowsFixture::window_creator_ = NULL;
|
||||
void* TwoWindowsFixture::window_1_ = NULL;
|
||||
void* TwoWindowsFixture::window_2_ = NULL;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* 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
|
||||
@ -8,28 +8,28 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_VIE_INTEGRATION_TEST_BASE_H_
|
||||
#define SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_VIE_INTEGRATION_TEST_BASE_H_
|
||||
#ifndef SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_TWO_WINDOWS_FIXTURE_H_
|
||||
#define SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_TWO_WINDOWS_FIXTURE_H_
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
class ViEWindowCreator;
|
||||
class ViEAutoTest;
|
||||
|
||||
// Meant to be interited by standard integration tests based on
|
||||
// ViEAutoTest.
|
||||
class ViEIntegrationTest: public testing::Test {
|
||||
// Meant to be inherited by all standard test who require two windows.
|
||||
class TwoWindowsFixture : public testing::Test {
|
||||
public:
|
||||
// Intitializes a suitable webcam on the system and launches
|
||||
// two windows in a platform-dependent manner.
|
||||
// Launches two windows in a platform-dependent manner and stores the handles
|
||||
// in the window_1_ and window_2_ fields.
|
||||
static void SetUpTestCase();
|
||||
|
||||
// Releases anything allocated by SetupTestCase.
|
||||
static void TearDownTestCase();
|
||||
|
||||
protected:
|
||||
static void* window_1_;
|
||||
static void* window_2_;
|
||||
static ViEWindowCreator* window_creator_;
|
||||
static ViEAutoTest* tests_;
|
||||
};
|
||||
|
||||
#endif // SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_VIE_INTEGRATION_TEST_BASE_H_
|
||||
#endif // SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_AUTOMATED_TWO_WINDOWS_FIXTURE_H_
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* 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
|
||||
@ -13,12 +13,12 @@
|
||||
*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "vie_integration_test_base.h"
|
||||
#include "legacy_fixture.h"
|
||||
#include "vie_autotest.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class ViEApiIntegrationTest: public ViEIntegrationTest {
|
||||
class ViEApiIntegrationTest : public LegacyFixture {
|
||||
};
|
||||
|
||||
TEST_F(ViEApiIntegrationTest, RunsBaseTestWithoutErrors) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* 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
|
||||
@ -13,12 +13,12 @@
|
||||
*/
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "vie_integration_test_base.h"
|
||||
#include "legacy_fixture.h"
|
||||
#include "vie_autotest.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class ViEExtendedIntegrationTest: public ViEIntegrationTest {
|
||||
class ViEExtendedIntegrationTest : public LegacyFixture {
|
||||
};
|
||||
|
||||
TEST_F(ViEExtendedIntegrationTest, RunsBaseTestWithoutErrors) {
|
||||
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2011 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 "vie_integration_test_base.h"
|
||||
|
||||
#include "vie_autotest.h"
|
||||
#include "vie_autotest_window_manager_interface.h"
|
||||
#include "vie_window_creator.h"
|
||||
|
||||
void ViEIntegrationTest::SetUpTestCase() {
|
||||
window_creator_ = new ViEWindowCreator();
|
||||
|
||||
ViEAutoTestWindowManagerInterface* window_manager =
|
||||
window_creator_->CreateTwoWindows();
|
||||
|
||||
// Create the test cases
|
||||
tests_ = new ViEAutoTest(window_manager->GetWindow1(),
|
||||
window_manager->GetWindow2());
|
||||
}
|
||||
|
||||
void ViEIntegrationTest::TearDownTestCase() {
|
||||
window_creator_->TerminateWindows();
|
||||
|
||||
delete tests_;
|
||||
delete window_creator_;
|
||||
}
|
||||
|
||||
ViEWindowCreator* ViEIntegrationTest::window_creator_ = NULL;
|
||||
ViEAutoTest* ViEIntegrationTest::tests_ = NULL;
|
138
src/video_engine/test/auto_test/automated/vie_rtp_fuzz_test.cc
Normal file
138
src/video_engine/test/auto_test/automated/vie_rtp_fuzz_test.cc
Normal file
@ -0,0 +1,138 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "gflags/gflags.h"
|
||||
#include "video_engine/include/vie_encryption.h"
|
||||
#include "video_engine/test/auto_test/automated/two_windows_fixture.h"
|
||||
#include "video_engine/test/auto_test/helpers/vie_window_creator.h"
|
||||
#include "video_engine/test/auto_test/interface/tb_capture_device.h"
|
||||
#include "video_engine/test/auto_test/interface/tb_interfaces.h"
|
||||
#include "video_engine/test/auto_test/interface/tb_video_channel.h"
|
||||
#include "video_engine/test/auto_test/interface/vie_autotest_window_manager_interface.h"
|
||||
#include "video_engine/test/auto_test/primitives/general_primitives.h"
|
||||
#include "video_engine/vie_defines.h"
|
||||
|
||||
namespace {
|
||||
|
||||
DEFINE_int32(rtp_fuzz_test_rand_seed, 0, "The rand seed to use for "
|
||||
"the RTP fuzz test. Defaults to time(). 0 cannot be specified.");
|
||||
|
||||
class ViERtpFuzzTest : public TwoWindowsFixture {
|
||||
protected:
|
||||
unsigned int FetchRandSeed() {
|
||||
if (FLAGS_rtp_fuzz_test_rand_seed != 0) {
|
||||
return FLAGS_rtp_fuzz_test_rand_seed;
|
||||
}
|
||||
return std::time(NULL);
|
||||
}
|
||||
};
|
||||
|
||||
static int Saturate(int value, int min, int max) {
|
||||
return std::min(std::max(value, min), max);
|
||||
}
|
||||
|
||||
// These algorithms attempt to create an uncrackable encryption
|
||||
// scheme by completely disregarding the input data.
|
||||
class RandomEncryption : public webrtc::Encryption {
|
||||
public:
|
||||
RandomEncryption(unsigned int rand_seed) {
|
||||
srand(rand_seed);
|
||||
}
|
||||
|
||||
virtual void encrypt(int channel_no, unsigned char* in_data,
|
||||
unsigned char* out_data, int bytes_in, int* bytes_out) {
|
||||
GenerateRandomData(out_data, bytes_in, bytes_out);
|
||||
}
|
||||
|
||||
virtual void decrypt(int channel_no, unsigned char* in_data,
|
||||
unsigned char* out_data, int bytes_in, int* bytes_out) {
|
||||
GenerateRandomData(out_data, bytes_in, bytes_out);
|
||||
}
|
||||
|
||||
virtual void encrypt_rtcp(int channel_no, unsigned char* in_data,
|
||||
unsigned char* out_data, int bytes_in,
|
||||
int* bytes_out) {
|
||||
GenerateRandomData(out_data, bytes_in, bytes_out);
|
||||
}
|
||||
|
||||
virtual void decrypt_rtcp(int channel_no, unsigned char* in_data,
|
||||
unsigned char* out_data, int bytes_in,
|
||||
int* bytes_out) {
|
||||
GenerateRandomData(out_data, bytes_in, bytes_out);
|
||||
}
|
||||
|
||||
private:
|
||||
// Generates some completely random data with roughly the right length.
|
||||
void GenerateRandomData(unsigned char* out_data, int bytes_in,
|
||||
int* bytes_out) {
|
||||
int out_length = MakeUpSimilarLength(bytes_in);
|
||||
for (int i = 0; i < out_length; i++) {
|
||||
// The modulo will skew the random distribution a bit, but I think it
|
||||
// will be random enough.
|
||||
out_data[i] = static_cast<unsigned char>(rand() % 256);
|
||||
}
|
||||
*bytes_out = out_length;
|
||||
}
|
||||
|
||||
// Makes up a length within +- 50 of the original length, without
|
||||
// overstepping the contract for encrypt / decrypt.
|
||||
int MakeUpSimilarLength(int original_length) {
|
||||
int sign = rand() - RAND_MAX / 2;
|
||||
int length = original_length + sign * rand() % 50;
|
||||
|
||||
return Saturate(length, 0, static_cast<int>(webrtc::kViEMaxMtu));
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(ViERtpFuzzTest, VideoEngineRecoversAfterSomeCompletelyRandomPackets) {
|
||||
unsigned int rand_seed = FetchRandSeed();
|
||||
ViETest::Log("Running test with rand seed %d.", rand_seed);
|
||||
|
||||
TbInterfaces video_engine("ViERtpTryInjectingRandomPacketsIntoRtpStream");
|
||||
TbVideoChannel video_channel(video_engine, webrtc::kVideoCodecVP8);
|
||||
TbCaptureDevice capture_device(video_engine);
|
||||
|
||||
capture_device.ConnectTo(video_channel.videoChannel);
|
||||
|
||||
// Enable PLI RTCP, which will allow the video engine to recover better.
|
||||
video_engine.rtp_rtcp->SetKeyFrameRequestMethod(
|
||||
video_channel.videoChannel, webrtc::kViEKeyFrameRequestPliRtcp);
|
||||
|
||||
video_channel.StartReceive();
|
||||
video_channel.StartSend();
|
||||
|
||||
RenderInWindow(
|
||||
video_engine.render, capture_device.captureId, window_1_, 0);
|
||||
RenderInWindow(
|
||||
video_engine.render, video_channel.videoChannel, window_2_, 1);
|
||||
|
||||
ViETest::Log("Running as usual. You should see video output.");
|
||||
AutoTestSleep(2000);
|
||||
|
||||
ViETest::Log("Injecting completely random packets...");
|
||||
RandomEncryption random_encryption(rand_seed);
|
||||
video_engine.encryption->RegisterExternalEncryption(
|
||||
video_channel.videoChannel, random_encryption);
|
||||
|
||||
AutoTestSleep(5000);
|
||||
|
||||
ViETest::Log("Back to normal.");
|
||||
video_engine.encryption->DeregisterExternalEncryption(
|
||||
video_channel.videoChannel);
|
||||
|
||||
AutoTestSleep(5000);
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* 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
|
||||
@ -19,17 +19,17 @@
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "legacy_fixture.h"
|
||||
#include "testsupport/metrics/video_metrics.h"
|
||||
#include "vie_autotest.h"
|
||||
#include "vie_autotest_window_manager_interface.h"
|
||||
#include "vie_integration_test_base.h"
|
||||
#include "vie_to_file_renderer.h"
|
||||
#include "vie_window_creator.h"
|
||||
#include "testsupport/metrics/video_metrics.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class ViEStandardIntegrationTest: public ViEIntegrationTest {
|
||||
class ViEStandardIntegrationTest : public LegacyFixture {
|
||||
};
|
||||
|
||||
TEST_F(ViEStandardIntegrationTest, RunsBaseTestWithoutErrors) {
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "testsupport/metrics/video_metrics.h"
|
||||
#include "video_engine/test/auto_test/automated/vie_integration_test_base.h"
|
||||
#include "video_engine/test/auto_test/helpers/vie_to_file_renderer.h"
|
||||
#include "video_engine/test/auto_test/interface/vie_autotest.h"
|
||||
#include "video_engine/test/auto_test/interface/vie_file_based_comparison_tests.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* 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
|
||||
@ -39,7 +39,9 @@
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
class TbCaptureDevice;
|
||||
class TbInterfaces;
|
||||
class TbVideoChannel;
|
||||
class ViEToFileRenderer;
|
||||
|
||||
// This class provides a bunch of methods, implemented across several .cc
|
||||
@ -58,7 +60,8 @@ public:
|
||||
int ViESimulcastCall();
|
||||
int ViECustomCall();
|
||||
|
||||
// All following functions are meant to run in a googletest harness.
|
||||
// All functions except the three above are meant to run in a
|
||||
// googletest harness.
|
||||
void ViEStandardTest();
|
||||
void ViEExtendedTest();
|
||||
void ViEAPITest();
|
||||
@ -110,10 +113,19 @@ public:
|
||||
void ViERtpRtcpExtendedTest();
|
||||
void ViERtpRtcpAPITest();
|
||||
|
||||
// vie_autotest_rtp_fuzz.cc
|
||||
void ViERtpTryInjectingRandomPacketsIntoRtpStream(long rand_seed);
|
||||
|
||||
private:
|
||||
void PrintAudioCodec(const webrtc::CodecInst audioCodec);
|
||||
void PrintVideoCodec(const webrtc::VideoCodec videoCodec);
|
||||
|
||||
// Sets up rendering so the capture device output goes to window 1 and
|
||||
// the video engine output goes to window 2.
|
||||
void RenderCaptureDeviceAndOutputStream(TbInterfaces* video_engine,
|
||||
TbVideoChannel* video_channel,
|
||||
TbCaptureDevice* capture_device);
|
||||
|
||||
void* _window1;
|
||||
void* _window2;
|
||||
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "engine_configurations.h"
|
||||
#include "general_primitives.h"
|
||||
#include "tb_interfaces.h"
|
||||
#include "tb_video_channel.h"
|
||||
#include "tb_capture_device.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "video_render.h"
|
||||
#include "vie_autotest_defines.h"
|
||||
@ -143,3 +147,13 @@ void ViEAutoTest::PrintAudioCodec(const webrtc::CodecInst audioCodec)
|
||||
ViETest::Log("\t: %u", audioCodec.rate);
|
||||
ViETest::Log("");
|
||||
}
|
||||
|
||||
void ViEAutoTest::RenderCaptureDeviceAndOutputStream(
|
||||
TbInterfaces* video_engine,
|
||||
TbVideoChannel* video_channel,
|
||||
TbCaptureDevice* capture_device) {
|
||||
RenderInWindow(
|
||||
video_engine->render, capture_device->captureId, _window1, 0);
|
||||
RenderInWindow(
|
||||
video_engine->render, video_channel->videoChannel, _window1, 1);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* 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
|
||||
@ -93,12 +93,7 @@ void ViEAutoTest::ViEEncryptionStandardTest()
|
||||
|
||||
tbChannel.StartSend();
|
||||
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(
|
||||
tbCapture.captureId, _window1, 0, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(tbCapture.captureId));
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(
|
||||
tbChannel.videoChannel, _window2, 1, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(tbChannel.videoChannel));
|
||||
RenderCaptureDeviceAndOutputStream(&ViE, &tbChannel, &tbCapture);
|
||||
|
||||
#ifdef WEBRTC_SRTP
|
||||
//***************************************************************
|
||||
@ -190,12 +185,7 @@ void ViEAutoTest::ViEEncryptionExtendedTest()
|
||||
tbChannel.StartReceive();
|
||||
tbChannel.StartSend();
|
||||
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(
|
||||
tbCapture.captureId, _window1, 0, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(tbCapture.captureId));
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(
|
||||
tbChannel.videoChannel, _window2, 1, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(tbChannel.videoChannel));
|
||||
RenderCaptureDeviceAndOutputStream(&ViE, &tbChannel, &tbCapture);
|
||||
|
||||
//***************************************************************
|
||||
// Engine ready. Begin testing class
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* 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
|
||||
@ -57,12 +57,7 @@ void ViEAutoTest::ViEImageProcessStandardTest()
|
||||
|
||||
MyEffectFilter effectFilter;
|
||||
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(
|
||||
tbCapture.captureId, _window1, 0, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(tbCapture.captureId));
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(
|
||||
tbChannel.videoChannel, _window2, 1, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(tbChannel.videoChannel));
|
||||
RenderCaptureDeviceAndOutputStream(&ViE, &tbChannel, &tbCapture);
|
||||
|
||||
ViETest::Log("Capture device is renderered in Window 1");
|
||||
ViETest::Log("Remote stream is renderered in Window 2");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* 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
|
||||
@ -49,18 +49,12 @@ void ViEAutoTest::ViENetworkStandardTest()
|
||||
{
|
||||
TbInterfaces ViE("ViENetworkStandardTest"); // Create VIE
|
||||
TbCaptureDevice tbCapture(ViE);
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(
|
||||
tbCapture.captureId, _window1, 0, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(tbCapture.captureId));
|
||||
|
||||
{
|
||||
// Create a video channel
|
||||
TbVideoChannel tbChannel(ViE, webrtc::kVideoCodecVP8);
|
||||
tbCapture.ConnectTo(tbChannel.videoChannel);
|
||||
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(
|
||||
tbChannel.videoChannel, _window2, 1, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(tbChannel.videoChannel));
|
||||
RenderCaptureDeviceAndOutputStream(&ViE, &tbChannel, &tbCapture);
|
||||
|
||||
// ***************************************************************
|
||||
// Engine ready. Begin testing class
|
||||
|
@ -59,10 +59,12 @@
|
||||
'helpers/vie_window_creator.h',
|
||||
|
||||
# New, fully automated tests
|
||||
'automated/legacy_fixture.cc',
|
||||
'automated/two_windows_fixture.cc',
|
||||
'automated/vie_api_integration_test.cc',
|
||||
'automated/vie_extended_integration_test.cc',
|
||||
'automated/vie_integration_test_base.cc',
|
||||
'automated/vie_integration_test_base.h',
|
||||
'automated/vie_rtp_fuzz_test.cc',
|
||||
'automated/vie_standard_integration_test.cc',
|
||||
'automated/vie_video_verification_test.cc',
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user