Note: this patch may seem intimidating but it mostly moves code around and renames things. There are quite few actual changes.

Separated new-style tests from old-style tests. Abstracted code for reuse.

Fully separated the new automated tests from the old-style tests. We now have old-style tests running in manual mode, old-style tests running in automated mode and new-style tests that uses input files and make actual video comparisons.

Introduced a small "library" of helper functions in order to move a lot
of stuff out of the original base and codec tests, which have been made
dependent on the new "library" (which is a header file and a source
file). The new-style tests also depends on this "library".
The comparison test flags are now required only when the comparison tests actually runs.

Separated comparison tests into its own test since it seems we will be running classic vie_auto_test using a fake video driver on Linux.

Made tbInterfaces follow Google conventions.
Merge branch 'render_to_file' into vivi_driver

Resolution alignment testing is now optional behind a flag.

BUG=
TEST=

Review URL: http://webrtc-codereview.appspot.com/269011

git-svn-id: http://webrtc.googlecode.com/svn/trunk@962 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
phoglund@webrtc.org 2011-11-17 10:46:59 +00:00
parent c05b56a38b
commit 8f89f09626
39 changed files with 2261 additions and 2136 deletions

7
.gitignore vendored
View File

@ -51,3 +51,10 @@
/tools/win
/x86-generic_out/
/xcodebuild
ViE*.txt
DumpFileName.rtp
IncomingRTPDump.rtp
OutgoingRTPDump.rtp
WebRTCViECapture_Standard
*.yuv

View File

@ -0,0 +1,142 @@
/*
* 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 <cstdio>
#include "gflags/gflags.h"
#include "gtest/gtest.h"
#include "vie_autotest.h"
#include "vie_autotest_window_manager_interface.h"
#include "vie_comparison_tests.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 {
// These flags are checked upon running the test.
DEFINE_string(i420_test_video_path, "", "Path to an i420-coded raw video file"
" to use for the test. This file is fed into the fake camera"
" and will therefore be what the camera 'sees'.");
DEFINE_int32(i420_test_video_width, 0, "The width of the provided video.");
DEFINE_int32(i420_test_video_height, 0, "The height of the provided video.");
class ViEComparisonTest: public testing::Test {
public:
void SetUp() {
std::string test_case_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
std::string local_preview_filename = test_case_name + "-local-preview.yuv";
std::string remote_filename = test_case_name + "-remote.yuv";
if (!local_file_renderer_.PrepareForRendering(local_preview_filename)) {
FAIL() << "Could not open output file " << local_preview_filename <<
" for writing.";
}
if (!remote_file_renderer_.PrepareForRendering(remote_filename)) {
FAIL() << "Could not open output file " << remote_filename <<
" for writing.";
}
}
void TearDown() {
local_file_renderer_.StopRendering();
remote_file_renderer_.StopRendering();
bool test_failed = ::testing::UnitTest::GetInstance()->
current_test_info()->result()->Failed();
if (test_failed) {
// Leave the files for analysis if the test failed
local_file_renderer_.SaveOutputFile("failed-");
remote_file_renderer_.SaveOutputFile("failed-");
} else {
// No reason to keep the files if we succeeded
local_file_renderer_.DeleteOutputFile();
remote_file_renderer_.DeleteOutputFile();
}
}
protected:
ViEToFileRenderer local_file_renderer_;
ViEToFileRenderer remote_file_renderer_;
ViEComparisonTests tests_;
};
TEST_F(ViEComparisonTest, RunsBaseStandardTestWithoutErrors) {
tests_.TestCallSetup(FLAGS_i420_test_video_path,
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&local_file_renderer_,
&remote_file_renderer_);
QualityMetricsResult psnr_result;
int psnr_error = PsnrFromFiles(
FLAGS_i420_test_video_path.c_str(),
remote_file_renderer_.output_filename().c_str(),
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&psnr_result);
ASSERT_EQ(0, psnr_error) << "The PSNR routine failed - output files missing?";
ASSERT_GT(psnr_result.average, 25); // That is, we want at least 25 dB
QualityMetricsResult ssim_result;
int ssim_error = SsimFromFiles(
FLAGS_i420_test_video_path.c_str(),
remote_file_renderer_.output_filename().c_str(),
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&ssim_result);
ASSERT_EQ(0, ssim_error) << "The SSIM routine failed - output files missing?";
ASSERT_GT(ssim_result.average, 0.85f); // 1 = perfect, -1 = terrible
}
TEST_F(ViEComparisonTest, RunsCodecTestWithoutErrors) {
tests_.TestCodecs(FLAGS_i420_test_video_path,
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&local_file_renderer_,
&remote_file_renderer_);
// We compare the local and remote here instead of with the original.
// The reason is that it is hard to say when the three consecutive tests
// switch over into each other, at which point we would have to restart the
// original to get a fair comparison.
QualityMetricsResult psnr_result;
int psnr_error = PsnrFromFiles(
local_file_renderer_.output_filename().c_str(),
remote_file_renderer_.output_filename().c_str(),
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&psnr_result);
ASSERT_EQ(0, psnr_error) << "The PSNR routine failed - output files missing?";
// This test includes VP8 which is a bit lossy. According to Wikipedia between
// 20-25 is considered OK for transmission codecs and we seem to be getting
// like 21 so 20 seems like a good threshold value here.
EXPECT_GT(psnr_result.average, 20);
QualityMetricsResult ssim_result;
int ssim_error = SsimFromFiles(
local_file_renderer_.output_filename().c_str(),
remote_file_renderer_.output_filename().c_str(),
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&ssim_result);
ASSERT_EQ(0, ssim_error) << "The SSIM routine failed - output files missing?";
EXPECT_GT(ssim_result.average, 0.8f); // 1 = perfect, -1 = terrible
}
} // namespace

View File

@ -25,145 +25,21 @@
#include "vie_integration_test_base.h"
#include "vie_to_file_renderer.h"
#include "vie_window_creator.h"
#include "testsupport/metrics/video_metrics.h"
namespace {
// We limit the input video size in order to not use to much bandwidth for
// I420 transfer.
const int MAX_INPUT_VIDEO_WIDTH = 200;
// Define flag validators for our flags:
static bool ValidatePath(const char* flag_name, const std::string& value) {
return !value.empty();
}
static bool ValidateDimension(const char* flag_name, WebRtc_Word32 value) {
if (value <= 0 || value > MAX_INPUT_VIDEO_WIDTH) {
return false;
}
return true;
}
// Define the flags themselves:
DEFINE_string(i420_test_video_path, "", "Path to an i420-coded raw video file"
" to use for the test. This file is fed into the fake camera"
" and will therefore be what the camera 'sees'.");
static const bool dummy1 =
google::RegisterFlagValidator(&FLAGS_i420_test_video_path,
&ValidatePath);
DEFINE_int32(i420_test_video_width, 0, "The width of the provided video."
" This cannot be larger than 200 due to bandwidth concerns");
static const bool dummy2 =
google::RegisterFlagValidator(&FLAGS_i420_test_video_width,
&ValidateDimension);
DEFINE_int32(i420_test_video_height, 0, "The height of the provided video."
" This cannot be larger than 200 due to bandwidth concerns");
static const bool dummy3 =
google::RegisterFlagValidator(&FLAGS_i420_test_video_height,
&ValidateDimension);
class ViEStandardIntegrationTest: public ViEIntegrationTest {
public:
void SetUp() {
std::string test_case_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
std::string local_preview_filename = test_case_name + "-local-preview.yuv";
std::string remote_filename = test_case_name + "-remote.yuv";
if (!local_file_renderer_.PrepareForRendering(local_preview_filename)) {
FAIL() << "Could not open output file " << local_preview_filename <<
" for writing.";
}
if (!remote_file_renderer_.PrepareForRendering(remote_filename)) {
FAIL() << "Could not open output file " << remote_filename <<
" for writing.";
}
}
void TearDown() {
local_file_renderer_.StopRendering();
remote_file_renderer_.StopRendering();
bool test_failed = ::testing::UnitTest::GetInstance()->
current_test_info()->result()->Failed();
if (test_failed) {
// Leave the files for analysis if the test failed
local_file_renderer_.SaveOutputFile("failed-");
remote_file_renderer_.SaveOutputFile("failed-");
} else {
// No reason to keep the files if we succeeded
local_file_renderer_.DeleteOutputFile();
remote_file_renderer_.DeleteOutputFile();
}
}
protected:
ViEToFileRenderer local_file_renderer_;
ViEToFileRenderer remote_file_renderer_;
};
TEST_F(ViEStandardIntegrationTest, RunsBaseStandardTestWithoutErrors) {
tests_->ViEAutomatedBaseStandardTest(FLAGS_i420_test_video_path,
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&local_file_renderer_,
&remote_file_renderer_);
QualityMetricsResult psnr_result;
int psnr_error = PsnrFromFiles(FLAGS_i420_test_video_path.c_str(),
remote_file_renderer_.output_filename().c_str(),
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&psnr_result);
ASSERT_EQ(0, psnr_error) << "The PSNR routine failed - output files missing?";
ASSERT_GT(psnr_result.average, 25); // That is, we want at least 25 dB
QualityMetricsResult ssim_result;
int ssim_error = SsimFromFiles(FLAGS_i420_test_video_path.c_str(),
remote_file_renderer_.output_filename().c_str(),
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&ssim_result);
ASSERT_EQ(0, ssim_error) << "The SSIM routine failed - output files missing?";
ASSERT_GT(ssim_result.average, 0.85f); // 1 = perfect, -1 = terrible
TEST_F(ViEStandardIntegrationTest, RunsBaseTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViEBaseStandardTest());
}
TEST_F(ViEStandardIntegrationTest, RunsCodecTestWithoutErrors) {
tests_->ViEAutomatedCodecStandardTest(FLAGS_i420_test_video_path,
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&local_file_renderer_,
&remote_file_renderer_);
// We compare the left and right here instead of with the original. The reason
// is that it is hard to say when the three consecutive tests switch over into
// each other, at which point we would have to restart the original to get a
// fair comparison.
QualityMetricsResult psnr_result;
int psnr_error = PsnrFromFiles(local_file_renderer_.output_filename().c_str(),
remote_file_renderer_.output_filename().c_str(),
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&psnr_result);
ASSERT_EQ(0, psnr_error) << "The PSNR routine failed - output files missing?";
// This test includes VP8 which is a bit lossy. According to Wikipedia between
// 20-25 is considered OK for transmission codecs and we seem to be getting
// like 21 so 20 seems like a good threshold value here.
EXPECT_GT(psnr_result.average, 20);
QualityMetricsResult ssim_result;
int ssim_error = SsimFromFiles(local_file_renderer_.output_filename().c_str(),
remote_file_renderer_.output_filename().c_str(),
FLAGS_i420_test_video_width,
FLAGS_i420_test_video_height,
&ssim_result);
ASSERT_EQ(0, ssim_error) << "The SSIM routine failed - output files missing?";
EXPECT_GT(ssim_result.average, 0.8f); // 1 = perfect, -1 = terrible
ASSERT_EQ(0, tests_->ViECodecStandardTest());
}
// These tests still require a physical camera:
TEST_F(ViEStandardIntegrationTest, RunsCaptureTestWithoutErrors) {
ASSERT_EQ(0, tests_->ViECaptureStandardTest());
}

View File

@ -21,13 +21,11 @@
#include "video_codec_interface.h"
class tbI420Encoder: public webrtc::VideoEncoder
class TbI420Encoder: public webrtc::VideoEncoder
{
public:
tbI420Encoder();
virtual ~tbI420Encoder();
TbI420Encoder();
virtual ~TbI420Encoder();
static WebRtc_Word32 VersionStatic(WebRtc_Word8* version,
WebRtc_Word32 length);
@ -88,13 +86,11 @@ private:
/* tbI420Decoder class */
/***************************/
class tbI420Decoder: public webrtc::VideoDecoder
class TbI420Decoder: public webrtc::VideoDecoder
{
public:
tbI420Decoder();
virtual ~tbI420Decoder();
TbI420Decoder();
virtual ~TbI420Decoder();
virtual WebRtc_Word32 InitDecode(const webrtc::VideoCodec* inst,
WebRtc_Word32 numberOfCores);

View File

@ -14,18 +14,18 @@
#include "tb_interfaces.h"
#include "video_capture_factory.h"
class tbCaptureDevice
class TbCaptureDevice
{
public:
tbCaptureDevice(tbInterfaces& Engine, int& nrOfErrors);
~tbCaptureDevice(void);
TbCaptureDevice(TbInterfaces& Engine, int& nrOfErrors);
~TbCaptureDevice(void);
int captureId;
void ConnectTo(int videoChannel);
void Disconnect(int videoChannel);
private:
int& numberOfErrors;
tbInterfaces& ViE;
TbInterfaces& ViE;
webrtc::VideoCaptureModule* vcpm_;
};

View File

@ -26,11 +26,11 @@ class ThreadWrapper;
class ViENetwork;
}
class tbExternalTransport: public webrtc::Transport
class TbExternalTransport: public webrtc::Transport
{
public:
tbExternalTransport(webrtc::ViENetwork& vieNetwork);
~tbExternalTransport(void);
TbExternalTransport(webrtc::ViENetwork& vieNetwork);
~TbExternalTransport(void);
virtual int SendPacket(int channel, const void *data, int len);
virtual int SendRTCPPacket(int channel, const void *data, int len);

View File

@ -24,25 +24,28 @@
#include "vie_encryption.h"
#include "vie_defines.h"
class tbInterfaces
// This class deals with all the tedium of setting up video engine interfaces.
// It does its work in constructor and destructor, so keeping it in scope is
// enough.
class TbInterfaces
{
public:
tbInterfaces(const char* testName, int& nrOfErrors);
TbInterfaces(const char* test_name, int& number_of_errors);
~TbInterfaces(void);
~tbInterfaces(void);
webrtc::VideoEngine* ptrViE;
webrtc::ViEBase* ptrViEBase;
webrtc::ViECapture* ptrViECapture;
webrtc::ViERender* ptrViERender;
webrtc::ViERTP_RTCP* ptrViERtpRtcp;
webrtc::ViECodec* ptrViECodec;
webrtc::ViENetwork* ptrViENetwork;
webrtc::ViEImageProcess* ptrViEImageProcess;
webrtc::ViEEncryption* ptrViEEncryption;
webrtc::VideoEngine* video_engine;
webrtc::ViEBase* base;
webrtc::ViECapture* capture;
webrtc::ViERender* render;
webrtc::ViERTP_RTCP* rtp_rtcp;
webrtc::ViECodec* codec;
webrtc::ViENetwork* network;
webrtc::ViEImageProcess* image_process;
webrtc::ViEEncryption* encryption;
int LastError()
{
return ptrViEBase->LastError();
return base->LastError();
}
private:

View File

@ -15,7 +15,7 @@
class tbVideoChannel
{
public:
tbVideoChannel(tbInterfaces& Engine, int& nrOfErrors,
tbVideoChannel(TbInterfaces& Engine, int& nrOfErrors,
webrtc::VideoCodecType sendCodec = webrtc::kVideoCodecVP8,
int width = 352, int height = 288, int frameRate = 30,
int startBitrate = 300);
@ -36,7 +36,7 @@ public:
int videoChannel;
private:
int& numberOfErrors;
tbInterfaces& ViE;
TbInterfaces& ViE;
};
#endif // WEBRTC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_TB_VIDEO_CHANNEL_H_

View File

@ -39,7 +39,7 @@
#include <string>
#endif
class tbInterfaces;
class TbInterfaces;
class ViEToFileRenderer;
class ViEAutoTest
@ -63,16 +63,6 @@ public:
int ViEBaseExtendedTest();
int ViEBaseAPITest();
// This is a variant of the base standard test, meant to run in GTest.
// The first three arguments describes the file to use as fake camera
// input. The file renderer arguments describe where to put the output
// from the left and right windows, respectively.
void ViEAutomatedBaseStandardTest(const std::string& i420_test_video_path,
int width,
int height,
ViEToFileRenderer* local_file_renderer,
ViEToFileRenderer* remote_file_renderer);
// vie_autotest_capture.cc
int ViECaptureStandardTest();
int ViECaptureExtendedTest();
@ -85,12 +75,6 @@ public:
int ViECodecExternalCodecTest();
int ViECodecAPITest();
void ViEAutomatedCodecStandardTest(const std::string& pathToTestI420Video,
int width,
int height,
ViEToFileRenderer* local_file_renderer,
ViEToFileRenderer* remote_file_renderer);
// vie_autotest_encryption.cc
int ViEEncryptionStandardTest();
int ViEEncryptionExtendedTest();
@ -122,37 +106,9 @@ public:
int ViERtpRtcpAPITest();
private:
// Finds a suitable capture device (e.g. camera) on the current system.
// Details about the found device are filled into the out parameters.
// If this operation fails, device_id is assigned a negative value
// and number_of_errors is incremented.
void FindCaptureDeviceOnSystem(webrtc::ViECapture* capture,
unsigned char* device_name,
const unsigned int kDeviceNameLength,
int* device_id,
int* number_of_errors,
webrtc::VideoCaptureModule** device_video);
void RenderInWindow(webrtc::ViERender* video_render_interface,
int* numberOfErrors,
int frame_provider_id,
void* os_window,
float z_index);
void RenderToFile(webrtc::ViERender* renderer_interface,
int render_id,
ViEToFileRenderer *to_file_renderer);
void PrintAudioCodec(const webrtc::CodecInst audioCodec);
void PrintVideoCodec(const webrtc::VideoCodec videoCodec);
void RunCodecTestInternal(const tbInterfaces& interfaces,
int & numberOfErrors,
int captureId,
int forced_codec_width,
int forced_codec_height,
ViEToFileRenderer* left_file_renderer,
ViEToFileRenderer* right_file_renderer);
void* _window1;
void* _window2;

View File

@ -0,0 +1,55 @@
/*
* 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.
*/
#ifndef SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_VIE_COMPARISON_TESTS_H_
#define SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_VIE_COMPARISON_TESTS_H_
#include <string>
class ViEToFileRenderer;
// This class contains comparison tests, which will exercise video engine
// functionality and then run comparison tests on the result using PSNR and
// SSIM algorithms. These tests are intended mostly as sanity checks so that
// we know we are outputting roughly the right thing and not random noise or
// black screens.
//
// We will set up a fake ExternalCapture device which will pose as a webcam
// and read the input from the provided raw YUV file. Output will be written
// as a local preview in the local file renderer; the remote side output gets
// written to the provided remote file renderer.
//
// The local preview is a straight, unaltered copy of the input. This can be
// useful for comparisons if the test method contains several stages where the
// input is restarted between stages.
class ViEComparisonTests {
public:
ViEComparisonTests();
~ViEComparisonTests();
// Test a typical simple call setup.
void TestCallSetup(
const std::string& i420_test_video_path,
int width,
int height,
ViEToFileRenderer* local_file_renderer,
ViEToFileRenderer* remote_file_renderer);
// Tries testing the I420 and VP8 codecs in turn.
void TestCodecs(
const std::string& i420_video_file,
int width,
int height,
ViEToFileRenderer* local_file_renderer,
ViEToFileRenderer* remote_file_renderer);
};
#endif // SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_INTERFACE_VIE_COMPARISON_TESTS_H_

View File

@ -0,0 +1,95 @@
/*
* 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 "base_primitives.h"
#include "vie_autotest.h"
#include "vie_autotest_defines.h"
#include "video_capture_factory.h"
void TestI420CallSetup(webrtc::ViECodec* codec_interface,
webrtc::VideoEngine* video_engine,
webrtc::ViEBase* base_interface,
webrtc::ViENetwork* network_interface,
int* number_of_errors,
int video_channel,
const unsigned char *device_name) {
int error;
webrtc::VideoCodec video_codec;
memset(&video_codec, 0, sizeof(webrtc::VideoCodec));
// Set up the codec interface with all known receive codecs and with
// I420 as the send codec.
for (int i = 0; i < codec_interface->NumberOfCodecs(); i++) {
error = codec_interface->GetCodec(i, video_codec);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Try to keep the test frame size small when I420.
if (video_codec.codecType == webrtc::kVideoCodecI420) {
video_codec.width = 176;
video_codec.height = 144;
error = codec_interface->SetSendCodec(video_channel, video_codec);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
error = codec_interface->SetReceiveCodec(video_channel, video_codec);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
// Verify that we really found the I420 codec.
error = codec_interface->GetSendCodec(video_channel, video_codec);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
*number_of_errors += ViETest::TestError(
video_codec.codecType == webrtc::kVideoCodecI420,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
// Set up senders and receivers.
char version[1024] = "";
error = base_interface->GetVersion(version);
ViETest::Log("\nUsing WebRTC Video Engine version: %s", version);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
const char *ipAddress = "127.0.0.1";
WebRtc_UWord16 rtpPortListen = 6100;
WebRtc_UWord16 rtpPortSend = 6100;
error = network_interface->SetLocalReceiver(video_channel, rtpPortListen);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->StartReceive(video_channel);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = network_interface->SetSendDestination(video_channel, ipAddress,
rtpPortSend);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->StartSend(video_channel);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Call started.
ViETest::Log("Call started");
ViETest::Log("You should see a local preview from camera %s"
" in window 1 and the remote video in window 2.", device_name);
AutoTestSleep(KAutoTestSleepTimeMs);
// Done.
error = base_interface->StopSend(video_channel);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}

View File

@ -0,0 +1,33 @@
/*
* 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.
*/
#ifndef SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_SOURCE_BASE_PRIMITIVES_H_
#define SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_SOURCE_BASE_PRIMITIVES_H_
namespace webrtc {
class VideoEngine;
class ViEBase;
class ViECodec;
class ViENetwork;
}
// Tests a I420-to-I420 call. This test exercises the most basic WebRTC
// functionality by training the codec interface to recognize the most common
// codecs, and the initiating a I420 call. A video channel with a capture device
// must be set up prior to this call.
void TestI420CallSetup(webrtc::ViECodec* codec_interface,
webrtc::VideoEngine* video_engine,
webrtc::ViEBase* base_interface,
webrtc::ViENetwork* network_interface,
int* number_of_errors,
int video_channel,
const unsigned char *device_name);
#endif // SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_SOURCE_BASE_PRIMITIVES_H_

View File

@ -0,0 +1,280 @@
/*
* 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 "codec_primitives.h"
#include "general_primitives.h"
#include "vie_autotest.h"
#include "vie_autotest_defines.h"
#include "vie_to_file_renderer.h"
#include "video_capture_factory.h"
#include "tb_interfaces.h"
// Helper functions
void SetSuitableResolution(webrtc::VideoCodec* video_codec,
int forced_codec_width,
int forced_codec_height) {
if (forced_codec_width != kDoNotForceResolution &&
forced_codec_height != kDoNotForceResolution) {
video_codec->width = forced_codec_width;
video_codec->height = forced_codec_height;
} else if (video_codec->codecType == webrtc::kVideoCodecI420) {
// I420 is very bandwidth heavy, so limit it here.
video_codec->width = 176;
video_codec->height = 144;
} else if (video_codec->codecType == webrtc::kVideoCodecH263) {
video_codec->width = 352;
video_codec->height = 288;
} else {
// Otherwise go with 640x480.
video_codec->width = 640;
video_codec->height = 480;
}
}
void TestCodecImageProcess(webrtc::VideoCodec video_codec,
webrtc::ViECodec* codec_interface,
int video_channel,
int* number_of_errors,
webrtc::ViEImageProcess* image_process) {
int error = codec_interface->SetSendCodec(video_channel, video_codec);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViEAutoTestEffectFilter frame_counter;
error = image_process->RegisterRenderEffectFilter(video_channel,
frame_counter);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep (KAutoTestSleepTimeMs);
int max_number_of_rendered_frames = video_codec.maxFramerate *
KAutoTestSleepTimeMs / 1000;
if (video_codec.codecType == webrtc::kVideoCodecI420) {
// Due to that I420 needs a huge bandwidth, rate control can set
// frame rate very low. This happen since we use the same channel
// as we just tested with vp8.
*number_of_errors += ViETest::TestError(frame_counter.numFrames > 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
} else {
#ifdef WEBRTC_ANDROID
// Special case to get the autotest to pass on some slow devices
*number_of_errors += ViETest::TestError(frameCounter.numFrames
> max_number_of_rendered_frames / 6,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
#else
*number_of_errors += ViETest::TestError(frame_counter.numFrames
> max_number_of_rendered_frames / 4,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
#endif
}
error = image_process->DeregisterRenderEffectFilter(video_channel);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
// Test switching from i420 to VP8 as send codec and make sure that
// the codec observer gets called after the switch.
void TestCodecCallbacks(webrtc::ViEBase *& base_interface,
webrtc::ViECodec *codec_interface,
int video_channel,
int* number_of_errors,
int forced_codec_width,
int forced_codec_height) {
// Set I420 as send codec so we don't make any assumptions about what
// we currently have as send codec:
SetSendCodec(webrtc::kVideoCodecI420, codec_interface, video_channel,
number_of_errors, forced_codec_width, forced_codec_height);
// Register the observer:
ViEAutotestCodecObserver codec_observer;
int error = codec_interface->RegisterEncoderObserver(video_channel,
codec_observer);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = codec_interface->RegisterDecoderObserver(video_channel,
codec_observer);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Make the switch
ViETest::Log("Testing codec callbacks...");
SetSendCodec(webrtc::kVideoCodecVP8, codec_interface, video_channel,
number_of_errors, forced_codec_width, forced_codec_height);
AutoTestSleep (KAutoTestSleepTimeMs);
// Verify that we got the right codec
*number_of_errors += ViETest::TestError(
codec_observer.incomingCodec.codecType == webrtc::kVideoCodecVP8,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
// Clean up
error = codec_interface->DeregisterEncoderObserver(video_channel);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = codec_interface->DeregisterDecoderObserver(video_channel);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
*number_of_errors += ViETest::TestError(
codec_observer.incomingCodecCalled > 0,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
*number_of_errors += ViETest::TestError(
codec_observer.incomingRatecalled > 0,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
*number_of_errors += ViETest::TestError(
codec_observer.outgoingRatecalled > 0,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
}
void TestCodecs(const TbInterfaces& interfaces,
int & number_of_errors,
int capture_id,
int video_channel,
int forced_codec_width,
int forced_codec_height) {
int error;
webrtc::VideoEngine *video_engine_interface = interfaces.video_engine;
webrtc::ViEBase *base_interface = interfaces.base;
webrtc::ViECapture *capture_interface = interfaces.capture;
webrtc::ViERender *render_interface = interfaces.render;
webrtc::ViECodec *codec_interface = interfaces.codec;
webrtc::ViENetwork *network_interface = interfaces.network;
// ***************************************************************
// Engine ready. Begin testing class
// ***************************************************************
webrtc::VideoCodec video_codec;
memset(&video_codec, 0, sizeof (webrtc::VideoCodec));
// Set up all receive codecs. This basically trains the codec interface
// to be able to recognize all receive codecs based on payload type.
for (int idx = 0; idx < codec_interface->NumberOfCodecs(); idx++) {
error = codec_interface->GetCodec(idx, video_codec);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
SetSuitableResolution(&video_codec,
forced_codec_width,
forced_codec_height);
error = codec_interface->SetReceiveCodec(video_channel, video_codec);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
const char *ip_address = "127.0.0.1";
const unsigned short rtp_port = 6000;
error = network_interface->SetLocalReceiver(video_channel, rtp_port);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->StartReceive(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = network_interface->SetSendDestination(video_channel, ip_address,
rtp_port);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->StartSend(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Run all found codecs
webrtc::ViEImageProcess *image_process =
webrtc::ViEImageProcess::GetInterface(video_engine_interface);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log("Loop through all codecs for %d seconds",
KAutoTestSleepTimeMs / 1000);
for (int i = 0; i < codec_interface->NumberOfCodecs(); i++) {
error = codec_interface->GetCodec(i, video_codec);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
if (video_codec.codecType == webrtc::kVideoCodecMPEG4 ||
video_codec.codecType == webrtc::kVideoCodecRED ||
video_codec.codecType == webrtc::kVideoCodecULPFEC) {
ViETest::Log("\t %d. %s not tested", i, video_codec.plName);
} else {
ViETest::Log("\t %d. %s", i, video_codec.plName);
SetSuitableResolution(&video_codec,
forced_codec_width, forced_codec_height);
TestCodecImageProcess(video_codec, codec_interface, video_channel,
&number_of_errors, image_process);
}
}
image_process->Release();
TestCodecCallbacks(base_interface, codec_interface, video_channel,
&number_of_errors, forced_codec_width,
forced_codec_height);
ViETest::Log("Done!");
// ***************************************************************
// Testing finished. Tear down Video Engine
// ***************************************************************
error = base_interface->StopSend(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->StopReceive(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->StopRender(capture_id);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->StopRender(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->RemoveRenderer(capture_id);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->RemoveRenderer(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = capture_interface->DisconnectCaptureDevice(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->DeleteChannel(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
void SetSendCodec(webrtc::VideoCodecType of_type,
webrtc::ViECodec* codec_interface,
int video_channel,
int* number_of_errors,
int forced_codec_width,
int forced_codec_height) {
webrtc::VideoCodec codec;
bool ok = FindSpecificCodec(of_type, codec_interface, &codec);
*number_of_errors += ViETest::TestError(ok == true, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
if (!ok) {
return;
}
SetSuitableResolution(&codec, forced_codec_width, forced_codec_height);
int error = codec_interface->SetSendCodec(video_channel, codec);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}

View File

@ -0,0 +1,125 @@
/*
* 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.
*/
#ifndef SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_PRIMITIVES_CODEC_PRIMITIVES_H_
#define SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_PRIMITIVES_CODEC_PRIMITIVES_H_
#include "vie_autotest_defines.h"
#include "vie_codec.h"
#include "vie_image_process.h"
class TbInterfaces;
// This can be passed into TestCodecs and SetSendCodec
// in order to let the function choose resolutions itself.
const int kDoNotForceResolution = 0;
// Tests that a codec actually renders frames by registering a basic
// render effect filter on the codec and then running it. This test is
// quite lenient on the number of frames that get rendered, so it should not
// be seen as a end-user-visible quality measure - it is more a sanity check
// that the codec at least gets some frames through.
void TestCodecs(const TbInterfaces& interfaces,
int & number_of_errors,
int capture_id,
int video_channel,
int forced_codec_width,
int forced_codec_height);
// This helper function will set the send codec in the codec interface to a
// codec of the specified type. It will generate a test failure if we do not
// support the provided codec type.
void SetSendCodec(webrtc::VideoCodecType of_type,
webrtc::ViECodec* codec_interface,
int video_channel,
int* number_of_errors,
int forced_codec_width,
int forced_codec_height);
class ViEAutotestCodecObserver: public webrtc::ViEEncoderObserver,
public webrtc::ViEDecoderObserver {
public:
int incomingCodecCalled;
int incomingRatecalled;
int outgoingRatecalled;
unsigned char lastPayloadType;
unsigned short lastWidth;
unsigned short lastHeight;
unsigned int lastOutgoingFramerate;
unsigned int lastOutgoingBitrate;
unsigned int lastIncomingFramerate;
unsigned int lastIncomingBitrate;
webrtc::VideoCodec incomingCodec;
ViEAutotestCodecObserver() {
incomingCodecCalled = 0;
incomingRatecalled = 0;
outgoingRatecalled = 0;
lastPayloadType = 0;
lastWidth = 0;
lastHeight = 0;
lastOutgoingFramerate = 0;
lastOutgoingBitrate = 0;
lastIncomingFramerate = 0;
lastIncomingBitrate = 0;
memset(&incomingCodec, 0, sizeof(incomingCodec));
}
virtual void IncomingCodecChanged(const int videoChannel,
const webrtc::VideoCodec& videoCodec) {
incomingCodecCalled++;
lastPayloadType = videoCodec.plType;
lastWidth = videoCodec.width;
lastHeight = videoCodec.height;
memcpy(&incomingCodec, &videoCodec, sizeof(videoCodec));
}
virtual void IncomingRate(const int videoChannel,
const unsigned int framerate,
const unsigned int bitrate) {
incomingRatecalled++;
lastIncomingFramerate += framerate;
lastIncomingBitrate += bitrate;
}
virtual void OutgoingRate(const int videoChannel,
const unsigned int framerate,
const unsigned int bitrate) {
outgoingRatecalled++;
lastOutgoingFramerate += framerate;
lastOutgoingBitrate += bitrate;
}
virtual void RequestNewKeyFrame(const int videoChannel) {
}
};
class ViEAutoTestEffectFilter: public webrtc::ViEEffectFilter
{
public:
int numFrames;
ViEAutoTestEffectFilter() {
numFrames = 0;
}
virtual ~ViEAutoTestEffectFilter() {
}
virtual int Transform(int size, unsigned char* frameBuffer,
unsigned int timeStamp90KHz, unsigned int width,
unsigned int height) {
numFrames++;
return 0;
}
};
#endif // SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_PRIMITIVES_CODEC_PRIMITIVES_H_

View File

@ -0,0 +1,142 @@
/*
* 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 "general_primitives.h"
#include "video_capture_factory.h"
#include "vie_autotest.h"
#include "vie_autotest_defines.h"
#include "vie_to_file_renderer.h"
void FindCaptureDeviceOnSystem(webrtc::ViECapture* capture,
unsigned char* device_name,
unsigned int device_name_length,
int* device_id,
int* number_of_errors,
webrtc::VideoCaptureModule** device_video) {
bool capture_device_set = false;
webrtc::VideoCaptureModule::DeviceInfo *dev_info =
webrtc::VideoCaptureFactory::CreateDeviceInfo(0);
const unsigned int kMaxUniqueIdLength = 256;
WebRtc_UWord8 unique_id[kMaxUniqueIdLength];
memset(unique_id, 0, kMaxUniqueIdLength);
for (unsigned int i = 0; i < dev_info->NumberOfDevices(); i++) {
int error = dev_info->GetDeviceName(i, device_name, device_name_length,
unique_id, kMaxUniqueIdLength);
*number_of_errors += ViETest::TestError(
error == 0, "ERROR: %s at line %d", __FUNCTION__, __LINE__);
*device_video =
webrtc::VideoCaptureFactory::Create(4571, unique_id);
*number_of_errors += ViETest::TestError(
*device_video != NULL, "ERROR: %s at line %d", __FUNCTION__, __LINE__);
(*device_video)->AddRef();
error = capture->AllocateCaptureDevice(**device_video, *device_id);
if (error == 0) {
ViETest::Log("Using capture device: %s, captureId: %d.",
device_name, *device_id);
capture_device_set = true;
break;
} else {
(*device_video)->Release();
(*device_video) = NULL;
}
}
delete dev_info;
*number_of_errors += ViETest::TestError(
capture_device_set, "ERROR: %s at line %d - Could not set capture device",
__FUNCTION__, __LINE__);
}
void RenderInWindow(webrtc::ViERender* video_render_interface,
int* numberOfErrors,
int frame_provider_id,
void* os_window,
float z_index) {
int error = video_render_interface->AddRenderer(frame_provider_id, os_window,
z_index, 0.0, 0.0, 1.0, 1.0);
*numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = video_render_interface->StartRender(frame_provider_id);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
void RenderToFile(webrtc::ViERender* renderer_interface,
int frame_provider_id,
ViEToFileRenderer *to_file_renderer) {
int result = renderer_interface->AddRenderer(frame_provider_id,
webrtc::kVideoI420,
to_file_renderer);
ViETest::TestError(result == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
result = renderer_interface->StartRender(frame_provider_id);
ViETest::TestError(result == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
void StopAndRemoveRenderers(webrtc::ViEBase* base_interface,
webrtc::ViERender* render_interface,
int* number_of_errors,
int channel_id,
int capture_id) {
int error = render_interface->StopRender(channel_id);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->RemoveRenderer(channel_id);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->RemoveRenderer(capture_id);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
void ConfigureRtpRtcp(webrtc::ViERTP_RTCP* rtcp_interface,
int* number_of_errors,
int video_channel) {
int error = rtcp_interface->SetRTCPStatus(
video_channel, webrtc::kRtcpCompound_RFC4585);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = rtcp_interface->SetKeyFrameRequestMethod(
video_channel, webrtc::kViEKeyFrameRequestPliRtcp);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = rtcp_interface->SetTMMBRStatus(video_channel, true);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
bool FindSpecificCodec(webrtc::VideoCodecType of_type,
webrtc::ViECodec* codec_interface,
webrtc::VideoCodec* result) {
memset(result, 1, sizeof(webrtc::VideoCodec));
for (int i = 0; i < codec_interface->NumberOfCodecs(); i++) {
webrtc::VideoCodec codec;
if (codec_interface->GetCodec(i, codec) != 0) {
return false;
}
if (codec.codecType == of_type) {
// Done
*result = codec;
return true;
}
}
// Didn't find it
return false;
}

View File

@ -0,0 +1,76 @@
/*
* 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.
*/
#ifndef SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_PRIMITIVES_GENERAL_PRIMITIVES_H_
#define SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_PRIMITIVES_GENERAL_PRIMITIVES_H_
class ViEToFileRenderer;
#include "common_types.h"
namespace webrtc {
class VideoCaptureModule;
class VideoCodec;
class ViEBase;
class ViECapture;
class ViECodec;
class ViERender;
class ViERTP_RTCP;
}
// Finds a suitable capture device (e.g. camera) on the current system
// and allocates it. Details about the found device are filled into the out
// parameters. If this operation fails, device_id is assigned a negative value
// and number_of_errors is incremented.
void FindCaptureDeviceOnSystem(webrtc::ViECapture* capture,
unsigned char* device_name,
const unsigned int kDeviceNameLength,
int* device_id,
int* number_of_errors,
webrtc::VideoCaptureModule** device_video);
// Sets up rendering in a window previously created using a Window Manager
// (See vie_window_manager_factory.h for more details on how to make one of
// those). The frame provider id is a source of video frames, for instance
// a capture device or a video channel.
void RenderInWindow(webrtc::ViERender* video_render_interface,
int* numberOfErrors,
int frame_provider_id,
void* os_window,
float z_index);
// Similar in function to RenderInWindow, this function instead renders to
// a file using a to-file-renderer. The frame provider id is a source of
// video frames, for instance a capture device or a video channel.
void RenderToFile(webrtc::ViERender* renderer_interface,
int frame_provider_id,
ViEToFileRenderer* to_file_renderer);
// Stops all rendering given the normal case that we have a capture device
// and a video channel set up for rendering.
void StopAndRemoveRenderers(webrtc::ViEBase* base_interface,
webrtc::ViERender* render_interface,
int* number_of_errors,
int channel_id,
int capture_id);
// Configures RTP-RTCP.
void ConfigureRtpRtcp(webrtc::ViERTP_RTCP* rtcp_interface,
int* number_of_errors,
int video_channel);
// Finds a codec in the codec list. Returns true on success, false otherwise.
// The resulting codec is filled into result on success but is zeroed out
// on failure.
bool FindSpecificCodec(webrtc::VideoCodecType of_type,
webrtc::ViECodec* codec_interface,
webrtc::VideoCodec* result);
#endif // SRC_VIDEO_ENGINE_MAIN_TEST_AUTOTEST_PRIMITIVES_GENERAL_PRIMITIVES_H_

View File

@ -28,7 +28,8 @@ LOCAL_SRC_FILES:= \
vie_autotest_loopback.cc \
vie_autotest_network.cc \
vie_autotest_render.cc \
vie_autotest_rtp_rtcp.cc
vie_autotest_rtp_rtcp.cc \
vie_comparison_tests.cc
# Flags passed to both C and C++ files.
LOCAL_CFLAGS := \
@ -38,6 +39,8 @@ LOCAL_CFLAGS := \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../interface \
$(LOCAL_PATH)/../helpers \
$(LOCAL_PATH)/../primitives \
$(LOCAL_PATH)/../../../../.. \
$(LOCAL_PATH)/../../../test/AutoTest/interface \
$(LOCAL_PATH)/../../../interface \

View File

@ -18,14 +18,14 @@
#include <stdio.h>
#include <assert.h>
tbI420Encoder::tbI420Encoder() :
TbI420Encoder::TbI420Encoder() :
_inited(false), _encodedImage(), _encodedCompleteCallback(NULL)
{
//
memset(&_functionCalls, 0, sizeof(_functionCalls));
}
tbI420Encoder::~tbI420Encoder()
TbI420Encoder::~TbI420Encoder()
{
_inited = false;
if (_encodedImage._buffer != NULL)
@ -35,7 +35,7 @@ tbI420Encoder::~tbI420Encoder()
}
}
WebRtc_Word32 tbI420Encoder::VersionStatic(WebRtc_Word8* version,
WebRtc_Word32 TbI420Encoder::VersionStatic(WebRtc_Word8* version,
WebRtc_Word32 length)
{
const WebRtc_Word8* str = "I420 version 1.0.0\n";
@ -48,13 +48,13 @@ WebRtc_Word32 tbI420Encoder::VersionStatic(WebRtc_Word8* version,
return verLen;
}
WebRtc_Word32 tbI420Encoder::Version(WebRtc_Word8 *version,
WebRtc_Word32 TbI420Encoder::Version(WebRtc_Word8 *version,
WebRtc_Word32 length) const
{
return VersionStatic(version, length);
}
WebRtc_Word32 tbI420Encoder::Release()
WebRtc_Word32 TbI420Encoder::Release()
{
_functionCalls.Release++;
// should allocate an encoded frame and then release it here, for that we
@ -68,7 +68,7 @@ WebRtc_Word32 tbI420Encoder::Release()
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 tbI420Encoder::Reset()
WebRtc_Word32 TbI420Encoder::Reset()
{
_functionCalls.Reset++;
if (!_inited)
@ -79,7 +79,7 @@ WebRtc_Word32 tbI420Encoder::Reset()
}
WebRtc_Word32 tbI420Encoder::InitEncode(const webrtc::VideoCodec* inst,
WebRtc_Word32 TbI420Encoder::InitEncode(const webrtc::VideoCodec* inst,
WebRtc_Word32 /*numberOfCores*/,
WebRtc_UWord32 /*maxPayloadSize */)
{
@ -114,7 +114,7 @@ WebRtc_Word32 tbI420Encoder::InitEncode(const webrtc::VideoCodec* inst,
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 tbI420Encoder::Encode(
WebRtc_Word32 TbI420Encoder::Encode(
const webrtc::RawImage& inputImage,
const webrtc::CodecSpecificInfo* /*codecSpecificInfo*/,
const webrtc::VideoFrameType* /*frameType*/)
@ -160,7 +160,7 @@ WebRtc_Word32 tbI420Encoder::Encode(
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 tbI420Encoder::RegisterEncodeCompleteCallback(
WebRtc_Word32 TbI420Encoder::RegisterEncodeCompleteCallback(
webrtc::EncodedImageCallback* callback)
{
_functionCalls.RegisterEncodeCompleteCallback++;
@ -168,55 +168,55 @@ WebRtc_Word32 tbI420Encoder::RegisterEncodeCompleteCallback(
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 tbI420Encoder::SetPacketLoss(WebRtc_UWord32 packetLoss)
WebRtc_Word32 TbI420Encoder::SetPacketLoss(WebRtc_UWord32 packetLoss)
{
_functionCalls.SetPacketLoss++;
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 tbI420Encoder::SetRates(WebRtc_UWord32 newBitRate,
WebRtc_Word32 TbI420Encoder::SetRates(WebRtc_UWord32 newBitRate,
WebRtc_UWord32 frameRate)
{
_functionCalls.SetRates++;
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 tbI420Encoder::SetPeriodicKeyFrames(bool enable)
WebRtc_Word32 TbI420Encoder::SetPeriodicKeyFrames(bool enable)
{
_functionCalls.SetPeriodicKeyFrames++;
return WEBRTC_VIDEO_CODEC_ERROR;
}
WebRtc_Word32 tbI420Encoder::CodecConfigParameters(WebRtc_UWord8* /*buffer*/,
WebRtc_Word32 TbI420Encoder::CodecConfigParameters(WebRtc_UWord8* /*buffer*/,
WebRtc_Word32 /*size*/)
{
_functionCalls.CodecConfigParameters++;
return WEBRTC_VIDEO_CODEC_ERROR;
}
tbI420Encoder::FunctionCalls tbI420Encoder::GetFunctionCalls()
TbI420Encoder::FunctionCalls TbI420Encoder::GetFunctionCalls()
{
return _functionCalls;
}
tbI420Decoder::tbI420Decoder():
TbI420Decoder::TbI420Decoder():
_decodedImage(), _width(0), _height(0), _inited(false),
_decodeCompleteCallback(NULL)
{
memset(&_functionCalls, 0, sizeof(_functionCalls));
}
tbI420Decoder::~tbI420Decoder()
TbI420Decoder::~TbI420Decoder()
{
Release();
}
WebRtc_Word32 tbI420Decoder::Reset()
WebRtc_Word32 TbI420Decoder::Reset()
{
_functionCalls.Reset++;
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 tbI420Decoder::InitDecode(const webrtc::VideoCodec* inst,
WebRtc_Word32 TbI420Decoder::InitDecode(const webrtc::VideoCodec* inst,
WebRtc_Word32 /*numberOfCores */)
{
_functionCalls.InitDecode++;
@ -234,7 +234,7 @@ WebRtc_Word32 tbI420Decoder::InitDecode(const webrtc::VideoCodec* inst,
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 tbI420Decoder::Decode(
WebRtc_Word32 TbI420Decoder::Decode(
const webrtc::EncodedImage& inputImage,
bool /*missingFrames*/,
const webrtc::RTPFragmentationHeader* /*fragmentation*/,
@ -292,7 +292,7 @@ WebRtc_Word32 tbI420Decoder::Decode(
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 tbI420Decoder::RegisterDecodeCompleteCallback(
WebRtc_Word32 TbI420Decoder::RegisterDecodeCompleteCallback(
webrtc::DecodedImageCallback* callback)
{
_functionCalls.RegisterDecodeCompleteCallback++;
@ -300,7 +300,7 @@ WebRtc_Word32 tbI420Decoder::RegisterDecodeCompleteCallback(
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 tbI420Decoder::Release()
WebRtc_Word32 TbI420Decoder::Release()
{
_functionCalls.Release++;
if (_decodedImage._buffer != NULL)
@ -312,7 +312,7 @@ WebRtc_Word32 tbI420Decoder::Release()
return WEBRTC_VIDEO_CODEC_OK;
}
tbI420Decoder::FunctionCalls tbI420Decoder::GetFunctionCalls()
TbI420Decoder::FunctionCalls TbI420Decoder::GetFunctionCalls()
{
return _functionCalls;
}

View File

@ -10,7 +10,7 @@
#include "tb_capture_device.h"
tbCaptureDevice::tbCaptureDevice(tbInterfaces& Engine, int& nrOfErrors) :
TbCaptureDevice::TbCaptureDevice(TbInterfaces& Engine, int& nrOfErrors) :
captureId(-1),
numberOfErrors(nrOfErrors),
ViE(Engine),
@ -47,7 +47,7 @@ tbCaptureDevice::tbCaptureDevice(tbInterfaces& Engine, int& nrOfErrors) :
}
vcpm_->AddRef();
error = ViE.ptrViECapture->AllocateCaptureDevice(*vcpm_, captureId);
error = ViE.capture->AllocateCaptureDevice(*vcpm_, captureId);
if (error == 0)
{
ViETest::Log("Using capture device: %s, captureId: %d", deviceName,
@ -64,37 +64,37 @@ tbCaptureDevice::tbCaptureDevice(tbInterfaces& Engine, int& nrOfErrors) :
ViETest::Log("Starting capture device %s with captureId %d\n", deviceName,
captureId);
error = ViE.ptrViECapture->StartCapture(captureId);
error = ViE.capture->StartCapture(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
tbCaptureDevice::~tbCaptureDevice(void)
TbCaptureDevice::~TbCaptureDevice(void)
{
ViETest::Log("Stopping capture device with id %d\n", captureId);
int error;
error = ViE.ptrViECapture->StopCapture(captureId);
error = ViE.capture->StopCapture(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECapture->ReleaseCaptureDevice(captureId);
error = ViE.capture->ReleaseCaptureDevice(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
vcpm_->Release();
}
void tbCaptureDevice::ConnectTo(int videoChannel)
void TbCaptureDevice::ConnectTo(int videoChannel)
{
int error;
error = ViE.ptrViECapture->ConnectCaptureDevice(captureId, videoChannel);
error = ViE.capture->ConnectCaptureDevice(captureId, videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
void tbCaptureDevice::Disconnect(int videoChannel)
void TbCaptureDevice::Disconnect(int videoChannel)
{
int error = 0;
error = ViE.ptrViECapture->DisconnectCaptureDevice(videoChannel);
error = ViE.capture->DisconnectCaptureDevice(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}

View File

@ -33,7 +33,7 @@
#pragma warning(disable: 4355) // 'this' : used in base member initializer list
#endif
tbExternalTransport::tbExternalTransport(webrtc::ViENetwork& vieNetwork) :
TbExternalTransport::TbExternalTransport(webrtc::ViENetwork& vieNetwork) :
_vieNetwork(vieNetwork),
_thread(*webrtc::ThreadWrapper::CreateThread(
ViEExternalTransportRun, this, webrtc::kHighPriority,
@ -60,7 +60,7 @@ tbExternalTransport::tbExternalTransport(webrtc::ViENetwork& vieNetwork) :
_thread.Start(tId);
}
tbExternalTransport::~tbExternalTransport()
TbExternalTransport::~TbExternalTransport()
{
_thread.SetNotAlive();
_event.Set();
@ -73,7 +73,7 @@ tbExternalTransport::~tbExternalTransport()
delete &_statCrit;
}
int tbExternalTransport::SendPacket(int channel, const void *data, int len)
int TbExternalTransport::SendPacket(int channel, const void *data, int len)
{
if (_filterSSRC)
{
@ -114,7 +114,7 @@ int tbExternalTransport::SendPacket(int channel, const void *data, int len)
return len;
}
int tbExternalTransport::SendRTCPPacket(int channel, const void *data, int len)
int TbExternalTransport::SendRTCPPacket(int channel, const void *data, int len)
{
_statCrit.Enter();
_rtcpCount++;
@ -133,27 +133,27 @@ int tbExternalTransport::SendRTCPPacket(int channel, const void *data, int len)
return len;
}
WebRtc_Word32 tbExternalTransport::SetPacketLoss(WebRtc_Word32 lossRate)
WebRtc_Word32 TbExternalTransport::SetPacketLoss(WebRtc_Word32 lossRate)
{
webrtc::CriticalSectionScoped cs(_statCrit);
_lossRate = lossRate;
return 0;
}
void tbExternalTransport::SetNetworkDelay(WebRtc_Word64 delayMs)
void TbExternalTransport::SetNetworkDelay(WebRtc_Word64 delayMs)
{
webrtc::CriticalSectionScoped cs(_crit);
_networkDelayMs = delayMs;
}
void tbExternalTransport::SetSSRCFilter(WebRtc_UWord32 ssrc)
void TbExternalTransport::SetSSRCFilter(WebRtc_UWord32 ssrc)
{
webrtc::CriticalSectionScoped cs(_crit);
_filterSSRC = true;
_SSRC = ssrc;
}
void tbExternalTransport::ClearStats()
void TbExternalTransport::ClearStats()
{
webrtc::CriticalSectionScoped cs(_statCrit);
_rtpCount = 0;
@ -161,7 +161,7 @@ void tbExternalTransport::ClearStats()
_rtcpCount = 0;
}
void tbExternalTransport::GetStats(WebRtc_Word32& numRtpPackets,
void TbExternalTransport::GetStats(WebRtc_Word32& numRtpPackets,
WebRtc_Word32& numDroppedPackets,
WebRtc_Word32& numRtcpPackets)
{
@ -171,36 +171,36 @@ void tbExternalTransport::GetStats(WebRtc_Word32& numRtpPackets,
numRtcpPackets = _rtcpCount;
}
void tbExternalTransport::EnableSSRCCheck()
void TbExternalTransport::EnableSSRCCheck()
{
webrtc::CriticalSectionScoped cs(_statCrit);
_checkSSRC = true;
}
unsigned int tbExternalTransport::ReceivedSSRC()
unsigned int TbExternalTransport::ReceivedSSRC()
{
webrtc::CriticalSectionScoped cs(_statCrit);
return _lastSSRC;
}
void tbExternalTransport::EnableSequenceNumberCheck()
void TbExternalTransport::EnableSequenceNumberCheck()
{
webrtc::CriticalSectionScoped cs(_statCrit);
_checkSequenceNumber = true;
}
unsigned short tbExternalTransport::GetFirstSequenceNumber()
unsigned short TbExternalTransport::GetFirstSequenceNumber()
{
webrtc::CriticalSectionScoped cs(_statCrit);
return _firstSequenceNumber;
}
bool tbExternalTransport::ViEExternalTransportRun(void* object)
bool TbExternalTransport::ViEExternalTransportRun(void* object)
{
return static_cast<tbExternalTransport*>
return static_cast<TbExternalTransport*>
(object)->ViEExternalTransportProcess();
}
bool tbExternalTransport::ViEExternalTransportProcess()
bool TbExternalTransport::ViEExternalTransportProcess()
{
unsigned int waitTime = KMaxWaitTimeMs;
@ -286,7 +286,7 @@ bool tbExternalTransport::ViEExternalTransportProcess()
return true;
}
WebRtc_Word64 tbExternalTransport::NowMs()
WebRtc_Word64 TbExternalTransport::NowMs()
{
return webrtc::TickTime::MillisecondTimestamp();
}

View File

@ -10,7 +10,7 @@
#include "tb_interfaces.h"
tbInterfaces::tbInterfaces(const char* testName, int& nrOfErrors) :
TbInterfaces::TbInterfaces(const char* testName, int& nrOfErrors) :
numberOfErrors(nrOfErrors)
{
char traceFile[256] = "";
@ -23,110 +23,110 @@ tbInterfaces::tbInterfaces(const char* testName, int& nrOfErrors) :
ViETest::Log("Creating ViE Interfaces for test %s\n", testName);
ptrViE = webrtc::VideoEngine::Create();
numberOfErrors += ViETest::TestError(ptrViE != NULL,
video_engine = webrtc::VideoEngine::Create();
numberOfErrors += ViETest::TestError(video_engine != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
int error = ptrViE->SetTraceFile(traceFile);
int error = video_engine->SetTraceFile(traceFile);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViE->SetTraceFilter(webrtc::kTraceAll);
error = video_engine->SetTraceFilter(webrtc::kTraceAll);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ptrViEBase = webrtc::ViEBase::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViEBase != NULL,
base = webrtc::ViEBase::GetInterface(video_engine);
numberOfErrors += ViETest::TestError(base != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
error = ptrViEBase->Init();
error = base->Init();
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ptrViECapture = webrtc::ViECapture::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViECapture != NULL,
capture = webrtc::ViECapture::GetInterface(video_engine);
numberOfErrors += ViETest::TestError(capture != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
ptrViERtpRtcp = webrtc::ViERTP_RTCP::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViERtpRtcp != NULL,
rtp_rtcp = webrtc::ViERTP_RTCP::GetInterface(video_engine);
numberOfErrors += ViETest::TestError(rtp_rtcp != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
ptrViERender = webrtc::ViERender::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViERender != NULL,
render = webrtc::ViERender::GetInterface(video_engine);
numberOfErrors += ViETest::TestError(render != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
ptrViECodec = webrtc::ViECodec::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViECodec != NULL,
codec = webrtc::ViECodec::GetInterface(video_engine);
numberOfErrors += ViETest::TestError(codec != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
ptrViENetwork = webrtc::ViENetwork::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViENetwork != NULL,
network = webrtc::ViENetwork::GetInterface(video_engine);
numberOfErrors += ViETest::TestError(network != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
ptrViEImageProcess = webrtc::ViEImageProcess::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViEImageProcess != NULL,
image_process = webrtc::ViEImageProcess::GetInterface(video_engine);
numberOfErrors += ViETest::TestError(image_process != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
ptrViEEncryption = webrtc::ViEEncryption::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViEEncryption != NULL,
encryption = webrtc::ViEEncryption::GetInterface(video_engine);
numberOfErrors += ViETest::TestError(encryption != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
}
tbInterfaces::~tbInterfaces(void)
TbInterfaces::~TbInterfaces(void)
{
int numberOfErrors = 0;
int remainingInterfaces = 0;
remainingInterfaces = ptrViEEncryption->Release();
remainingInterfaces = encryption->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViEImageProcess->Release();
remainingInterfaces = image_process->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViECodec->Release();
remainingInterfaces = codec->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViECapture->Release();
remainingInterfaces = capture->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViERender->Release();
remainingInterfaces = render->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViERtpRtcp->Release();
remainingInterfaces = rtp_rtcp->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViENetwork->Release();
remainingInterfaces = network->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViEBase->Release();
remainingInterfaces = base->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
bool deleted = webrtc::VideoEngine::Delete(ptrViE);
bool deleted = webrtc::VideoEngine::Delete(video_engine);
numberOfErrors += ViETest::TestError(deleted == true,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);

View File

@ -10,22 +10,22 @@
#include "tb_video_channel.h"
tbVideoChannel::tbVideoChannel(tbInterfaces& Engine, int& nrOfErrors,
tbVideoChannel::tbVideoChannel(TbInterfaces& Engine, int& nrOfErrors,
webrtc::VideoCodecType sendCodec, int width,
int height, int frameRate, int startBitrate) :
videoChannel(-1), numberOfErrors(nrOfErrors), ViE(Engine)
{
int error;
error = ViE.ptrViEBase->CreateChannel(videoChannel);
error = ViE.base->CreateChannel(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::VideoCodec videoCodec;
memset(&videoCodec, 0, sizeof(webrtc::VideoCodec));
bool sendCodecSet = false;
for (int idx = 0; idx < ViE.ptrViECodec->NumberOfCodecs(); idx++)
for (int idx = 0; idx < ViE.codec->NumberOfCodecs(); idx++)
{
error = ViE.ptrViECodec->GetCodec(idx, videoCodec);
error = ViE.codec->GetCodec(idx, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -40,7 +40,7 @@ tbVideoChannel::tbVideoChannel(tbInterfaces& Engine, int& nrOfErrors,
videoCodec.startBitrate = startBitrate;
videoCodec.maxBitrate = startBitrate * 3;
}
error = ViE.ptrViECodec->SetSendCodec(videoChannel, videoCodec);
error = ViE.codec->SetSendCodec(videoChannel, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -51,7 +51,7 @@ tbVideoChannel::tbVideoChannel(tbInterfaces& Engine, int& nrOfErrors,
videoCodec.width = 352;
videoCodec.height = 288;
}
error = ViE.ptrViECodec->SetReceiveCodec(videoChannel, videoCodec);
error = ViE.codec->SetReceiveCodec(videoChannel, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -65,7 +65,7 @@ tbVideoChannel::tbVideoChannel(tbInterfaces& Engine, int& nrOfErrors,
tbVideoChannel::~tbVideoChannel(void)
{
int error;
error = ViE.ptrViEBase->DeleteChannel(videoChannel);
error = ViE.base->DeleteChannel(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
@ -74,12 +74,12 @@ void tbVideoChannel::StartSend(const unsigned short rtpPort /*= 11000*/,
const char* ipAddress /*= "127.0.0.1"*/)
{
int error;
error = ViE.ptrViENetwork->SetSendDestination(videoChannel, ipAddress,
error = ViE.network->SetSendDestination(videoChannel, ipAddress,
rtpPort);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(videoChannel);
error = ViE.base->StartSend(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
@ -88,18 +88,18 @@ void tbVideoChannel::SetFrameSettings(int width, int height, int frameRate)
{
int error;
webrtc::VideoCodec videoCodec;
error = ViE.ptrViECodec->GetSendCodec(videoChannel, videoCodec);
error = ViE.codec->GetSendCodec(videoChannel, videoCodec);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
videoCodec.width = width;
videoCodec.height = height;
videoCodec.maxFramerate = frameRate;
error = ViE.ptrViECodec->SetSendCodec(videoChannel, videoCodec);
error = ViE.codec->SetSendCodec(videoChannel, videoCodec);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECodec->SetReceiveCodec(videoChannel, videoCodec);
error = ViE.codec->SetReceiveCodec(videoChannel, videoCodec);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -107,7 +107,7 @@ void tbVideoChannel::SetFrameSettings(int width, int height, int frameRate)
void tbVideoChannel::StopSend()
{
int error;
error = ViE.ptrViEBase->StopSend(videoChannel);
error = ViE.base->StopSend(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
@ -116,11 +116,11 @@ void tbVideoChannel::StartReceive(const unsigned short rtpPort /*= 11000*/)
{
int error;
error = ViE.ptrViENetwork->SetLocalReceiver(videoChannel, rtpPort);
error = ViE.network->SetLocalReceiver(videoChannel, rtpPort);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartReceive(videoChannel);
error = ViE.base->StartReceive(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
@ -128,7 +128,7 @@ void tbVideoChannel::StartReceive(const unsigned short rtpPort /*= 11000*/)
void tbVideoChannel::StopReceive()
{
int error;
error = ViE.ptrViEBase->StopReceive(videoChannel);
error = ViE.base->StopReceive(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}

View File

@ -8,13 +8,13 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "engine_configurations.h"
#include "gtest/gtest.h"
#include "video_capture_factory.h"
#include "vie_autotest_defines.h"
#include "vie_autotest.h"
#include "vie_fake_camera.h"
#include "vie_to_file_renderer.h"
#include "base_primitives.h"
#include "general_primitives.h"
#include "tb_interfaces.h"
#include "vie_autotest_defines.h"
#include "video_capture_factory.h"
class BaseObserver : public webrtc::ViEBaseObserver {
public:
@ -27,250 +27,6 @@ class BaseObserver : public webrtc::ViEBaseObserver {
unsigned int cpu_load_;
};
webrtc::VideoEngine *InitializeVideoEngine(int & numberOfErrors) {
ViETest::Log("Starting a loopback call...");
webrtc::VideoEngine *ptrViE = webrtc::VideoEngine::Create();
numberOfErrors += ViETest::TestError(ptrViE != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
#ifdef WEBRTC_ANDROID
int error = ptrViE->SetTraceFile("/sdcard/ViEBaseStandardTest_trace.txt");
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
#else
int error = ptrViE->SetTraceFile("ViEBaseStandardTest_trace.txt");
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
#endif
return ptrViE;
}
webrtc::ViEBase *InitializeViEBase(webrtc::VideoEngine * ptrViE,
int & numberOfErrors) {
webrtc::ViEBase *ptrViEBase = webrtc::ViEBase::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViEBase != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
int error = ptrViEBase->Init();
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
return ptrViEBase;
}
webrtc::ViECapture *InitializeChannel(webrtc::ViEBase * ptrViEBase,
int & videoChannel,
int & numberOfErrors,
webrtc::VideoEngine * ptrViE) {
int error = ptrViEBase->CreateChannel(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::ViECapture *ptrViECapture = webrtc::ViECapture::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViECapture != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
return ptrViECapture;
}
void ConnectCaptureDevice(webrtc::ViECapture * ptrViECapture,
int captureId,
int videoChannel,
int & numberOfErrors) {
int error = ptrViECapture->ConnectCaptureDevice(captureId, videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
webrtc::ViERTP_RTCP *ConfigureRtpRtcp(webrtc::VideoEngine * ptrViE,
int & numberOfErrors,
int videoChannel) {
webrtc::ViERTP_RTCP *ptrViERtpRtcp =
webrtc::ViERTP_RTCP::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViE != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
int error = ptrViERtpRtcp->
SetRTCPStatus(videoChannel, webrtc::kRtcpCompound_RFC4585);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERtpRtcp->
SetKeyFrameRequestMethod(videoChannel,
webrtc::kViEKeyFrameRequestPliRtcp);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERtpRtcp->SetTMMBRStatus(videoChannel, true);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
return ptrViERtpRtcp;
}
void ViEAutoTest::RenderInWindow(webrtc::ViERender* video_render_interface,
int* numberOfErrors,
int frame_provider_id,
void* os_window,
float z_index) {
int error = video_render_interface->AddRenderer(frame_provider_id, os_window,
z_index, 0.0, 0.0, 1.0, 1.0);
*numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = video_render_interface->StartRender(frame_provider_id);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
// Tests a I420-to-I420 call. This test exercises the most basic WebRTC ViE
// functionality by setting up the codec interface to recognize the most common
// codecs, and the initiating a I420 call.
webrtc::ViENetwork *TestCallSetup(webrtc::ViECodec * ptrViECodec,
int & numberOfErrors,
int videoChannel,
webrtc::VideoEngine * ptrViE,
webrtc::ViEBase * ptrViEBase,
const WebRtc_UWord8 *deviceName) {
int error;
webrtc::VideoCodec videoCodec;
memset(&videoCodec, 0, sizeof(webrtc::VideoCodec));
for (int idx = 0; idx < ptrViECodec->NumberOfCodecs(); idx++) {
error = ptrViECodec->GetCodec(idx, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// try to keep the test frame size small when I420
if (videoCodec.codecType == webrtc::kVideoCodecI420) {
videoCodec.width = 176;
videoCodec.height = 144;
error = ptrViECodec->SetSendCodec(videoChannel, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
error = ptrViECodec->SetReceiveCodec(videoChannel, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
webrtc::ViENetwork *ptrViENetwork =
webrtc::ViENetwork::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViENetwork != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
char version[1024] = "";
error = ptrViEBase->GetVersion(version);
ViETest::Log("\nUsing WebRTC Video Engine version: %s", version);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
const char *ipAddress = "127.0.0.1";
WebRtc_UWord16 rtpPortListen = 6000;
WebRtc_UWord16 rtpPortSend = 6000;
rtpPortListen = 6100;
rtpPortSend = 6100;
error = ptrViENetwork->SetLocalReceiver(videoChannel, rtpPortListen);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViEBase->StartReceive(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViENetwork->SetSendDestination(videoChannel, ipAddress,
rtpPortSend);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViEBase->StartSend(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Call started
ViETest::Log("Call started");
ViETest::Log("You should see a local preview from camera %s"
" in window 1 and the remote video in window 2.", deviceName);
AutoTestSleep(KAutoTestSleepTimeMs);
// Done
error = ptrViEBase->StopSend(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
return ptrViENetwork;
}
void StopEverything(webrtc::ViEBase * ptrViEBase,
int videoChannel,
int & numberOfErrors,
webrtc::ViERender * ptrViERender,
int captureId,
webrtc::ViECapture * ptrViECapture,
webrtc::VideoRender* vrm1,
webrtc::VideoRender* vrm2) {
int error = ptrViEBase->StopReceive(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->StopRender(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->RemoveRenderer(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->DeRegisterVideoRenderModule(*vrm2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->RemoveRenderer(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->DeRegisterVideoRenderModule(*vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViECapture->DisconnectCaptureDevice(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
void ReleaseEverything(webrtc::ViECapture *ptrViECapture,
int& numberOfErrors,
webrtc::ViEBase *ptrViEBase,
int videoChannel,
webrtc::ViECodec *ptrViECodec,
webrtc::ViERTP_RTCP *ptrViERtpRtcp,
webrtc::ViERender *ptrViERender,
webrtc::ViENetwork *ptrViENetwork,
webrtc::VideoEngine *ptrViE) {
int remainingInterfaces = ptrViECapture->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
int error2 = ptrViEBase->DeleteChannel(videoChannel);
numberOfErrors += ViETest::TestError(error2 == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
remainingInterfaces = ptrViECodec->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViERtpRtcp->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViERender->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViENetwork->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
remainingInterfaces = ptrViEBase->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
bool deleted = webrtc::VideoEngine::Delete(ptrViE);
numberOfErrors += ViETest::TestError(deleted == true,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
}
int ViEAutoTest::ViEBaseStandardTest() {
ViETest::Log(" ");
ViETest::Log("========================================");
@ -280,97 +36,104 @@ int ViEAutoTest::ViEBaseStandardTest() {
// Begin create/initialize WebRTC Video Engine for testing
// ***************************************************************
int numberOfErrors = 0;
int number_of_errors = 0;
webrtc::VideoEngine* ptrViE = InitializeVideoEngine(numberOfErrors);
webrtc::ViEBase *ptrViEBase = InitializeViEBase(ptrViE, numberOfErrors);
TbInterfaces interfaces("ViEBaseStandardTest", number_of_errors);
// ***************************************************************
// Engine ready. Set up the test case:
// ***************************************************************
int videoChannel = -1;
webrtc::ViECapture *ptrViECapture =
InitializeChannel(ptrViEBase, videoChannel, numberOfErrors, ptrViE);
int video_channel = -1;
int error = interfaces.base->CreateChannel(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::VideoCaptureModule* vcpm(NULL);
webrtc::VideoCaptureModule* video_capture_module(NULL);
const unsigned int kMaxDeviceNameLength = 128;
WebRtc_UWord8 deviceName[kMaxDeviceNameLength];
memset(deviceName, 0, kMaxDeviceNameLength);
int captureId;
WebRtc_UWord8 device_name[kMaxDeviceNameLength];
memset(device_name, 0, kMaxDeviceNameLength);
int capture_id;
FindCaptureDeviceOnSystem(ptrViECapture,
deviceName,
webrtc::ViEBase *base_interface = interfaces.base;
webrtc::ViERender *render_interface = interfaces.render;
webrtc::ViECapture *capture_interface = interfaces.capture;
FindCaptureDeviceOnSystem(capture_interface,
device_name,
kMaxDeviceNameLength,
&captureId,
&numberOfErrors,
&vcpm);
&capture_id,
&number_of_errors,
&video_capture_module);
ConnectCaptureDevice(ptrViECapture, captureId, videoChannel, numberOfErrors);
int error = ptrViECapture->StartCapture(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = capture_interface->ConnectCaptureDevice(capture_id,
video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::ViERTP_RTCP *ptrViERtpRtcp =
ConfigureRtpRtcp(ptrViE, numberOfErrors, videoChannel);
error = capture_interface->StartCapture(capture_id);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::ViERender *ptrViERender = webrtc::ViERender::GetInterface(ptrViE);
ViETest::TestError(ptrViERender != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
ConfigureRtpRtcp(interfaces.rtp_rtcp, &number_of_errors, video_channel);
error = ptrViERender->RegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->RegisterVideoRenderModule(*_vrm2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->RegisterVideoRenderModule(*_vrm1);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->RegisterVideoRenderModule(*_vrm2);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
RenderInWindow(ptrViERender, &numberOfErrors, captureId, _window1, 0);
RenderInWindow(ptrViERender, &numberOfErrors, videoChannel, _window2, 1);
webrtc::ViECodec *ptrViECodec = webrtc::ViECodec::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViECodec != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
RenderInWindow(render_interface, &number_of_errors, capture_id,
_window1, 0);
RenderInWindow(render_interface, &number_of_errors, video_channel,
_window2, 1);
// ***************************************************************
// Run the actual test:
// ***************************************************************
webrtc::ViENetwork *ptrViENetwork =
TestCallSetup(ptrViECodec, numberOfErrors, videoChannel,
ptrViE, ptrViEBase, deviceName);
TestI420CallSetup(interfaces.codec, interfaces.video_engine,
base_interface, interfaces.network, &number_of_errors,
video_channel, device_name);
// ***************************************************************
// Testing finished. Tear down Video Engine
// ***************************************************************
error = ptrViECapture->StopCapture(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
StopEverything(ptrViEBase, videoChannel, numberOfErrors, ptrViERender,
captureId, ptrViECapture, _vrm1, _vrm2);
error = ptrViECapture->ReleaseCaptureDevice(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
error = capture_interface->StopCapture(capture_id);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->StopReceive(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
vcpm->Release();
vcpm = NULL;
StopAndRemoveRenderers(base_interface, render_interface, &number_of_errors,
video_channel, capture_id);
ReleaseEverything(ptrViECapture, numberOfErrors, ptrViEBase, videoChannel,
ptrViECodec, ptrViERtpRtcp, ptrViERender, ptrViENetwork,
ptrViE);
error = render_interface->DeRegisterVideoRenderModule(*_vrm1);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->DeRegisterVideoRenderModule(*_vrm2);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
if (numberOfErrors > 0) {
error = capture_interface->ReleaseCaptureDevice(capture_id);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
video_capture_module->Release();
video_capture_module = NULL;
error = base_interface->DeleteChannel(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
if (number_of_errors > 0) {
// Test failed
ViETest::Log(" ");
ViETest::Log(" ERROR ViEBase Standard Test FAILED!");
ViETest::Log(" Number of errors: %d", numberOfErrors);
ViETest::Log(" Number of errors: %d", number_of_errors);
ViETest::Log("========================================");
ViETest::Log(" ");
return numberOfErrors;
return number_of_errors;
}
ViETest::Log(" ");
@ -437,7 +200,7 @@ int ViEAutoTest::ViEBaseAPITest() {
numberOfErrors += ViETest::TestError(ptrViE != NULL, "VideoEngine::Create");
#ifdef WEBRTC_ANDROID
error = ptrViE->SetTraceFile("/sdcard/WebRTC/ViEBaseAPI_trace.txt");
error = video_engine->SetTraceFile("/sdcard/WebRTC/ViEBaseAPI_trace.txt");
numberOfErrors += ViETest::TestError(error == 0, "SetTraceFile error");
#else
error = ptrViE->SetTraceFile("ViEBaseAPI_trace.txt");
@ -590,140 +353,3 @@ int ViEAutoTest::ViEBaseAPITest() {
return 0;
}
void ViEAutoTest::FindCaptureDeviceOnSystem(
webrtc::ViECapture* capture,
unsigned char* device_name,
unsigned int device_name_length,
int* device_id,
int* number_of_errors,
webrtc::VideoCaptureModule** device_video) {
bool capture_device_set = false;
webrtc::VideoCaptureModule::DeviceInfo *dev_info =
webrtc::VideoCaptureFactory::CreateDeviceInfo(0);
const unsigned int kMaxUniqueIdLength = 256;
WebRtc_UWord8 unique_id[kMaxUniqueIdLength];
memset(unique_id, 0, kMaxUniqueIdLength);
for (unsigned int i = 0; i < dev_info->NumberOfDevices(); i++) {
int error = dev_info->GetDeviceName(i, device_name, device_name_length,
unique_id, kMaxUniqueIdLength);
*number_of_errors += ViETest::TestError(
error == 0, "ERROR: %s at line %d", __FUNCTION__, __LINE__);
*device_video =
webrtc::VideoCaptureFactory::Create(4571, unique_id);
*number_of_errors += ViETest::TestError(
*device_video != NULL, "ERROR: %s at line %d", __FUNCTION__, __LINE__);
(*device_video)->AddRef();
error = capture->AllocateCaptureDevice(**device_video, *device_id);
if (error == 0) {
ViETest::Log("Using capture device: %s, captureId: %d.",
device_name, *device_id);
capture_device_set = true;
break;
} else {
(*device_video)->Release();
(*device_video) = NULL;
}
}
delete dev_info;
*number_of_errors += ViETest::TestError(
capture_device_set, "ERROR: %s at line %d - Could not set capture device",
__FUNCTION__, __LINE__);
}
void ViEAutoTest::RenderToFile(webrtc::ViERender* renderer_interface,
int render_id,
ViEToFileRenderer *to_file_renderer)
{
int result = renderer_interface->AddRenderer(render_id,
webrtc::kVideoI420,
to_file_renderer);
ViETest::TestError(result == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
result = renderer_interface->StartRender(render_id);
ViETest::TestError(result == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
void ViEAutoTest::ViEAutomatedBaseStandardTest(
const std::string& i420_test_video_path,
int width,
int height,
ViEToFileRenderer* local_file_renderer,
ViEToFileRenderer* remote_file_renderer) {
int ignored;
// Initialize the test:
webrtc::VideoEngine* video_engine =
InitializeVideoEngine(ignored);
webrtc::ViEBase *base_interface =
InitializeViEBase(video_engine, ignored);
int video_channel = -1;
webrtc::ViECapture *capture_interface =
InitializeChannel(base_interface, video_channel, ignored, video_engine);
ViEFakeCamera fake_camera(capture_interface);
if (!fake_camera.StartCameraInNewThread(i420_test_video_path,
width,
height)) {
// No point in continuing if we have no proper video source
ViETest::TestError(false, "ERROR: %s at line %d: "
"Could not open input video %s: aborting test...",
__FUNCTION__, __LINE__, i420_test_video_path.c_str());
return;
}
int capture_id = fake_camera.capture_id();
// Apparently, we need to connect external capture devices, but we should
// not start them since the external device is not a proper device.
ConnectCaptureDevice(capture_interface, capture_id, video_channel,
ignored);
webrtc::ViERTP_RTCP *rtcp_interface =
ConfigureRtpRtcp(video_engine, ignored, video_channel);
webrtc::ViERender *render_interface =
webrtc::ViERender::GetInterface(video_engine);
ViETest::TestError(render_interface != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
render_interface->RegisterVideoRenderModule(*_vrm1);
render_interface->RegisterVideoRenderModule(*_vrm2);
RenderToFile(render_interface, capture_id, local_file_renderer);
RenderToFile(render_interface, video_channel, remote_file_renderer);
webrtc::ViECodec *codec_interface =
webrtc::ViECodec::GetInterface(video_engine);
ViETest::TestError(codec_interface != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
// Run the test itself:
const WebRtc_UWord8* device_name =
reinterpret_cast<const WebRtc_UWord8*>("Fake Capture Device");
webrtc::ViENetwork *network_interface =
TestCallSetup(codec_interface, ignored, video_channel,
video_engine, base_interface, device_name);
AutoTestSleep(KAutoTestSleepTimeMs);
StopEverything(base_interface, video_channel, ignored, render_interface,
capture_id, capture_interface, _vrm1, _vrm2);
// Stop sending data, clean up the camera thread and release the capture
// device. Note that this all happens after StopEverything, so this
// tests that the system doesn't mind that the external capture device sends
// data after rendering has been stopped.
fake_camera.StopCamera();
ReleaseEverything(capture_interface, ignored, base_interface,
video_channel, codec_interface, rtcp_interface,
render_interface, network_interface, video_engine);
}

View File

@ -8,27 +8,28 @@
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* vie_autotest_capture.cc
*/
#include "vie_autotest_defines.h"
#include "vie_autotest.h"
#include "engine_configurations.h"
#include "common_types.h"
#include "voe_base.h"
#include "engine_configurations.h"
#include "gflags/gflags.h"
#include "tb_interfaces.h"
#include "tb_video_channel.h"
#include "tick_util.h"
#include "vie_autotest_defines.h"
#include "video_capture_factory.h"
#include "vie_base.h"
#include "vie_capture.h"
#include "vie_codec.h"
#include "vie_network.h"
#include "vie_render.h"
#include "vie_rtp_rtcp.h"
#include "tick_util.h"
#include "voe_base.h"
#include "tb_interfaces.h"
#include "tb_video_channel.h"
#include "video_capture_factory.h"
DEFINE_bool(capture_test_ensure_resolution_alignment_in_capture_device, true,
"If true, we will give resolutions slightly below a reasonable "
"value to test the camera's ability to choose a good resolution. "
"If false, we will provide reasonable resolutions instead.");
class CaptureObserver: public webrtc::ViECaptureObserver
{
@ -135,7 +136,7 @@ int ViEAutoTest::ViECaptureStandardTest()
int error = 0;
tbInterfaces ViE("ViECaptureStandardTest", numberOfErrors);
TbInterfaces ViE("ViECaptureStandardTest", numberOfErrors);
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
webrtc::VideoCaptureFactory::CreateDeviceInfo(0);
@ -169,7 +170,7 @@ int ViEAutoTest::ViECaptureStandardTest()
// not supported on MAC (is part of capture capabilites
#if !defined(WEBRTC_LINUX) && !defined(WEBRTC_MAC_INTEL)
error = ViE.ptrViECapture->ShowCaptureSettingsDialogBox(
error = ViE.capture->ShowCaptureSettingsDialogBox(
(char*) deviceUniqueName,
(unsigned int) (strlen((char*) deviceUniqueName)),
"WebRTCViECapture StandardTest");
@ -210,10 +211,10 @@ int ViEAutoTest::ViECaptureStandardTest()
}
#endif
}
// Capture Capability Functions are not supported on WEBRTC_MAC_INTEL.
#if !defined(WEBRTC_MAC_INTEL)
// "capture capability functios" are not supported on WEBRTC_MAC_INTEL
//Check allocation. Try to allocate them all after each other.
// Check allocation. Try to allocate them all after each other.
for (int deviceIndex = 0;
deviceIndex < numberOfCaptureDevices;
++deviceIndex)
@ -237,7 +238,7 @@ int ViEAutoTest::ViECaptureStandardTest()
__FUNCTION__, __LINE__);
vcpms[deviceIndex] = vcpm;
error = ViE.ptrViECapture->AllocateCaptureDevice(
error = ViE.capture->AllocateCaptureDevice(
*vcpm, captureDeviceId[deviceIndex]);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -246,10 +247,10 @@ int ViEAutoTest::ViECaptureStandardTest()
error = devInfo->GetCapability(deviceUniqueName, 0, capability);
// Test that the camera select the closest capability to the selected
// widht and height.
// width and height.
CaptureEffectFilter filter(capability.width, capability.height,
numberOfErrors);
error = ViE.ptrViEImageProcess->RegisterCaptureEffectFilter(
error = ViE.image_process->RegisterCaptureEffectFilter(
captureDeviceId[deviceIndex], filter);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
@ -257,8 +258,13 @@ int ViEAutoTest::ViECaptureStandardTest()
ViETest::Log("Testing Device %s capability width %d height %d",
deviceUniqueName, capability.width, capability.height);
capability.height = capability.height - 2;
capability.width = capability.width - 2;
if (FLAGS_capture_test_ensure_resolution_alignment_in_capture_device) {
// This tests that the capture device properly aligns to a
// multiple of 16 (or at least 8).
capability.height = capability.height - 2;
capability.width = capability.width - 2;
}
webrtc::CaptureCapability vieCapability;
vieCapability.width = capability.width;
@ -267,7 +273,7 @@ int ViEAutoTest::ViECaptureStandardTest()
vieCapability.maxFPS = capability.maxFPS;
vieCapability.rawType = capability.rawType;
error = ViE.ptrViECapture->StartCapture(captureDeviceId[deviceIndex],
error = ViE.capture->StartCapture(captureDeviceId[deviceIndex],
vieCapability);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -280,15 +286,15 @@ int ViEAutoTest::ViECaptureStandardTest()
}
numberOfErrors += ViETest::TestError(filter._numberOfCapturedFrames
>= 10, "ERROR: %s at line %d", __FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->DeregisterCaptureEffectFilter(
error = ViE.image_process->DeregisterCaptureEffectFilter(
captureDeviceId[deviceIndex]);
#ifdef WEBRTC_ANDROID // Can only allocate one camera at the time on Android
error = ViE.ptrViECapture->StopCapture(captureDeviceId[deviceIndex]);
error = ViE.capture->StopCapture(captureDeviceId[deviceIndex]);
numberOfErrors += ViETest::TestError(error==0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECapture->ReleaseCaptureDevice(
error = ViE.capture->ReleaseCaptureDevice(
captureDeviceId[deviceIndex]);
numberOfErrors += ViETest::TestError(error==0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -303,7 +309,7 @@ int ViEAutoTest::ViECaptureStandardTest()
// stop all started capture devices
for (int deviceIndex = 0; deviceIndex < numberOfCaptureDevices; ++deviceIndex)
{
error = ViE.ptrViECapture->StopCapture(captureDeviceId[deviceIndex]);
error = ViE.capture->StopCapture(captureDeviceId[deviceIndex]);
#ifdef WEBRTC_ANDROID
// Camera already stoped on Android since we can only allocate one
// camera at the time.
@ -314,7 +320,7 @@ int ViEAutoTest::ViECaptureStandardTest()
__FUNCTION__, __LINE__);
#endif
error = ViE.ptrViECapture->ReleaseCaptureDevice(
error = ViE.capture->ReleaseCaptureDevice(
captureDeviceId[deviceIndex]);
#ifdef WEBRTC_ANDROID
// Camera already stoped on Android since we can only allocate one
@ -377,9 +383,9 @@ int ViEAutoTest::ViECaptureAPITest()
//***************************************************************
int error = 0;
tbInterfaces ViE("ViECapture_API", numberOfErrors);
TbInterfaces ViE("ViECaptureAPITest", numberOfErrors);
ViE.ptrViECapture->NumberOfCaptureDevices();
ViE.capture->NumberOfCaptureDevices();
WebRtc_UWord8 deviceName[128];
WebRtc_UWord8 deviceUniqueName[512];
@ -405,17 +411,17 @@ int ViEAutoTest::ViECaptureAPITest()
__FUNCTION__, __LINE__);
// Allocate capture device
error = ViE.ptrViECapture->AllocateCaptureDevice(*vcpm, captureId);
error = ViE.capture->AllocateCaptureDevice(*vcpm, captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Start the capture device
error = ViE.ptrViECapture->StartCapture(captureId);
error = ViE.capture->StartCapture(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Start again. Should fail
error = ViE.ptrViECapture->StartCapture(captureId);
error = ViE.capture->StartCapture(captureId);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(ViE.LastError()
@ -423,7 +429,7 @@ int ViEAutoTest::ViECaptureAPITest()
__FUNCTION__, __LINE__);
// Start invalid capture device
error = ViE.ptrViECapture->StartCapture(captureId + 1);
error = ViE.capture->StartCapture(captureId + 1);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(ViE.LastError()
@ -431,7 +437,7 @@ int ViEAutoTest::ViECaptureAPITest()
__FUNCTION__, __LINE__);
// Stop invalide capture device
error = ViE.ptrViECapture->StopCapture(captureId + 1);
error = ViE.capture->StopCapture(captureId + 1);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(ViE.LastError()
@ -439,12 +445,12 @@ int ViEAutoTest::ViECaptureAPITest()
__FUNCTION__, __LINE__);
// Stop the capture device
error = ViE.ptrViECapture->StopCapture(captureId);
error = ViE.capture->StopCapture(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Stop the capture device again
error = ViE.ptrViECapture->StopCapture(captureId);
error = ViE.capture->StopCapture(captureId);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(ViE.LastError()
@ -452,7 +458,7 @@ int ViEAutoTest::ViECaptureAPITest()
__LINE__);
// Connect to invalid channel
error = ViE.ptrViECapture->ConnectCaptureDevice(captureId, 0);
error = ViE.capture->ConnectCaptureDevice(captureId, 0);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(ViE.LastError()
@ -462,7 +468,7 @@ int ViEAutoTest::ViECaptureAPITest()
tbVideoChannel channel(ViE, numberOfErrors);
// Connect invalid captureId
error = ViE.ptrViECapture->ConnectCaptureDevice(captureId + 1,
error = ViE.capture->ConnectCaptureDevice(captureId + 1,
channel.videoChannel);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -472,13 +478,13 @@ int ViEAutoTest::ViECaptureAPITest()
__LINE__);
// Connect the capture device to the channel
error = ViE.ptrViECapture->ConnectCaptureDevice(captureId,
error = ViE.capture->ConnectCaptureDevice(captureId,
channel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Connect the channel again
error = ViE.ptrViECapture->ConnectCaptureDevice(captureId,
error = ViE.capture->ConnectCaptureDevice(captureId,
channel.videoChannel);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -487,12 +493,12 @@ int ViEAutoTest::ViECaptureAPITest()
__FUNCTION__, __LINE__);
// Start the capture device
error = ViE.ptrViECapture->StartCapture(captureId);
error = ViE.capture->StartCapture(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Release invalid capture device.
error = ViE.ptrViECapture->ReleaseCaptureDevice(captureId + 1);
error = ViE.capture->ReleaseCaptureDevice(captureId + 1);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(ViE.LastError()
@ -500,12 +506,12 @@ int ViEAutoTest::ViECaptureAPITest()
__FUNCTION__, __LINE__);
// Release the capture device
error = ViE.ptrViECapture->ReleaseCaptureDevice(captureId);
error = ViE.capture->ReleaseCaptureDevice(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Release the capture device again
error = ViE.ptrViECapture->ReleaseCaptureDevice(captureId);
error = ViE.capture->ReleaseCaptureDevice(captureId);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(ViE.LastError()
@ -520,7 +526,7 @@ int ViEAutoTest::ViECaptureAPITest()
__FUNCTION__, __LINE__);
//Test SetRotation
error = ViE.ptrViECapture->SetRotateCapturedFrames(
error = ViE.capture->SetRotateCapturedFrames(
captureId, webrtc::RotateCapturedFrame_90);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -529,32 +535,32 @@ int ViEAutoTest::ViECaptureAPITest()
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
// Allocate capture device
error = ViE.ptrViECapture->AllocateCaptureDevice(*vcpm, captureId);
error = ViE.capture->AllocateCaptureDevice(*vcpm, captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECapture->SetRotateCapturedFrames(
error = ViE.capture->SetRotateCapturedFrames(
captureId, webrtc::RotateCapturedFrame_0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECapture->SetRotateCapturedFrames(
error = ViE.capture->SetRotateCapturedFrames(
captureId, webrtc::RotateCapturedFrame_90);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECapture->SetRotateCapturedFrames(
error = ViE.capture->SetRotateCapturedFrames(
captureId, webrtc::RotateCapturedFrame_180);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECapture->SetRotateCapturedFrames(
error = ViE.capture->SetRotateCapturedFrames(
captureId, webrtc::RotateCapturedFrame_270);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Release the capture device
error = ViE.ptrViECapture->ReleaseCaptureDevice(captureId);
error = ViE.capture->ReleaseCaptureDevice(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -598,7 +604,7 @@ int ViEAutoTest::ViECaptureExternalCaptureTest()
int error = 0;
tbInterfaces ViE("ViECapture_ExternalCapture", numberOfErrors);
TbInterfaces ViE("ViECaptureExternalCaptureTest", numberOfErrors);
tbVideoChannel channel(ViE, numberOfErrors);
channel.StartReceive();
channel.StartSend();
@ -614,7 +620,7 @@ int ViEAutoTest::ViECaptureExternalCaptureTest()
numberOfErrors += ViETest::TestError(vcpm != NULL, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECapture->AllocateCaptureDevice(*vcpm, captureId);
error = ViE.capture->AllocateCaptureDevice(*vcpm, captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(externalCapture != 0,
@ -622,44 +628,44 @@ int ViEAutoTest::ViECaptureExternalCaptureTest()
__LINE__);
// Connect the capture device to the channel
error = ViE.ptrViECapture->ConnectCaptureDevice(captureId,
error = ViE.capture->ConnectCaptureDevice(captureId,
channel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Render the local capture
error = ViE.ptrViERender->AddRenderer(captureId, _window1, 1, 0.0, 0.0,
1.0, 1.0);
error = ViE.render->AddRenderer(captureId, _window1, 1, 0.0, 0.0,
1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Render the remote capture
error = ViE.ptrViERender->AddRenderer(channel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(channel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(captureId);
error = ViE.render->StartRender(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(channel.videoChannel);
error = ViE.render->StartRender(channel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Register observer
CaptureObserver observer;
error = ViE.ptrViECapture->RegisterObserver(captureId, observer);
error = ViE.capture->RegisterObserver(captureId, observer);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Enable brighness alarm
error = ViE.ptrViECapture->EnableBrightnessAlarm(captureId, true);
error = ViE.capture->EnableBrightnessAlarm(captureId, true);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
CaptureEffectFilter effectFilter(176, 144, numberOfErrors);
error = ViE.ptrViEImageProcess->RegisterCaptureEffectFilter(captureId,
error = ViE.image_process->RegisterCaptureEffectFilter(captureId,
effectFilter);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -782,12 +788,12 @@ int ViEAutoTest::ViECaptureExternalCaptureTest()
delete videoFrame;
// Release the capture device
error = ViE.ptrViECapture->ReleaseCaptureDevice(captureId);
error = ViE.capture->ReleaseCaptureDevice(captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Release the capture device again
error = ViE.ptrViECapture->ReleaseCaptureDevice(captureId);
error = ViE.capture->ReleaseCaptureDevice(captureId);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(

View File

@ -8,322 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
//
// vie_autotest_codec.cc
//
#include "vie_autotest.h"
#include "codec_primitives.h"
#include "common_types.h"
#include "engine_configurations.h"
#include "vie_autotest_defines.h"
#include "general_primitives.h"
#include "tb_capture_device.h"
#include "vie_fake_camera.h"
#include "tb_I420_codec.h"
#include "tb_interfaces.h"
#include "tb_video_channel.h"
#include "vie_base.h"
#include "vie_capture.h"
#include "vie_codec.h"
#include "vie_network.h"
#include "vie_render.h"
#include "vie_rtp_rtcp.h"
#include "voe_base.h"
const int kDoNotForceResolution = 0;
class ViEAutotestCodecObserver: public webrtc::ViEEncoderObserver,
public webrtc::ViEDecoderObserver
{
public:
int incomingCodecCalled;
int incomingRatecalled;
int outgoingRatecalled;
unsigned char lastPayloadType;
unsigned short lastWidth;
unsigned short lastHeight;
unsigned int lastOutgoingFramerate;
unsigned int lastOutgoingBitrate;
unsigned int lastIncomingFramerate;
unsigned int lastIncomingBitrate;
webrtc::VideoCodec incomingCodec;
ViEAutotestCodecObserver()
{
incomingCodecCalled = 0;
incomingRatecalled = 0;
outgoingRatecalled = 0;
lastPayloadType = 0;
lastWidth = 0;
lastHeight = 0;
lastOutgoingFramerate = 0;
lastOutgoingBitrate = 0;
lastIncomingFramerate = 0;
lastIncomingBitrate = 0;
memset(&incomingCodec, 0, sizeof(incomingCodec));
}
virtual void IncomingCodecChanged(const int videoChannel,
const webrtc::VideoCodec& videoCodec)
{
incomingCodecCalled++;
lastPayloadType = videoCodec.plType;
lastWidth = videoCodec.width;
lastHeight = videoCodec.height;
memcpy(&incomingCodec, &videoCodec, sizeof(videoCodec));
}
virtual void IncomingRate(const int videoChannel,
const unsigned int framerate,
const unsigned int bitrate)
{
incomingRatecalled++;
lastIncomingFramerate += framerate;
lastIncomingBitrate += bitrate;
}
virtual void OutgoingRate(const int videoChannel,
const unsigned int framerate,
const unsigned int bitrate)
{
outgoingRatecalled++;
lastOutgoingFramerate += framerate;
lastOutgoingBitrate += bitrate;
}
virtual void RequestNewKeyFrame(const int videoChannel)
{
}
};
class ViEAutoTestEffectFilter: public webrtc::ViEEffectFilter
{
public:
int numFrames;
ViEAutoTestEffectFilter()
{
numFrames = 0;
}
~ViEAutoTestEffectFilter()
{
}
virtual int Transform(int size, unsigned char* frameBuffer,
unsigned int timeStamp90KHz, unsigned int width,
unsigned int height)
{
numFrames++;
return 0;
}
};
// Helper functions
// Finds a codec in the codec list. Returns 0 on success, nonzero otherwise.
// The resulting codec is filled into result on success but is zeroed out
// on failure.
int FindSpecificCodec(webrtc::VideoCodecType of_type,
webrtc::ViECodec* codec_interface,
webrtc::VideoCodec* result) {
memset(result, 1, sizeof(webrtc::VideoCodec));
for (int i = 0; i < codec_interface->NumberOfCodecs(); i++) {
webrtc::VideoCodec codec;
if (codec_interface->GetCodec(i, codec) != 0) {
return -1;
}
if (codec.codecType == of_type) {
// Done
*result = codec;
return 0;
}
}
// Didn't find it
return -1;
}
// Sets the video codec's resolution info to something suitable based on each
// codec's quirks, except if the forced* variables are != kDoNotForceResolution.
void SetSuitableResolution(webrtc::VideoCodec* video_codec,
int forced_codec_width,
int forced_codec_height) {
if (forced_codec_width != kDoNotForceResolution &&
forced_codec_height != kDoNotForceResolution) {
video_codec->width = forced_codec_width;
video_codec->height = forced_codec_height;
} else if (video_codec->codecType == webrtc::kVideoCodecI420) {
// I420 is very bandwidth heavy, so limit it here
video_codec->width = 176;
video_codec->height = 144;
} else if (video_codec->codecType != webrtc::kVideoCodecH263) {
// Otherwise go with 640x480, except for H263 which can do whatever
// it pleases.
video_codec->width = 640;
video_codec->height = 480;
}
}
// Tests that a codec actually renders frames by registering a basic
// render effect filter on the codec and then running it. This test is
// quite lenient on the number of frames that get rendered, so it should not
// be seen as a end-user-visible quality measure - it is more a sanity check
// that the codec at least gets some frames through.
void TestCodecImageProcess(webrtc::VideoCodec video_codec,
webrtc::ViECodec* codec_interface,
int video_channel,
int* number_of_errors,
webrtc::ViEImageProcess* image_process) {
int error = codec_interface->SetSendCodec(video_channel, video_codec);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViEAutoTestEffectFilter frame_counter;
error = image_process->RegisterRenderEffectFilter(video_channel,
frame_counter);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep (KAutoTestSleepTimeMs);
int max_number_of_rendered_frames = video_codec.maxFramerate *
KAutoTestSleepTimeMs / 1000;
if (video_codec.codecType == webrtc::kVideoCodecI420) {
// Due to that I420 needs a huge bandwidth, rate control can set
// frame rate very low. This happen since we use the same channel
// as we just tested with vp8.
*number_of_errors += ViETest::TestError(frame_counter.numFrames > 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
} else {
#ifdef WEBRTC_ANDROID
// Special case to get the autotest to pass on some slow devices
*number_of_errors +=
ViETest::TestError(frameCounter.numFrames
> max_number_of_rendered_frames / 6,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
#else
*number_of_errors += ViETest::TestError(frame_counter.numFrames
> max_number_of_rendered_frames / 4,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
#endif
}
error = image_process->DeregisterRenderEffectFilter(video_channel);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
void SetSendCodec(webrtc::VideoCodecType of_type,
webrtc::ViECodec* codec_interface,
int video_channel,
int* number_of_errors,
int forced_codec_width,
int forced_codec_height) {
webrtc::VideoCodec codec;
int error = FindSpecificCodec(of_type, codec_interface, &codec);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
SetSuitableResolution(&codec, forced_codec_width, forced_codec_height);
error = codec_interface->SetSendCodec(video_channel, codec);
*number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
// Test switching from i420 to VP8 as send codec and make sure that
// the codec observer gets called after the switch.
void TestCodecCallbacks(webrtc::ViEBase *& base_interface,
webrtc::ViECodec *codec_interface,
int video_channel,
int* number_of_errors,
int forced_codec_width,
int forced_codec_height) {
// Set I420 as send codec so we don't make any assumptions about what
// we currently have as send codec:
SetSendCodec(webrtc::kVideoCodecI420, codec_interface, video_channel,
number_of_errors, forced_codec_width, forced_codec_height);
// Register the observer:
ViEAutotestCodecObserver codec_observer;
int error = codec_interface->RegisterEncoderObserver(video_channel,
codec_observer);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = codec_interface->RegisterDecoderObserver(video_channel,
codec_observer);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Make the switch
ViETest::Log("Testing codec callbacks...");
SetSendCodec(webrtc::kVideoCodecVP8, codec_interface, video_channel,
number_of_errors, forced_codec_width, forced_codec_height);
AutoTestSleep (KAutoTestSleepTimeMs);
// Verify that we got the right codec
*number_of_errors += ViETest::TestError(
codec_observer.incomingCodec.codecType == webrtc::kVideoCodecVP8,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
// Clean up
error = codec_interface->DeregisterEncoderObserver(video_channel);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = codec_interface->DeregisterDecoderObserver(video_channel);
*number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
*number_of_errors += ViETest::TestError(
codec_observer.incomingCodecCalled > 0,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
*number_of_errors += ViETest::TestError(
codec_observer.incomingRatecalled > 0,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
*number_of_errors += ViETest::TestError(
codec_observer.outgoingRatecalled > 0,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
}
void ViEAutoTest::ViEAutomatedCodecStandardTest(
const std::string& i420_video_file,
int width,
int height,
ViEToFileRenderer* local_file_renderer,
ViEToFileRenderer* remote_file_renderer) {
int ignored = 0;
tbInterfaces interfaces = tbInterfaces("ViECodecAutomatedStandardTest",
ignored);
ViEFakeCamera fake_camera(interfaces.ptrViECapture);
if (!fake_camera.StartCameraInNewThread(i420_video_file, width, height)) {
// No point in continuing if we have no proper video source
ViETest::TestError(false, "ERROR: %s at line %d: "
"Could not open input video %s: aborting test...",
__FUNCTION__, __LINE__, i420_video_file.c_str());
return;
}
// Force the codec resolution to what our input video is so we can make
// comparisons later. Our comparison algorithms wouldn't like scaling.
RunCodecTestInternal(interfaces, ignored, fake_camera.capture_id(),
width, height, local_file_renderer,
remote_file_renderer);
fake_camera.StopCamera();
}
#include "vie_autotest_defines.h"
int ViEAutoTest::ViECodecStandardTest()
{
@ -333,14 +27,33 @@ int ViEAutoTest::ViECodecStandardTest()
int number_of_errors = 0;
tbInterfaces interfaces = tbInterfaces("ViECodecStandardTest",
TbInterfaces interfaces = TbInterfaces("ViECodecStandardTest",
number_of_errors);
tbCaptureDevice capture_device =
tbCaptureDevice(interfaces, number_of_errors);
RunCodecTestInternal(interfaces, number_of_errors, capture_device.captureId,
kDoNotForceResolution, kDoNotForceResolution,
NULL, NULL);
TbCaptureDevice capture_device =
TbCaptureDevice(interfaces, number_of_errors);
int video_channel = -1;
int error = interfaces.base->CreateChannel(video_channel);
ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = interfaces.capture->ConnectCaptureDevice(capture_device.captureId,
video_channel);
ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ConfigureRtpRtcp(interfaces.rtp_rtcp,
&number_of_errors,
video_channel);
RenderInWindow(interfaces.render, &number_of_errors,
capture_device.captureId, _window1, 0);
RenderInWindow(interfaces.render, &number_of_errors,
video_channel, _window2, 1);
TestCodecs(interfaces, number_of_errors, capture_device.captureId,
video_channel, kDoNotForceResolution, kDoNotForceResolution);
if (number_of_errors > 0)
{
@ -374,16 +87,16 @@ int ViEAutoTest::ViECodecExtendedTest()
numberOfErrors += ViECodecStandardTest();
numberOfErrors += ViECodecExternalCodecTest();
tbInterfaces interfaces = tbInterfaces("ViECodecExtendedTest",
TbInterfaces interfaces = TbInterfaces("ViECodecExtendedTest",
numberOfErrors);
webrtc::ViEBase* ptrViEBase = interfaces.ptrViEBase;
webrtc::ViECapture* ptrViECapture = interfaces.ptrViECapture;
webrtc::ViERender* ptrViERender = interfaces.ptrViERender;
webrtc::ViECodec* ptrViECodec = interfaces.ptrViECodec;
webrtc::ViERTP_RTCP* ptrViERtpRtcp = interfaces.ptrViERtpRtcp;
webrtc::ViENetwork* ptrViENetwork = interfaces.ptrViENetwork;
webrtc::ViEBase* ptrViEBase = interfaces.base;
webrtc::ViECapture* ptrViECapture = interfaces.capture;
webrtc::ViERender* ptrViERender = interfaces.render;
webrtc::ViECodec* ptrViECodec = interfaces.codec;
webrtc::ViERTP_RTCP* ptrViERtpRtcp = interfaces.rtp_rtcp;
webrtc::ViENetwork* ptrViENetwork = interfaces.network;
tbCaptureDevice captureDevice = tbCaptureDevice(interfaces,
TbCaptureDevice captureDevice = TbCaptureDevice(interfaces,
numberOfErrors);
int captureId = captureDevice.captureId;
@ -526,47 +239,48 @@ int ViEAutoTest::ViECodecExtendedTest()
//
{
// Create VIE
tbInterfaces ViE("ViECodecExtendedTest2", numberOfErrors);
TbInterfaces ViE("ViECodecExtendedTest2", numberOfErrors);
// Create a capture device
tbCaptureDevice tbCapture(ViE, numberOfErrors);
TbCaptureDevice tbCapture(ViE, numberOfErrors);
// Create channel 1
int videoChannel1 = -1;
error = ViE.ptrViEBase->CreateChannel(videoChannel1);
error = ViE.base->CreateChannel(videoChannel1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
unsigned short rtpPort1 = 12000;
error = ViE.ptrViENetwork->SetLocalReceiver(videoChannel1, rtpPort1);
error = ViE.network->SetLocalReceiver(videoChannel1,
rtpPort1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViENetwork->SetSendDestination(videoChannel1,
"127.0.0.1", rtpPort1);
error = ViE.network->SetSendDestination(videoChannel1,
"127.0.0.1", rtpPort1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
tbCapture.ConnectTo(videoChannel1);
error = ViE.ptrViERtpRtcp->SetKeyFrameRequestMethod(
error = ViE.rtp_rtcp->SetKeyFrameRequestMethod(
videoChannel1, webrtc::kViEKeyFrameRequestPliRtcp);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(videoChannel1, _window1, 0, 0.0,
0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(videoChannel1, _window1,
0, 0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(videoChannel1);
error = ViE.render->StartRender(videoChannel1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViEAutotestCodecObserver codecObserver1;
error = ViE.ptrViECodec->RegisterEncoderObserver(videoChannel1,
codecObserver1);
error = ViE.codec->RegisterEncoderObserver(videoChannel1,
codecObserver1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECodec->RegisterDecoderObserver(videoChannel1,
codecObserver1);
error = ViE.codec->RegisterDecoderObserver(videoChannel1,
codecObserver1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -575,13 +289,13 @@ int ViEAutoTest::ViECodecExtendedTest()
unsigned short codecHeight = 144;
bool codecSet = false;
webrtc::VideoCodec videoCodec;
for (int idx = 0; idx < ViE.ptrViECodec->NumberOfCodecs(); idx++)
for (int idx = 0; idx < ViE.codec->NumberOfCodecs(); idx++)
{
error = ViE.ptrViECodec->GetCodec(idx, videoCodec);
error = ViE.codec->GetCodec(idx, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECodec->SetReceiveCodec(videoChannel1, videoCodec);
error = ViE.codec->SetReceiveCodec(videoChannel1, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -591,8 +305,7 @@ int ViEAutoTest::ViECodecExtendedTest()
videoCodec.height = codecHeight;
videoCodec.startBitrate = 200;
videoCodec.maxBitrate = 300;
error
= ViE.ptrViECodec->SetSendCodec(videoChannel1, videoCodec);
error = ViE.codec->SetSendCodec(videoChannel1, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -603,73 +316,73 @@ int ViEAutoTest::ViECodecExtendedTest()
numberOfErrors += ViETest::TestError(codecSet, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(videoChannel1);
error = ViE.base->StartSend(videoChannel1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartReceive(videoChannel1);
error = ViE.base->StartReceive(videoChannel1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Create channel 2, based on channel 1
int videoChannel2 = -1;
error = ViE.ptrViEBase->CreateChannel(videoChannel2, videoChannel1);
error = ViE.base->CreateChannel(videoChannel2, videoChannel1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(videoChannel1 != videoChannel2,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetKeyFrameRequestMethod(
error = ViE.rtp_rtcp->SetKeyFrameRequestMethod(
videoChannel2, webrtc::kViEKeyFrameRequestPliRtcp);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Prepare receive codecs
for (int idx = 0; idx < ViE.ptrViECodec->NumberOfCodecs(); idx++)
for (int idx = 0; idx < ViE.codec->NumberOfCodecs(); idx++)
{
error = ViE.ptrViECodec->GetCodec(idx, videoCodec);
error = ViE.codec->GetCodec(idx, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECodec->SetReceiveCodec(videoChannel2, videoCodec);
error = ViE.codec->SetReceiveCodec(videoChannel2, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
ViEAutotestCodecObserver codecObserver2;
error = ViE.ptrViECodec->RegisterDecoderObserver(videoChannel2,
codecObserver2);
error = ViE.codec->RegisterDecoderObserver(videoChannel2,
codecObserver2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(videoChannel2, _window2, 0, 0.0,
0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(videoChannel2, _window2,
0, 0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(videoChannel2);
error = ViE.render->StartRender(videoChannel2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
unsigned short rtpPort2 = 13000;
error = ViE.ptrViENetwork->SetLocalReceiver(videoChannel2, rtpPort2);
error = ViE.network->SetLocalReceiver(videoChannel2,
rtpPort2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViENetwork->SetSendDestination(videoChannel2,
"127.0.0.1", rtpPort2);
error = ViE.network->SetSendDestination(videoChannel2,
"127.0.0.1", rtpPort2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartReceive(videoChannel2);
error = ViE.base->StartReceive(videoChannel2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(videoChannel2);
error = ViE.base->StartSend(videoChannel2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log("\nTest using one encoder on several channels");
ViETest::Log(
"Channel 1 is rendered in Window1, channel 2 in Window 2."
ViETest::Log("Channel 1 is rendered in Window1, channel 2 in Window 2."
"\nSending VP8 on both channels");
AutoTestSleep(KAutoTestSleepTimeMs);
@ -686,7 +399,7 @@ int ViEAutoTest::ViECodecExtendedTest()
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
// Delete the first channel and keep the second
error = ViE.ptrViEBase->DeleteChannel(videoChannel1);
error = ViE.base->DeleteChannel(videoChannel1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -697,62 +410,63 @@ int ViEAutoTest::ViECodecExtendedTest()
// Create another channel
int videoChannel3 = -1;
error = ViE.ptrViEBase->CreateChannel(videoChannel3, videoChannel2);
error = ViE.base->CreateChannel(videoChannel3, videoChannel2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(videoChannel3 != videoChannel2,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetKeyFrameRequestMethod(
error = ViE.rtp_rtcp->SetKeyFrameRequestMethod(
videoChannel3, webrtc::kViEKeyFrameRequestPliRtcp);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Prepare receive codecs
for (int idx = 0; idx < ViE.ptrViECodec->NumberOfCodecs(); idx++)
for (int idx = 0; idx < ViE.codec->NumberOfCodecs(); idx++)
{
error = ViE.ptrViECodec->GetCodec(idx, videoCodec);
error = ViE.codec->GetCodec(idx, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECodec->SetReceiveCodec(videoChannel3, videoCodec);
error = ViE.codec->SetReceiveCodec(videoChannel3,
videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
ViEAutotestCodecObserver codecObserver3;
error = ViE.ptrViECodec->RegisterDecoderObserver(videoChannel3,
codecObserver3);
error = ViE.codec->RegisterDecoderObserver(videoChannel3,
codecObserver3);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(videoChannel3, _window1, 0, 0.0,
0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(videoChannel3, _window1, 0, 0.0,
0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(videoChannel3);
error = ViE.render->StartRender(videoChannel3);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
unsigned short rtpPort3 = 14000;
error = ViE.ptrViENetwork->SetLocalReceiver(videoChannel3, rtpPort3);
error = ViE.network->SetLocalReceiver(videoChannel3, rtpPort3);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViENetwork->SetSendDestination(videoChannel3,
"127.0.0.1", rtpPort3);
error = ViE.network->SetSendDestination(videoChannel3,
"127.0.0.1", rtpPort3);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartReceive(videoChannel3);
error = ViE.base->StartReceive(videoChannel3);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(videoChannel3);
error = ViE.base->StartSend(videoChannel3);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->DeleteChannel(videoChannel2);
error = ViE.base->DeleteChannel(videoChannel2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -761,7 +475,7 @@ int ViEAutoTest::ViECodecExtendedTest()
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEBase->DeleteChannel(videoChannel3);
error = ViE.base->DeleteChannel(videoChannel3);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
@ -923,18 +637,18 @@ int ViEAutoTest::ViECodecExternalCodecTest()
int numberOfErrors=0;
{
int error=0;
tbInterfaces ViE("ViEExternalCodec", numberOfErrors);
tbCaptureDevice captureDevice(ViE, numberOfErrors);
TbInterfaces ViE("ViEExternalCodec", numberOfErrors);
TbCaptureDevice captureDevice(ViE, numberOfErrors);
tbVideoChannel channel(ViE, numberOfErrors, webrtc::kVideoCodecI420,
352,288,30,(352*288*3*8*30)/(2*1000));
captureDevice.ConnectTo(channel.videoChannel);
error = ViE.ptrViERender->AddRenderer(channel.videoChannel, _window1, 0,
error = ViE.render->AddRenderer(channel.videoChannel, _window1, 0,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(channel.videoChannel);
error = ViE.render->StartRender(channel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -945,14 +659,14 @@ int ViEAutoTest::ViECodecExternalCodecTest()
AutoTestSleep(KAutoTestSleepTimeMs/2);
ViEExternalCodec* ptrViEExtCodec =
ViEExternalCodec::GetInterface(ViE.ptrViE);
ViEExternalCodec::GetInterface(ViE.video_engine);
numberOfErrors += ViETest::TestError(ptrViEExtCodec != NULL,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::VideoCodec codecStruct;
error=ViE.ptrViECodec->GetSendCodec(channel.videoChannel,codecStruct);
error=ViE.codec->GetSendCodec(channel.videoChannel,codecStruct);
numberOfErrors += ViETest::TestError(ptrViEExtCodec != NULL,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -978,8 +692,8 @@ int ViEAutoTest::ViECodecExternalCodecTest()
__FUNCTION__, __LINE__);
// Use new external encoder
error = ViE.ptrViECodec->SetSendCodec(channel.videoChannel,
codecStruct);
error = ViE.codec->SetSendCodec(channel.videoChannel,
codecStruct);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -991,8 +705,8 @@ int ViEAutoTest::ViECodecExternalCodecTest()
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECodec->SetReceiveCodec(channel.videoChannel,
codecStruct);
error = ViE.codec->SetReceiveCodec(channel.videoChannel,
codecStruct);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -1076,8 +790,8 @@ int ViEAutoTest::ViECodecExternalCodecTest()
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViECodec->SetReceiveCodec(channel.videoChannel,
codecStruct);
error = ViE.codec->SetReceiveCodec(channel.videoChannel,
codecStruct);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -1089,8 +803,8 @@ int ViEAutoTest::ViECodecExternalCodecTest()
__FUNCTION__, __LINE__);
// Use new external encoder
error = ViE.ptrViECodec->SetSendCodec(channel.videoChannel,
codecStruct);
error = ViE.codec->SetSendCodec(channel.videoChannel,
codecStruct);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -1180,151 +894,3 @@ int ViEAutoTest::ViECodecExternalCodecTest()
return 0;
#endif
}
void ViEAutoTest::RunCodecTestInternal(
const tbInterfaces& interfaces,
int & number_of_errors,
int capture_id,
int forced_codec_width,
int forced_codec_height,
ViEToFileRenderer* local_file_renderer,
ViEToFileRenderer* remote_file_renderer) {
webrtc::VideoEngine *video_engine_interface = interfaces.ptrViE;
webrtc::ViEBase *base_interface = interfaces.ptrViEBase;
webrtc::ViECapture *capture_interface = interfaces.ptrViECapture;
webrtc::ViERender *render_interface = interfaces.ptrViERender;
webrtc::ViECodec *codec_interface = interfaces.ptrViECodec;
webrtc::ViERTP_RTCP *rtcp_interface = interfaces.ptrViERtpRtcp;
webrtc::ViENetwork *network_interface = interfaces.ptrViENetwork;
int video_channel = -1;
int error = base_interface->CreateChannel(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = capture_interface->ConnectCaptureDevice(capture_id, video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = rtcp_interface->SetRTCPStatus(video_channel,
webrtc::kRtcpCompound_RFC4585);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = rtcp_interface->
SetKeyFrameRequestMethod(video_channel,
webrtc::kViEKeyFrameRequestPliRtcp);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = rtcp_interface->SetTMMBRStatus(video_channel, true);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
if (local_file_renderer && remote_file_renderer) {
RenderToFile(render_interface, capture_id, local_file_renderer);
RenderToFile(render_interface, video_channel, remote_file_renderer);
} else {
RenderInWindow(render_interface, &number_of_errors,
capture_id, _window1, 0);
RenderInWindow(render_interface, &number_of_errors,
video_channel, _window2, 1);
}
// ***************************************************************
// Engine ready. Begin testing class
// ***************************************************************
webrtc::VideoCodec video_codec;
webrtc::VideoCodec vp8_codec;
memset(&video_codec, 0, sizeof (webrtc::VideoCodec));
memset(&vp8_codec, 0, sizeof (webrtc::VideoCodec));
// Set up all receive codecs. This sets up a mapping in the codec interface
// which makes it able to recognize all receive codecs based on payload type.
for (int idx = 0; idx < codec_interface->NumberOfCodecs(); idx++) {
error = codec_interface->GetCodec(idx, video_codec);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
SetSuitableResolution(&video_codec,
forced_codec_width,
forced_codec_height);
error = codec_interface->SetReceiveCodec(video_channel, video_codec);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
const char *ip_address = "127.0.0.1";
const unsigned short rtp_port = 6000;
error = network_interface->SetLocalReceiver(video_channel, rtp_port);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->StartReceive(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = network_interface->SetSendDestination(video_channel, ip_address,
rtp_port);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->StartSend(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Run all found codecs
webrtc::ViEImageProcess *image_process =
webrtc::ViEImageProcess::GetInterface(video_engine_interface);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log("Loop through all codecs for %d seconds",
KAutoTestSleepTimeMs / 1000);
for (int i = 0; i < codec_interface->NumberOfCodecs(); i++) {
error = codec_interface->GetCodec(i, video_codec);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
if (video_codec.codecType == webrtc::kVideoCodecMPEG4 ||
video_codec.codecType == webrtc::kVideoCodecRED ||
video_codec.codecType == webrtc::kVideoCodecULPFEC) {
ViETest::Log("\t %d. %s not tested", i, video_codec.plName);
} else {
ViETest::Log("\t %d. %s", i, video_codec.plName);
SetSuitableResolution(&video_codec,
forced_codec_width, forced_codec_height);
TestCodecImageProcess(video_codec, codec_interface, video_channel,
&number_of_errors, image_process);
}
}
image_process->Release();
TestCodecCallbacks(base_interface, codec_interface, video_channel,
&number_of_errors, forced_codec_width,
forced_codec_height);
ViETest::Log("Done!");
// ***************************************************************
// Testing finished. Tear down Video Engine
// ***************************************************************
error = base_interface->StopSend(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->StopReceive(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->StopRender(capture_id);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->StopRender(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->RemoveRenderer(capture_id);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = render_interface->RemoveRenderer(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = capture_interface->DisconnectCaptureDevice(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = base_interface->DeleteChannel(video_channel);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}

View File

@ -88,30 +88,30 @@ int ViEAutoTest::ViEEncryptionStandardTest()
int numberOfErrors = 0;
// Create VIE
tbInterfaces ViE("ViEEncryptionStandardTest", numberOfErrors);
TbInterfaces ViE("ViEEncryptionStandardTest", numberOfErrors);
// Create a video channel
tbVideoChannel tbChannel(ViE, numberOfErrors, webrtc::kVideoCodecVP8);
// Create a capture device
tbCaptureDevice tbCapture(ViE, numberOfErrors);
TbCaptureDevice tbCapture(ViE, numberOfErrors);
tbCapture.ConnectTo(tbChannel.videoChannel);
tbChannel.StartReceive();
tbChannel.StartSend();
error = ViE.ptrViERender->AddRenderer(tbCapture.captureId, _window1, 0,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbCapture.captureId, _window1, 0,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbCapture.captureId);
error = ViE.render->StartRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbChannel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbChannel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbChannel.videoChannel);
error = ViE.render->StartRender(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -129,57 +129,57 @@ int ViEAutoTest::ViEEncryptionStandardTest()
4, 5, 6, 7, 8, 9};
// Encryption only
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthNull, 0, 0, webrtc::kEncryption, srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthNull, 0, 0, webrtc::kEncryption, srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log("SRTP encryption only");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Authentication only
error = ViE.ptrViEEncryption->EnableSRTPReceive(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20,
4, webrtc::kAuthentication,
srtpKey1);
error = ViE.encryption->EnableSRTPReceive(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20,
4, webrtc::kAuthentication,
srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20, 4,
webrtc::kAuthentication,
srtpKey1);
error = ViE.encryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20, 4,
webrtc::kAuthentication,
srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log("SRTP authentication only");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Full protection
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey1);
@ -187,25 +187,25 @@ int ViEAutoTest::ViEEncryptionStandardTest()
__FUNCTION__, __LINE__);
ViETest::Log("SRTP full protection");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
#endif // WEBRTC_SRTP
//
// External encryption
//
ViEAutotestEncryption testEncryption;
error = ViE.ptrViEBase->StartSend(tbChannel.videoChannel);
error = ViE.ptrViEEncryption->RegisterExternalEncryption(
error = ViE.base->StartSend(tbChannel.videoChannel);
error = ViE.encryption->RegisterExternalEncryption(
tbChannel.videoChannel, testEncryption);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log(
"External encryption/decryption added, you should still see video");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEEncryption->DeregisterExternalEncryption(
error = ViE.encryption->DeregisterExternalEncryption(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -248,29 +248,29 @@ int ViEAutoTest::ViEEncryptionExtendedTest()
int numberOfErrors = 0;
// Create VIE
tbInterfaces ViE("ViEEncryptionExtendedTest", numberOfErrors);
TbInterfaces ViE("ViEEncryptionExtendedTest", numberOfErrors);
// Create a video channel
tbVideoChannel tbChannel(ViE, numberOfErrors, webrtc::kVideoCodecVP8);
// Create a capture device
tbCaptureDevice tbCapture(ViE, numberOfErrors);
TbCaptureDevice tbCapture(ViE, numberOfErrors);
tbCapture.ConnectTo(tbChannel.videoChannel);
tbChannel.StartReceive();
tbChannel.StartSend();
error = ViE.ptrViERender->AddRenderer(tbCapture.captureId, _window1, 0,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbCapture.captureId, _window1, 0,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbCapture.captureId);
error = ViE.render->StartRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbChannel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbChannel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbChannel.videoChannel);
error = ViE.render->StartRender(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -290,81 +290,81 @@ int ViEAutoTest::ViEEncryptionExtendedTest()
{ 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6,
5, 4, 3, 2, 1, 0};
// NULL
error = ViE.ptrViEEncryption->EnableSRTPReceive(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthNull, 0, 0,
webrtc::kNoProtection,
srtpKey1);
error = ViE.encryption->EnableSRTPReceive(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthNull, 0, 0,
webrtc::kNoProtection,
srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthNull, 0, 0,
webrtc::kNoProtection,
srtpKey1);
error = ViE.encryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthNull, 0, 0,
webrtc::kNoProtection,
srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log("SRTP NULL encryption/authentication");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Encryption only
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthNull, 0, 0, webrtc::kEncryption, srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthNull, 0, 0, webrtc::kEncryption, srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log("SRTP encryption only");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Authentication only
error = ViE.ptrViEEncryption->EnableSRTPReceive(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20,
4, webrtc::kAuthentication,
srtpKey1);
error = ViE.encryption->EnableSRTPReceive(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20,
4, webrtc::kAuthentication,
srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20, 4,
webrtc::kAuthentication,
srtpKey1);
error = ViE.encryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20, 4,
webrtc::kAuthentication,
srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log("SRTP authentication only");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Full protection
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey1);
@ -372,21 +372,21 @@ int ViEAutoTest::ViEEncryptionExtendedTest()
__FUNCTION__, __LINE__);
ViETest::Log("SRTP full protection");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Change receive key, but not send key...
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey1);
@ -397,10 +397,10 @@ int ViEAutoTest::ViEEncryptionExtendedTest()
AutoTestSleep(KAutoTestSleepTimeMs);
// Change send key too
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey2);
@ -409,14 +409,14 @@ int ViEAutoTest::ViEEncryptionExtendedTest()
ViETest::Log("\nSRTP send key changed too, you should see remote video "
"again with some decoding artefacts at start");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Disable receive, keep send
ViETest::Log("SRTP receive disabled , you shouldn't see any video");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -425,17 +425,15 @@ int ViEAutoTest::ViEEncryptionExtendedTest()
// External encryption
//
ViEAutotestEncryption testEncryption;
error
= ViE.ptrViEEncryption->RegisterExternalEncryption(
tbChannel.videoChannel, testEncryption);
error = ViE.encryption->RegisterExternalEncryption(tbChannel.videoChannel,
testEncryption);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log(
"External encryption/decryption added, you should still see video");
AutoTestSleep(KAutoTestSleepTimeMs);
error
= ViE.ptrViEEncryption->DeregisterExternalEncryption(
tbChannel.videoChannel);
error = ViE.encryption->DeregisterExternalEncryption(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -481,12 +479,12 @@ int ViEAutoTest::ViEEncryptionAPITest()
//***************************************************************
// Create VIE
tbInterfaces ViE("ViEEncryptionAPITest", numberOfErrors);
TbInterfaces ViE("ViEEncryptionAPITest", numberOfErrors);
// Create a video channel
tbVideoChannel tbChannel(ViE, numberOfErrors, webrtc::kVideoCodecVP8);
// Create a capture device
tbCaptureDevice tbCapture(ViE, numberOfErrors);
TbCaptureDevice tbCapture(ViE, numberOfErrors);
// Connect to channel
tbCapture.ConnectTo(tbChannel.videoChannel);
@ -500,66 +498,66 @@ int ViEAutoTest::ViEEncryptionAPITest()
//
// Incorrect input argument, complete protection not enabled
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kNoProtection, srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryption, srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kAuthentication, srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Incorrect cipher key length
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 15,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 257,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherNull, 15, webrtc::kAuthHmacSha1,
20, 4, webrtc::kEncryptionAndAuthentication, srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherNull, 257, webrtc::kAuthHmacSha1,
20, 4, webrtc::kEncryptionAndAuthentication, srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Incorrect auth key length
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode,
30, webrtc::kAuthHmacSha1, 21, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthNull, 257, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 21, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthNull, 20, 13, webrtc::kEncryptionAndAuthentication,
srtpKey);
@ -567,7 +565,7 @@ int ViEAutoTest::ViEEncryptionAPITest()
__FUNCTION__, __LINE__);
// NULL input
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
NULL);
@ -575,105 +573,105 @@ int ViEAutoTest::ViEEncryptionAPITest()
__FUNCTION__, __LINE__);
// Double enable and disable
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// No protection
error = ViE.ptrViEEncryption->EnableSRTPSend(tbChannel.videoChannel,
error = ViE.encryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthNull, 0, 0,
webrtc::kNoProtection,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Authentication only
error = ViE.ptrViEEncryption->EnableSRTPSend(tbChannel.videoChannel,
error = ViE.encryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20, 4,
webrtc::kAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(tbChannel.videoChannel,
error = ViE.encryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 1, 4,
webrtc::kAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(tbChannel.videoChannel,
error = ViE.encryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20, 20,
webrtc::kAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(tbChannel.videoChannel,
error = ViE.encryption->EnableSRTPSend(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 1, 1,
webrtc::kAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Encryption only
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthNull, 0, 0, webrtc::kEncryption, srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 16,
webrtc::kAuthNull, 0, 0, webrtc::kEncryption, srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Full protection
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -682,66 +680,66 @@ int ViEAutoTest::ViEEncryptionAPITest()
//
// Incorrect input argument, complete protection not enabled
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kNoProtection, srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryption, srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kAuthentication, srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Incorrect cipher key length
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 15,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 257,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherNull, 15, webrtc::kAuthHmacSha1,
20, 4, webrtc::kEncryptionAndAuthentication, srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherNull, 257, webrtc::kAuthHmacSha1,
20, 4, webrtc::kEncryptionAndAuthentication, srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Incorrect auth key length
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 21, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthNull, 257, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 21, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthNull, 20, 13, webrtc::kEncryptionAndAuthentication,
srtpKey);
@ -749,7 +747,7 @@ int ViEAutoTest::ViEEncryptionAPITest()
__FUNCTION__, __LINE__);
// NULL input
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
NULL);
@ -757,34 +755,34 @@ int ViEAutoTest::ViEEncryptionAPITest()
__FUNCTION__, __LINE__);
// Double enable and disable
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPSend(
error = ViE.encryption->EnableSRTPSend(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPSend(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// No protection
error = ViE.ptrViEEncryption->EnableSRTPReceive(tbChannel.videoChannel,
error = ViE.encryption->EnableSRTPReceive(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthNull, 0, 0,
webrtc::kNoProtection,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -792,66 +790,66 @@ int ViEAutoTest::ViEEncryptionAPITest()
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(tbChannel.videoChannel,
error = ViE.encryption->EnableSRTPReceive(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 1, 4,
webrtc::kAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(tbChannel.videoChannel,
error = ViE.encryption->EnableSRTPReceive(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 20,
20, webrtc::kAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(tbChannel.videoChannel,
error = ViE.encryption->EnableSRTPReceive(tbChannel.videoChannel,
webrtc::kCipherNull, 0,
webrtc::kAuthHmacSha1, 1, 1,
webrtc::kAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Encryption only
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthNull, 0, 0, webrtc::kEncryption, srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 16,
webrtc::kAuthNull, 0, 0, webrtc::kEncryption, srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Full protection
error = ViE.ptrViEEncryption->EnableSRTPReceive(
error = ViE.encryption->EnableSRTPReceive(
tbChannel.videoChannel, webrtc::kCipherAes128CounterMode, 30,
webrtc::kAuthHmacSha1, 20, 4, webrtc::kEncryptionAndAuthentication,
srtpKey);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DisableSRTPReceive(tbChannel.videoChannel);
error = ViE.encryption->DisableSRTPReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
#endif //WEBRTC_SRTP
@ -860,19 +858,19 @@ int ViEAutoTest::ViEEncryptionAPITest()
//
ViEAutotestEncryption testEncryption;
error = ViE.ptrViEEncryption->RegisterExternalEncryption(
error = ViE.encryption->RegisterExternalEncryption(
tbChannel.videoChannel, testEncryption);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->RegisterExternalEncryption(
error = ViE.encryption->RegisterExternalEncryption(
tbChannel.videoChannel, testEncryption);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DeregisterExternalEncryption(
error = ViE.encryption->DeregisterExternalEncryption(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEEncryption->DeregisterExternalEncryption(
error = ViE.encryption->DeregisterExternalEncryption(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);

View File

@ -51,18 +51,18 @@ int ViEAutoTest::ViEFileStandardTest()
{
ViETest::Log("Starting a loopback call...");
tbInterfaces interfaces = tbInterfaces("ViEFileStandardTest",
TbInterfaces interfaces = TbInterfaces("ViEFileStandardTest",
numberOfErrors);
webrtc::VideoEngine* ptrViE = interfaces.ptrViE;
webrtc::ViEBase* ptrViEBase = interfaces.ptrViEBase;
webrtc::ViECapture* ptrViECapture = interfaces.ptrViECapture;
webrtc::ViERender* ptrViERender = interfaces.ptrViERender;
webrtc::ViECodec* ptrViECodec = interfaces.ptrViECodec;
webrtc::ViERTP_RTCP* ptrViERtpRtcp = interfaces.ptrViERtpRtcp;
webrtc::ViENetwork* ptrViENetwork = interfaces.ptrViENetwork;
webrtc::VideoEngine* ptrViE = interfaces.video_engine;
webrtc::ViEBase* ptrViEBase = interfaces.base;
webrtc::ViECapture* ptrViECapture = interfaces.capture;
webrtc::ViERender* ptrViERender = interfaces.render;
webrtc::ViECodec* ptrViECodec = interfaces.codec;
webrtc::ViERTP_RTCP* ptrViERtpRtcp = interfaces.rtp_rtcp;
webrtc::ViENetwork* ptrViENetwork = interfaces.network;
tbCaptureDevice captureDevice = tbCaptureDevice(interfaces,
TbCaptureDevice captureDevice = TbCaptureDevice(interfaces,
numberOfErrors);
int captureId = captureDevice.captureId;

View File

@ -54,11 +54,11 @@ int ViEAutoTest::ViEImageProcessStandardTest()
int rtpPort = 6000;
// Create VIE
tbInterfaces ViE("ViEImageProcessAPITest", numberOfErrors);
TbInterfaces ViE("ViEImageProcessAPITest", numberOfErrors);
// Create a video channel
tbVideoChannel tbChannel(ViE, numberOfErrors, webrtc::kVideoCodecVP8);
// Create a capture device
tbCaptureDevice tbCapture(ViE, numberOfErrors);
TbCaptureDevice tbCapture(ViE, numberOfErrors);
tbCapture.ConnectTo(tbChannel.videoChannel);
tbChannel.StartReceive(rtpPort);
@ -66,21 +66,21 @@ int ViEAutoTest::ViEImageProcessStandardTest()
MyEffectFilter effectFilter;
error = ViE.ptrViERender->AddRenderer(tbCapture.captureId, _window1, 0,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbCapture.captureId, _window1, 0,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbCapture.captureId);
error = ViE.render->StartRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbChannel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbChannel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbChannel.videoChannel);
error = ViE.render->StartRender(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -93,9 +93,8 @@ int ViEAutoTest::ViEImageProcessStandardTest()
//***************************************************************
error
= ViE.ptrViEImageProcess->RegisterCaptureEffectFilter(
tbCapture.captureId, effectFilter);
error = ViE.image_process->RegisterCaptureEffectFilter(tbCapture.captureId,
effectFilter);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -103,12 +102,12 @@ int ViEAutoTest::ViEImageProcessStandardTest()
"affects both windows");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEImageProcess->DeregisterCaptureEffectFilter(
error = ViE.image_process->DeregisterCaptureEffectFilter(
tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->RegisterRenderEffectFilter(
error = ViE.image_process->RegisterRenderEffectFilter(
tbChannel.videoChannel, effectFilter);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -118,11 +117,11 @@ int ViEAutoTest::ViEImageProcessStandardTest()
ViETest::Log("Only Window 2 should be black and white");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViERender->StopRender(tbCapture.captureId);
error = ViE.render->StopRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RemoveRenderer(tbCapture.captureId);
error = ViE.render->RemoveRenderer(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -134,16 +133,16 @@ int ViEAutoTest::ViEImageProcessStandardTest()
tbChannel2.StartReceive(rtpPort2);
tbChannel2.StartSend(rtpPort2);
error = ViE.ptrViERender->AddRenderer(tbChannel2.videoChannel, _window1, 1,
error = ViE.render->AddRenderer(tbChannel2.videoChannel, _window1, 1,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbChannel2.videoChannel);
error = ViE.render->StartRender(tbChannel2.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->DeregisterRenderEffectFilter(
error = ViE.image_process->DeregisterRenderEffectFilter(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -151,7 +150,7 @@ int ViEAutoTest::ViEImageProcessStandardTest()
ViETest::Log("Local renderer removed, added new channel and rendering in "
"Window1.");
error = ViE.ptrViEImageProcess->RegisterCaptureEffectFilter(
error = ViE.image_process->RegisterCaptureEffectFilter(
tbCapture.captureId, effectFilter);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -160,12 +159,12 @@ int ViEAutoTest::ViEImageProcessStandardTest()
"affects both windows");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEImageProcess->DeregisterCaptureEffectFilter(
error = ViE.image_process->DeregisterCaptureEffectFilter(
tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->RegisterSendEffectFilter(
error = ViE.image_process->RegisterSendEffectFilter(
tbChannel.videoChannel, effectFilter);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -175,7 +174,7 @@ int ViEAutoTest::ViEImageProcessStandardTest()
"should be black and white");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEImageProcess->DeregisterSendEffectFilter(
error = ViE.image_process->DeregisterSendEffectFilter(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -239,9 +238,9 @@ int ViEAutoTest::ViEImageProcessAPITest()
int error = 0;
int numberOfErrors = 0;
tbInterfaces ViE("ViEImageProcessAPITest", numberOfErrors);
TbInterfaces ViE("ViEImageProcessAPITest", numberOfErrors);
tbVideoChannel tbChannel(ViE, numberOfErrors, webrtc::kVideoCodecVP8);
tbCaptureDevice tbCapture(ViE, numberOfErrors);
TbCaptureDevice tbCapture(ViE, numberOfErrors);
tbCapture.ConnectTo(tbChannel.videoChannel);
@ -251,26 +250,26 @@ int ViEAutoTest::ViEImageProcessAPITest()
// Capture effect filter
//
// Add effect filter
error = ViE.ptrViEImageProcess->RegisterCaptureEffectFilter(
error = ViE.image_process->RegisterCaptureEffectFilter(
tbCapture.captureId, effectFilter);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Add again -> error
error = ViE.ptrViEImageProcess->RegisterCaptureEffectFilter(
error = ViE.image_process->RegisterCaptureEffectFilter(
tbCapture.captureId, effectFilter);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->DeregisterCaptureEffectFilter(
error = ViE.image_process->DeregisterCaptureEffectFilter(
tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Double deregister
error = ViE.ptrViEImageProcess->DeregisterCaptureEffectFilter(
error = ViE.image_process->DeregisterCaptureEffectFilter(
tbCapture.captureId);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Non-existing capture device
error = ViE.ptrViEImageProcess->RegisterCaptureEffectFilter(
error = ViE.image_process->RegisterCaptureEffectFilter(
tbChannel.videoChannel, effectFilter);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -278,24 +277,24 @@ int ViEAutoTest::ViEImageProcessAPITest()
//
// Render effect filter
//
error = ViE.ptrViEImageProcess->RegisterRenderEffectFilter(
error = ViE.image_process->RegisterRenderEffectFilter(
tbChannel.videoChannel, effectFilter);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->RegisterRenderEffectFilter(
error = ViE.image_process->RegisterRenderEffectFilter(
tbChannel.videoChannel, effectFilter);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->DeregisterRenderEffectFilter(
error = ViE.image_process->DeregisterRenderEffectFilter(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->DeregisterRenderEffectFilter(
error = ViE.image_process->DeregisterRenderEffectFilter(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Non-existing channel id
error = ViE.ptrViEImageProcess->RegisterRenderEffectFilter(
error = ViE.image_process->RegisterRenderEffectFilter(
tbCapture.captureId, effectFilter);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -303,23 +302,23 @@ int ViEAutoTest::ViEImageProcessAPITest()
//
// Send effect filter
//
error = ViE.ptrViEImageProcess->RegisterSendEffectFilter(
error = ViE.image_process->RegisterSendEffectFilter(
tbChannel.videoChannel, effectFilter);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->RegisterSendEffectFilter(
error = ViE.image_process->RegisterSendEffectFilter(
tbChannel.videoChannel, effectFilter);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->DeregisterSendEffectFilter(
error = ViE.image_process->DeregisterSendEffectFilter(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->DeregisterSendEffectFilter(
error = ViE.image_process->DeregisterSendEffectFilter(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->RegisterSendEffectFilter(
error = ViE.image_process->RegisterSendEffectFilter(
tbCapture.captureId, effectFilter);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -327,19 +326,19 @@ int ViEAutoTest::ViEImageProcessAPITest()
//
// Denoising
//
error = ViE.ptrViEImageProcess->EnableDenoising(tbCapture.captureId, true);
error = ViE.image_process->EnableDenoising(tbCapture.captureId, true);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableDenoising(tbCapture.captureId, true);
error = ViE.image_process->EnableDenoising(tbCapture.captureId, true);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableDenoising(tbCapture.captureId, false);
error = ViE.image_process->EnableDenoising(tbCapture.captureId, false);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableDenoising(tbCapture.captureId, false);
error = ViE.image_process->EnableDenoising(tbCapture.captureId, false);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableDenoising(tbChannel.videoChannel,
error = ViE.image_process->EnableDenoising(tbChannel.videoChannel,
true);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -347,23 +346,23 @@ int ViEAutoTest::ViEImageProcessAPITest()
//
// Deflickering
//
error = ViE.ptrViEImageProcess->EnableDeflickering(tbCapture.captureId,
error = ViE.image_process->EnableDeflickering(tbCapture.captureId,
true);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableDeflickering(tbCapture.captureId,
error = ViE.image_process->EnableDeflickering(tbCapture.captureId,
true);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableDeflickering(tbCapture.captureId,
error = ViE.image_process->EnableDeflickering(tbCapture.captureId,
false);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableDeflickering(tbCapture.captureId,
error = ViE.image_process->EnableDeflickering(tbCapture.captureId,
false);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableDeflickering(tbChannel.videoChannel,
error = ViE.image_process->EnableDeflickering(tbChannel.videoChannel,
true);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -371,27 +370,27 @@ int ViEAutoTest::ViEImageProcessAPITest()
//
// Color enhancement
//
error = ViE.ptrViEImageProcess->EnableColorEnhancement(
error = ViE.image_process->EnableColorEnhancement(
tbChannel.videoChannel, false);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableColorEnhancement(
error = ViE.image_process->EnableColorEnhancement(
tbChannel.videoChannel, true);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableColorEnhancement(
error = ViE.image_process->EnableColorEnhancement(
tbChannel.videoChannel, true);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableColorEnhancement(
error = ViE.image_process->EnableColorEnhancement(
tbChannel.videoChannel, false);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableColorEnhancement(
error = ViE.image_process->EnableColorEnhancement(
tbChannel.videoChannel, false);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEImageProcess->EnableColorEnhancement(tbCapture.captureId,
error = ViE.image_process->EnableColorEnhancement(tbCapture.captureId,
true);
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);

View File

@ -438,7 +438,7 @@ int VideoEngineSampleCode(void* window1, void* window2)
}
// Setting External transport
tbExternalTransport extTransport(*(ptrViENetwork));
TbExternalTransport extTransport(*(ptrViENetwork));
int testMode = 0;
std::cout << std::endl;

View File

@ -91,38 +91,38 @@ int ViEAutoTest::ViERenderStandardTest()
int numberOfErrors = 0;
int rtpPort = 6000;
tbInterfaces ViE("ViERender", numberOfErrors);
TbInterfaces ViE("ViERenderStandardTest", numberOfErrors);
// Create a video channel
tbVideoChannel tbChannel(ViE, numberOfErrors, webrtc::kVideoCodecVP8);
tbCaptureDevice tbCapture(ViE, numberOfErrors); // Create a capture device
TbCaptureDevice tbCapture(ViE, numberOfErrors); // Create a capture device
tbCapture.ConnectTo(tbChannel.videoChannel);
tbChannel.StartReceive(rtpPort);
tbChannel.StartSend(rtpPort);
error = ViE.ptrViERender->RegisterVideoRenderModule(*_vrm1);
error = ViE.render->RegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbCapture.captureId, _window1, 0,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbCapture.captureId, _window1, 0,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbCapture.captureId);
error = ViE.render->StartRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RegisterVideoRenderModule(*_vrm2);
error = ViE.render->RegisterVideoRenderModule(*_vrm2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbChannel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbChannel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbChannel.videoChannel);
error = ViE.render->StartRender(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -130,26 +130,26 @@ int ViEAutoTest::ViERenderStandardTest()
ViETest::Log("Remote stream is renderered in Window 2");
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViERender->StopRender(tbCapture.captureId);
error = ViE.render->StopRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RemoveRenderer(tbCapture.captureId);
error = ViE.render->RemoveRenderer(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// PIP and full screen rendering is not supported on Android
#ifndef WEBRTC_ANDROID
error = ViE.ptrViERender->DeRegisterVideoRenderModule(*_vrm1);
error = ViE.render->DeRegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbCapture.captureId, _window2, 0,
0.75, 0.75, 1.0, 1.0);
error = ViE.render->AddRenderer(tbCapture.captureId, _window2, 0,
0.75, 0.75, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbCapture.captureId);
error = ViE.render->StartRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -158,13 +158,13 @@ int ViEAutoTest::ViERenderStandardTest()
KAutoTestSleepTimeMs / 1000);
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViERender->RemoveRenderer(tbCapture.captureId);
error = ViE.render->RemoveRenderer(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RemoveRenderer(tbChannel.videoChannel);
error = ViE.render->RemoveRenderer(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->DeRegisterVideoRenderModule(*_vrm2);
error = ViE.render->DeRegisterVideoRenderModule(*_vrm2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -176,34 +176,34 @@ int ViEAutoTest::ViERenderStandardTest()
numberOfErrors += ViETest::TestError(_vrm1 != NULL, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RegisterVideoRenderModule(*_vrm1);
error = ViE.render->RegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbCapture.captureId, _window1, 0,
0.75f, 0.75f, 1.0f, 1.0f);
error = ViE.render->AddRenderer(tbCapture.captureId, _window1, 0,
0.75f, 0.75f, 1.0f, 1.0f);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbCapture.captureId);
error = ViE.render->StartRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbChannel.videoChannel, _window1, 1,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbChannel.videoChannel, _window1, 1,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbChannel.videoChannel);
error = ViE.render->StartRender(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViERender->RemoveRenderer(tbCapture.captureId);
error = ViE.render->RemoveRenderer(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RemoveRenderer(tbChannel.videoChannel);
error = ViE.render->RemoveRenderer(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->DeRegisterVideoRenderModule(*_vrm1);
error = ViE.render->DeRegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -256,38 +256,38 @@ int ViEAutoTest::ViERenderExtendedTest()
int numberOfErrors = 0;
int rtpPort = 6000;
tbInterfaces ViE("ViERender_API", numberOfErrors);
TbInterfaces ViE("ViERenderExtendedTest", numberOfErrors);
// Create a video channel
tbVideoChannel tbChannel(ViE, numberOfErrors, webrtc::kVideoCodecVP8);
tbCaptureDevice tbCapture(ViE, numberOfErrors); // Create a capture device
TbCaptureDevice tbCapture(ViE, numberOfErrors); // Create a capture device
tbCapture.ConnectTo(tbChannel.videoChannel);
tbChannel.StartReceive(rtpPort);
tbChannel.StartSend(rtpPort);
error = ViE.ptrViERender->RegisterVideoRenderModule(*_vrm1);
error = ViE.render->RegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbCapture.captureId, _window1, 0,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbCapture.captureId, _window1, 0,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbCapture.captureId);
error = ViE.render->StartRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RegisterVideoRenderModule(*_vrm2);
error = ViE.render->RegisterVideoRenderModule(*_vrm2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbChannel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
error = ViE.render->AddRenderer(tbChannel.videoChannel, _window2, 1,
0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbChannel.videoChannel);
error = ViE.render->StartRender(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -298,72 +298,72 @@ int ViEAutoTest::ViERenderExtendedTest()
#ifdef _WIN32
ViETest::Log("\nConfiguring Window2");
ViETest::Log("you will see video only in first quadrant");
error = ViE.ptrViERender->ConfigureRender(tbChannel.videoChannel, 0, 0.0f,
0.0f, 0.5f, 0.5f);
error = ViE.render->ConfigureRender(tbChannel.videoChannel, 0, 0.0f,
0.0f, 0.5f, 0.5f);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
ViETest::Log("you will see video only in fourth quadrant");
error = ViE.ptrViERender->ConfigureRender(tbChannel.videoChannel, 0, 0.5f,
0.5f, 1.0f, 1.0f);
error = ViE.render->ConfigureRender(tbChannel.videoChannel, 0, 0.5f,
0.5f, 1.0f, 1.0f);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
ViETest::Log("normal video on Window2");
error = ViE.ptrViERender->ConfigureRender(tbChannel.videoChannel, 0, 0.0f,
0.0f, 1.0f, 1.0f);
error = ViE.render->ConfigureRender(tbChannel.videoChannel, 0, 0.0f,
0.0f, 1.0f, 1.0f);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
#endif
ViETest::Log("Mirroring Local Preview (Window1) Left-Right");
error = ViE.ptrViERender->MirrorRenderStream(tbCapture.captureId, true,
false, true);
error = ViE.render->MirrorRenderStream(tbCapture.captureId, true,
false, true);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
ViETest::Log("\nMirroring Local Preview (Window1) Left-Right and Up-Down");
error = ViE.ptrViERender->MirrorRenderStream(tbCapture.captureId, true,
true, true);
error = ViE.render->MirrorRenderStream(tbCapture.captureId, true,
true, true);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
ViETest::Log("\nMirroring Remote Window(Window2) Up-Down");
error = ViE.ptrViERender->MirrorRenderStream(tbChannel.videoChannel, true,
true, false);
error = ViE.render->MirrorRenderStream(tbChannel.videoChannel, true,
true, false);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
ViETest::Log("Disabling Mirroing on Window1 and Window2");
error = ViE.ptrViERender->MirrorRenderStream(tbCapture.captureId, false,
false, false);
error = ViE.render->MirrorRenderStream(tbCapture.captureId, false,
false, false);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViERender->MirrorRenderStream(tbChannel.videoChannel, false,
false, false);
error = ViE.render->MirrorRenderStream(tbChannel.videoChannel, false,
false, false);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
ViETest::Log("\nEnabling Full Screen render in 5 sec");
error = ViE.ptrViERender->RemoveRenderer(tbCapture.captureId);
error = ViE.render->RemoveRenderer(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->DeRegisterVideoRenderModule(*_vrm1);
error = ViE.render->DeRegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RemoveRenderer(tbChannel.videoChannel);
error = ViE.render->RemoveRenderer(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->DeRegisterVideoRenderModule(*_vrm2);
error = ViE.render->DeRegisterVideoRenderModule(*_vrm2);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -375,19 +375,19 @@ int ViEAutoTest::ViERenderExtendedTest()
numberOfErrors += ViETest::TestError(_vrm1 != NULL, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RegisterVideoRenderModule(*_vrm1);
error = ViE.render->RegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->AddRenderer(tbCapture.captureId, _window1, 0,
0.0f, 0.0f, 1.0f, 1.0f);
error = ViE.render->AddRenderer(tbCapture.captureId, _window1, 0,
0.0f, 0.0f, 1.0f, 1.0f);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbCapture.captureId);
error = ViE.render->StartRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViERender->StopRender(tbCapture.captureId);
error = ViE.render->StopRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -396,7 +396,7 @@ int ViEAutoTest::ViERenderExtendedTest()
*/
ViETest::Log("\nStop renderer");
error = ViE.ptrViERender->RemoveRenderer(tbCapture.captureId);
error = ViE.render->RemoveRenderer(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -405,7 +405,7 @@ int ViEAutoTest::ViERenderExtendedTest()
*/
ViETest::Log("\nRemove renderer");
error = ViE.ptrViERender->DeRegisterVideoRenderModule(*_vrm1);
error = ViE.render->DeRegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -417,30 +417,30 @@ int ViEAutoTest::ViERenderExtendedTest()
numberOfErrors += ViETest::TestError(_vrm1 != NULL, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RegisterVideoRenderModule(*_vrm1);
error = ViE.render->RegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViETest::Log("\nExternal Render Test");
ViEAutoTestExternalRenderer externalRenderObj;
error = ViE.ptrViERender->AddRenderer(tbCapture.captureId,
error = ViE.render->AddRenderer(tbCapture.captureId,
webrtc::kVideoI420,
&externalRenderObj);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->StartRender(tbCapture.captureId);
error = ViE.render->StartRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViERender->StopRender(tbCapture.captureId);
error = ViE.render->StopRender(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->RemoveRenderer(tbCapture.captureId);
error = ViE.render->RemoveRenderer(tbCapture.captureId);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERender->DeRegisterVideoRenderModule(*_vrm1);
error = ViE.render->DeRegisterVideoRenderModule(*_vrm1);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);

View File

@ -102,19 +102,19 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
int numberOfErrors = 0;
// Create VIE
tbInterfaces ViE("ViERtpRtcpStandardTest", numberOfErrors);
TbInterfaces ViE("ViERtpRtcpStandardTest", numberOfErrors);
// Create a video channel
tbVideoChannel tbChannel(ViE, numberOfErrors, webrtc::kVideoCodecVP8);
// Create a capture device
tbCaptureDevice tbCapture(ViE, numberOfErrors);
TbCaptureDevice tbCapture(ViE, numberOfErrors);
tbCapture.ConnectTo(tbChannel.videoChannel);
ViETest::Log("\n");
tbExternalTransport myTransport(*(ViE.ptrViENetwork));
TbExternalTransport myTransport(*(ViE.network));
error = ViE.ptrViENetwork->RegisterSendTransport(tbChannel.videoChannel,
myTransport);
error = ViE.network->RegisterSendTransport(tbChannel.videoChannel,
myTransport);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -124,18 +124,18 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
unsigned short startSequenceNumber = 12345;
ViETest::Log("Set start sequence number: %u", startSequenceNumber);
error = ViE.ptrViERtpRtcp->SetStartSequenceNumber(tbChannel.videoChannel,
startSequenceNumber);
error = ViE.rtp_rtcp->SetStartSequenceNumber(tbChannel.videoChannel,
startSequenceNumber);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
myTransport.EnableSequenceNumberCheck();
error = ViE.ptrViEBase->StartReceive(tbChannel.videoChannel);
error = ViE.base->StartReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(tbChannel.videoChannel);
error = ViE.base->StartSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(2000);
@ -148,7 +148,7 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
receivedSequenceNumber == startSequenceNumber, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StopSend(tbChannel.videoChannel);
error = ViE.base->StopSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -157,21 +157,20 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
//
ViETest::Log("Testing CName\n");
const char* sendCName = "ViEAutoTestCName\0";
error = ViE.ptrViERtpRtcp->SetRTCPCName(tbChannel.videoChannel, sendCName);
error = ViE.rtp_rtcp->SetRTCPCName(tbChannel.videoChannel, sendCName);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
char returnCName[webrtc::ViERTP_RTCP::KMaxRTCPCNameLength];
memset(returnCName, 0, webrtc::ViERTP_RTCP::KMaxRTCPCNameLength);
error = ViE.ptrViERtpRtcp->GetRTCPCName(tbChannel.videoChannel,
returnCName);
error = ViE.rtp_rtcp->GetRTCPCName(tbChannel.videoChannel, returnCName);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError((strcmp(sendCName, returnCName) == 0),
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
error = ViE.ptrViEBase->StartSend(tbChannel.videoChannel);
error = ViE.base->StartSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -179,8 +178,8 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
char remoteCName[webrtc::ViERTP_RTCP::KMaxRTCPCNameLength];
memset(remoteCName, 0, webrtc::ViERTP_RTCP::KMaxRTCPCNameLength);
error = ViE.ptrViERtpRtcp->GetRemoteRTCPCName(tbChannel.videoChannel,
remoteCName);
error = ViE.rtp_rtcp->GetRemoteRTCPCName(tbChannel.videoChannel,
remoteCName);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError((strcmp(sendCName, remoteCName) == 0),
@ -192,11 +191,11 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
//
// Stop and restart to clear stats
ViETest::Log("Testing statistics\n");
error = ViE.ptrViEBase->StopReceive(tbChannel.videoChannel);
error = ViE.base->StopReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StopSend(tbChannel.videoChannel);
error = ViE.base->StopSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -206,16 +205,16 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
// Start send to verify sending stats
error = ViE.ptrViERtpRtcp->SetStartSequenceNumber(tbChannel.videoChannel,
startSequenceNumber);
error = ViE.rtp_rtcp->SetStartSequenceNumber(tbChannel.videoChannel,
startSequenceNumber);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(tbChannel.videoChannel);
error = ViE.base->StartSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartReceive(tbChannel.videoChannel);
error = ViE.base->StartReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -237,11 +236,11 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
unsigned int sentFecBitrate = 0;
unsigned int sentNackBitrate = 0;
error = ViE.ptrViERtpRtcp->GetBandwidthUsage(tbChannel.videoChannel,
sentTotalBitrate,
sentVideoBitrate,
sentFecBitrate,
sentNackBitrate);
error = ViE.rtp_rtcp->GetBandwidthUsage(tbChannel.videoChannel,
sentTotalBitrate,
sentVideoBitrate,
sentFecBitrate,
sentNackBitrate);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -251,28 +250,30 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StopReceive(tbChannel.videoChannel);
error = ViE.base->StopReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(2000);
error = ViE.ptrViERtpRtcp->GetSentRTCPStatistics(tbChannel.videoChannel,
sentFractionsLost,
sentCumulativeLost,
sentExtendedMax,
sentJitter, sentRttMs);
error = ViE.rtp_rtcp->GetSentRTCPStatistics(tbChannel.videoChannel,
sentFractionsLost,
sentCumulativeLost,
sentExtendedMax,
sentJitter,
sentRttMs);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError((sentCumulativeLost > 0
&& sentExtendedMax > startSequenceNumber && sentJitter > 0 && sentRttMs
> 0), "ERROR: %s at line %d", __FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->GetReceivedRTCPStatistics(tbChannel.videoChannel,
recFractionsLost,
recCumulativeLost,
recExtendedMax,
recJitter, recRttMs);
error = ViE.rtp_rtcp->GetReceivedRTCPStatistics(tbChannel.videoChannel,
recFractionsLost,
recCumulativeLost,
recExtendedMax,
recJitter,
recRttMs);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(
@ -286,7 +287,7 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
error = ViE.ptrViEBase->StopSend(tbChannel.videoChannel);
error = ViE.base->StopSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -297,25 +298,24 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
myTransport.ClearStats();
myTransport.SetPacketLoss(rate);
error = ViE.ptrViERtpRtcp->SetFECStatus(tbChannel.videoChannel,
true, 96, 97);
error = ViE.rtp_rtcp->SetFECStatus(tbChannel.videoChannel, true, 96, 97);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartReceive(tbChannel.videoChannel);
error = ViE.base->StartReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(tbChannel.videoChannel);
error = ViE.base->StartSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViERtpRtcp->GetBandwidthUsage(tbChannel.videoChannel,
sentTotalBitrate,
sentVideoBitrate,
sentFecBitrate,
sentNackBitrate);
error = ViE.rtp_rtcp->GetBandwidthUsage(tbChannel.videoChannel,
sentTotalBitrate,
sentVideoBitrate,
sentFecBitrate,
sentNackBitrate);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -325,27 +325,26 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StopSend(tbChannel.videoChannel);
error = ViE.base->StopSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetFECStatus(tbChannel.videoChannel,
false, 96, 97);
error = ViE.ptrViERtpRtcp->SetNACKStatus(tbChannel.videoChannel, true);
error = ViE.rtp_rtcp->SetFECStatus(tbChannel.videoChannel, false, 96, 97);
error = ViE.rtp_rtcp->SetNACKStatus(tbChannel.videoChannel, true);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(tbChannel.videoChannel);
error = ViE.base->StartSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViERtpRtcp->GetBandwidthUsage(tbChannel.videoChannel,
sentTotalBitrate,
sentVideoBitrate,
sentFecBitrate,
sentNackBitrate);
error = ViE.rtp_rtcp->GetBandwidthUsage(tbChannel.videoChannel,
sentTotalBitrate,
sentVideoBitrate,
sentFecBitrate,
sentNackBitrate);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -357,11 +356,11 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
// __FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StopReceive(tbChannel.videoChannel);
error = ViE.base->StopReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetNACKStatus(tbChannel.videoChannel, false);
error = ViE.rtp_rtcp->SetNACKStatus(tbChannel.videoChannel, false);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -369,10 +368,10 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
// Keepalive
//
ViETest::Log("Testing RTP keep alive...\n");
error = ViE.ptrViEBase->StopSend(tbChannel.videoChannel);
error = ViE.base->StopSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartReceive(tbChannel.videoChannel);
error = ViE.base->StartReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -381,17 +380,19 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
const char keepAlivePT = 109;
unsigned int deltaTimeSeconds = 2;
error = ViE.ptrViERtpRtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
true, keepAlivePT,
deltaTimeSeconds);
error = ViE.rtp_rtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
true,
keepAlivePT,
deltaTimeSeconds);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViERtpRtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
false, keepAlivePT,
deltaTimeSeconds);
error = ViE.rtp_rtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
false,
keepAlivePT,
deltaTimeSeconds);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -408,15 +409,15 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
// Test to set SSRC
unsigned int setSSRC = 0x01234567;
ViETest::Log("Set SSRC %u", setSSRC);
error = ViE.ptrViERtpRtcp->SetLocalSSRC(tbChannel.videoChannel, setSSRC);
error = ViE.rtp_rtcp->SetLocalSSRC(tbChannel.videoChannel, setSSRC);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartReceive(tbChannel.videoChannel);
error = ViE.base->StartReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(tbChannel.videoChannel);
error = ViE.base->StartSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -430,7 +431,7 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
__LINE__);
unsigned int localSSRC = 0;
error = ViE.ptrViERtpRtcp->GetLocalSSRC(tbChannel.videoChannel, localSSRC);
error = ViE.rtp_rtcp->GetLocalSSRC(tbChannel.videoChannel, localSSRC);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(localSSRC == setSSRC,
@ -438,15 +439,14 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
__LINE__);
unsigned int remoteSSRC = 0;
error
= ViE.ptrViERtpRtcp->GetRemoteSSRC(tbChannel.videoChannel, remoteSSRC);
error = ViE.rtp_rtcp->GetRemoteSSRC(tbChannel.videoChannel, remoteSSRC);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(remoteSSRC == setSSRC,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
error = ViE.ptrViEBase->StopSend(tbChannel.videoChannel);
error = ViE.base->StopSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -461,33 +461,35 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
const char* outDumpName = "OutgoingRTPDump.rtp";
#endif
error = ViE.ptrViERtpRtcp->StartRTPDump(tbChannel.videoChannel, inDumpName,
webrtc::kRtpIncoming);
error = ViE.rtp_rtcp->StartRTPDump(tbChannel.videoChannel,
inDumpName,
webrtc::kRtpIncoming);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->StartRTPDump(tbChannel.videoChannel,
outDumpName, webrtc::kRtpOutgoing);
error = ViE.rtp_rtcp->StartRTPDump(tbChannel.videoChannel,
outDumpName,
webrtc::kRtpOutgoing);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(tbChannel.videoChannel);
error = ViE.base->StartSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(KAutoTestSleepTimeMs);
error = ViE.ptrViEBase->StopSend(tbChannel.videoChannel);
error = ViE.base->StopSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
AutoTestSleep(1000);
error = ViE.ptrViERtpRtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpIncoming);
error = ViE.rtp_rtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpIncoming);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpOutgoing);
error = ViE.rtp_rtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpOutgoing);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -508,7 +510,7 @@ int ViEAutoTest::ViERtpRtcpStandardTest()
__LINE__);
// Deregister external transport
error = ViE.ptrViENetwork->DeregisterSendTransport(tbChannel.videoChannel);
error = ViE.network->DeregisterSendTransport(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -552,27 +554,27 @@ int ViEAutoTest::ViERtpRtcpExtendedTest()
numberOfErrors = ViERtpRtcpStandardTest();
// Create VIE
tbInterfaces ViE("ViERtpRtcpStandardTest", numberOfErrors);
TbInterfaces ViE("ViERtpRtcpExtendedTest", numberOfErrors);
// Create a video channel
tbVideoChannel tbChannel(ViE, numberOfErrors, webrtc::kVideoCodecVP8);
// Create a capture device
tbCaptureDevice tbCapture(ViE, numberOfErrors);
TbCaptureDevice tbCapture(ViE, numberOfErrors);
tbCapture.ConnectTo(tbChannel.videoChannel);
//tbChannel.StartReceive(rtpPort);
//tbChannel.StartSend(rtpPort);
tbExternalTransport myTransport(*(ViE.ptrViENetwork));
TbExternalTransport myTransport(*(ViE.network));
error = ViE.ptrViENetwork->RegisterSendTransport(tbChannel.videoChannel,
myTransport);
error = ViE.network->RegisterSendTransport(tbChannel.videoChannel,
myTransport);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartReceive(tbChannel.videoChannel);
error = ViE.base->StartReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(tbChannel.videoChannel);
error = ViE.base->StartSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -587,8 +589,8 @@ int ViEAutoTest::ViERtpRtcpExtendedTest()
//
ViERtcpObserver rtcpObserver;
error = ViE.ptrViERtpRtcp->RegisterRTCPObserver(tbChannel.videoChannel,
rtcpObserver);
error = ViE.rtp_rtcp->RegisterRTCPObserver(tbChannel.videoChannel,
rtcpObserver);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -597,7 +599,7 @@ int ViEAutoTest::ViERtpRtcpExtendedTest()
const char* data = "ViEAutoTest Data of length 32 --";
const unsigned short numBytes = 32;
error = ViE.ptrViERtpRtcp->SendApplicationDefinedRTCPPacket(
error = ViE.rtp_rtcp->SendApplicationDefinedRTCPPacket(
tbChannel.videoChannel, subType, name, data, numBytes);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -617,14 +619,14 @@ int ViEAutoTest::ViERtpRtcpExtendedTest()
//***************************************************************
error = ViE.ptrViEBase->StopReceive(tbChannel.videoChannel);
error = ViE.base->StopReceive(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StopSend(tbChannel.videoChannel);
error = ViE.base->StopSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViENetwork->DeregisterSendTransport(tbChannel.videoChannel);
error = ViE.network->DeregisterSendTransport(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -661,11 +663,11 @@ int ViEAutoTest::ViERtpRtcpAPITest()
int numberOfErrors = 0;
// Create VIE
tbInterfaces ViE("ViERtpRtcpAPITest", numberOfErrors);
TbInterfaces ViE("ViERtpRtcpAPITest", numberOfErrors);
// Create a video channel
tbVideoChannel tbChannel(ViE, numberOfErrors, webrtc::kVideoCodecVP8);
// Create a capture device
tbCaptureDevice tbCapture(ViE, numberOfErrors);
TbCaptureDevice tbCapture(ViE, numberOfErrors);
tbCapture.ConnectTo(tbChannel.videoChannel);
//***************************************************************
@ -677,44 +679,48 @@ int ViEAutoTest::ViERtpRtcpAPITest()
// Check different RTCP modes
//
webrtc::ViERTCPMode rtcpMode = webrtc::kRtcpNone;
error = ViE.ptrViERtpRtcp->GetRTCPStatus(tbChannel.videoChannel, rtcpMode);
error = ViE.rtp_rtcp->GetRTCPStatus(tbChannel.videoChannel,
rtcpMode);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(
rtcpMode == webrtc::kRtcpCompound_RFC4585,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetRTCPStatus(tbChannel.videoChannel,
webrtc::kRtcpCompound_RFC4585);
error = ViE.rtp_rtcp->SetRTCPStatus(tbChannel.videoChannel,
webrtc::kRtcpCompound_RFC4585);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->GetRTCPStatus(tbChannel.videoChannel, rtcpMode);
error = ViE.rtp_rtcp->GetRTCPStatus(tbChannel.videoChannel,
rtcpMode);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(
rtcpMode == webrtc::kRtcpCompound_RFC4585,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetRTCPStatus(tbChannel.videoChannel,
webrtc::kRtcpNonCompound_RFC5506);
error = ViE.rtp_rtcp->SetRTCPStatus(tbChannel.videoChannel,
webrtc::kRtcpNonCompound_RFC5506);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->GetRTCPStatus(tbChannel.videoChannel, rtcpMode);
error = ViE.rtp_rtcp->GetRTCPStatus(tbChannel.videoChannel,
rtcpMode);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(
rtcpMode == webrtc::kRtcpNonCompound_RFC5506, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetRTCPStatus(tbChannel.videoChannel,
webrtc::kRtcpNone);
error = ViE.rtp_rtcp->SetRTCPStatus(tbChannel.videoChannel,
webrtc::kRtcpNone);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->GetRTCPStatus(tbChannel.videoChannel, rtcpMode);
error = ViE.rtp_rtcp->GetRTCPStatus(tbChannel.videoChannel,
rtcpMode);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(rtcpMode == webrtc::kRtcpNone,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
error = ViE.ptrViERtpRtcp->SetRTCPStatus(tbChannel.videoChannel,
webrtc::kRtcpCompound_RFC4585);
error = ViE.rtp_rtcp->SetRTCPStatus(tbChannel.videoChannel,
webrtc::kRtcpCompound_RFC4585);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -723,13 +729,13 @@ int ViEAutoTest::ViERtpRtcpAPITest()
// Start sequence number is tested in SimplTEst
//
const char* testCName = "ViEAutotestCName";
error = ViE.ptrViERtpRtcp->SetRTCPCName(tbChannel.videoChannel, testCName);
error = ViE.rtp_rtcp->SetRTCPCName(tbChannel.videoChannel,
testCName);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
char returnCName[256];
memset(returnCName, 0, 256);
error
= ViE.ptrViERtpRtcp->GetRTCPCName(tbChannel.videoChannel, returnCName);
error = ViE.rtp_rtcp->GetRTCPCName(tbChannel.videoChannel, returnCName);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError((strcmp(testCName, returnCName) == 0),
@ -739,25 +745,25 @@ int ViEAutoTest::ViERtpRtcpAPITest()
//
// SSRC
//
error = ViE.ptrViERtpRtcp->SetLocalSSRC(tbChannel.videoChannel, 0x01234567);
error = ViE.rtp_rtcp->SetLocalSSRC(tbChannel.videoChannel,
0x01234567);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetLocalSSRC(tbChannel.videoChannel, 0x76543210);
error = ViE.rtp_rtcp->SetLocalSSRC(tbChannel.videoChannel,
0x76543210);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
unsigned int ssrc = 0;
error = ViE.ptrViERtpRtcp->GetLocalSSRC(tbChannel.videoChannel, ssrc);
error = ViE.rtp_rtcp->GetLocalSSRC(tbChannel.videoChannel, ssrc);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetStartSequenceNumber(tbChannel.videoChannel,
1000);
error = ViE.rtp_rtcp->SetStartSequenceNumber(tbChannel.videoChannel, 1000);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
tbChannel.StartSend();
error = ViE.ptrViERtpRtcp->SetStartSequenceNumber(tbChannel.videoChannel,
12345);
error = ViE.rtp_rtcp->SetStartSequenceNumber(tbChannel.videoChannel, 12345);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
tbChannel.StopSend();
@ -765,17 +771,14 @@ int ViEAutoTest::ViERtpRtcpAPITest()
//
// Start sequence number
//
error = ViE.ptrViERtpRtcp->SetStartSequenceNumber(tbChannel.videoChannel,
12345);
error = ViE.rtp_rtcp->SetStartSequenceNumber(tbChannel.videoChannel, 12345);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetStartSequenceNumber(tbChannel.videoChannel,
1000);
error = ViE.rtp_rtcp->SetStartSequenceNumber(tbChannel.videoChannel, 1000);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
tbChannel.StartSend();
error = ViE.ptrViERtpRtcp->SetStartSequenceNumber(tbChannel.videoChannel,
12345);
error = ViE.rtp_rtcp->SetStartSequenceNumber(tbChannel.videoChannel, 12345);
numberOfErrors += ViETest::TestError(error == -1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
tbChannel.StopSend();
@ -790,38 +793,38 @@ int ViEAutoTest::ViERtpRtcpAPITest()
const unsigned short numBytes = 32;
tbChannel.StartSend();
error = ViE.ptrViERtpRtcp->SendApplicationDefinedRTCPPacket(
error = ViE.rtp_rtcp->SendApplicationDefinedRTCPPacket(
tbChannel.videoChannel, subType, name, data, numBytes);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SendApplicationDefinedRTCPPacket(
error = ViE.rtp_rtcp->SendApplicationDefinedRTCPPacket(
tbChannel.videoChannel, subType, name, NULL, numBytes);
// NULL input
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SendApplicationDefinedRTCPPacket(
error = ViE.rtp_rtcp->SendApplicationDefinedRTCPPacket(
tbChannel.videoChannel, subType, name, data, numBytes - 1);
// incorrect length
numberOfErrors += ViETest::TestError(error != 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->GetRTCPStatus(tbChannel.videoChannel,
rtcpMode);
error = ViE.rtp_rtcp->GetRTCPStatus(tbChannel.videoChannel,
rtcpMode);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SendApplicationDefinedRTCPPacket(
error = ViE.rtp_rtcp->SendApplicationDefinedRTCPPacket(
tbChannel.videoChannel, subType, name, data, numBytes);
// RTCP off
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetRTCPStatus(tbChannel.videoChannel,
webrtc::kRtcpCompound_RFC4585);
error = ViE.rtp_rtcp->SetRTCPStatus(tbChannel.videoChannel,
webrtc::kRtcpCompound_RFC4585);
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
tbChannel.StopSend();
error = ViE.ptrViERtpRtcp->SendApplicationDefinedRTCPPacket(
error = ViE.rtp_rtcp->SendApplicationDefinedRTCPPacket(
tbChannel.videoChannel, subType, name, data, numBytes);
// Not sending
numberOfErrors += ViETest::TestError(error != 0,
@ -844,60 +847,56 @@ int ViEAutoTest::ViERtpRtcpAPITest()
bool enabled = false;
char getPT = 0;
unsigned int getDeltaTime = 0;
error = ViE.ptrViERtpRtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
true, 119);
error = ViE.rtp_rtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
true, 119);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
true, setPT,
setDeltaTime);
error = ViE.rtp_rtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
true, setPT, setDeltaTime);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
false, setPT,
setDeltaTime);
error = ViE.rtp_rtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
false, setPT, setDeltaTime);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
true, setPT,
setDeltaTime);
error = ViE.rtp_rtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
true, setPT, setDeltaTime);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->GetRTPKeepAliveStatus(tbChannel.videoChannel,
enabled, getPT,
getDeltaTime);
error = ViE.rtp_rtcp->GetRTPKeepAliveStatus(tbChannel.videoChannel,
enabled, getPT,
getDeltaTime);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError((enabled == true && setPT == getPT
&& setDeltaTime == getDeltaTime),
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
&& setDeltaTime == getDeltaTime),
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViEBase->StartSend(tbChannel.videoChannel);
error = ViE.base->StartSend(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
true, setPT,
setDeltaTime);
error = ViE.rtp_rtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
true, setPT, setDeltaTime);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
tbChannel.StopSend();
error = ViE.ptrViERtpRtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
enabled, getPT, 0);
error = ViE.rtp_rtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
enabled, getPT, 0);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
enabled, getPT, 61);
error = ViE.rtp_rtcp->SetRTPKeepAliveStatus(tbChannel.videoChannel,
enabled, getPT, 61);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -911,40 +910,42 @@ int ViEAutoTest::ViERtpRtcpAPITest()
#else
const char* dumpName = "DumpFileName.rtp";
#endif
error = ViE.ptrViERtpRtcp->StartRTPDump(tbChannel.videoChannel,
dumpName, webrtc::kRtpIncoming);
error = ViE.rtp_rtcp->StartRTPDump(tbChannel.videoChannel,
dumpName,
webrtc::kRtpIncoming);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpIncoming);
error = ViE.rtp_rtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpIncoming);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpIncoming);
error = ViE.rtp_rtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpIncoming);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->StartRTPDump(tbChannel.videoChannel,
dumpName, webrtc::kRtpOutgoing);
error = ViE.rtp_rtcp->StartRTPDump(tbChannel.videoChannel,
dumpName,
webrtc::kRtpOutgoing);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpOutgoing);
error = ViE.rtp_rtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpOutgoing);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpOutgoing);
error = ViE.rtp_rtcp->StopRTPDump(tbChannel.videoChannel,
webrtc::kRtpOutgoing);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->StartRTPDump(tbChannel.videoChannel,
dumpName,
(webrtc::RTPDirections) 3);
error = ViE.rtp_rtcp->StartRTPDump(tbChannel.videoChannel,
dumpName,
(webrtc::RTPDirections) 3);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -954,45 +955,43 @@ int ViEAutoTest::ViERtpRtcpAPITest()
//
{
ViERtpObserver rtpObserver;
error = ViE.ptrViERtpRtcp->RegisterRTPObserver(tbChannel.videoChannel,
rtpObserver);
error = ViE.rtp_rtcp->RegisterRTPObserver(tbChannel.videoChannel,
rtpObserver);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->RegisterRTPObserver(tbChannel.videoChannel,
rtpObserver);
error = ViE.rtp_rtcp->RegisterRTPObserver(tbChannel.videoChannel,
rtpObserver);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->DeregisterRTPObserver(
error = ViE.rtp_rtcp->DeregisterRTPObserver(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->DeregisterRTPObserver(
error = ViE.rtp_rtcp->DeregisterRTPObserver(
tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViERtcpObserver rtcpObserver;
error = ViE.ptrViERtpRtcp->RegisterRTCPObserver(tbChannel.videoChannel,
rtcpObserver);
error = ViE.rtp_rtcp->RegisterRTCPObserver(tbChannel.videoChannel,
rtcpObserver);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->RegisterRTCPObserver(tbChannel.videoChannel,
rtcpObserver);
error = ViE.rtp_rtcp->
RegisterRTCPObserver(tbChannel.videoChannel, rtcpObserver);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->DeregisterRTCPObserver(
tbChannel.videoChannel);
error = ViE.rtp_rtcp->DeregisterRTCPObserver(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->DeregisterRTCPObserver(
tbChannel.videoChannel);
error = ViE.rtp_rtcp->DeregisterRTCPObserver(tbChannel.videoChannel);
numberOfErrors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -1001,22 +1000,22 @@ int ViEAutoTest::ViERtpRtcpAPITest()
// PLI
//
{
error = ViE.ptrViERtpRtcp->SetKeyFrameRequestMethod(
error = ViE.rtp_rtcp->SetKeyFrameRequestMethod(
tbChannel.videoChannel, webrtc::kViEKeyFrameRequestPliRtcp);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetKeyFrameRequestMethod(
error = ViE.rtp_rtcp->SetKeyFrameRequestMethod(
tbChannel.videoChannel, webrtc::kViEKeyFrameRequestPliRtcp);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetKeyFrameRequestMethod(
error = ViE.rtp_rtcp->SetKeyFrameRequestMethod(
tbChannel.videoChannel, webrtc::kViEKeyFrameRequestNone);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.ptrViERtpRtcp->SetKeyFrameRequestMethod(
error = ViE.rtp_rtcp->SetKeyFrameRequestMethod(
tbChannel.videoChannel, webrtc::kViEKeyFrameRequestNone);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
@ -1026,7 +1025,8 @@ int ViEAutoTest::ViERtpRtcpAPITest()
// NACK
//
{
error = ViE.ptrViERtpRtcp->SetNACKStatus(tbChannel.videoChannel, true);
error = ViE.rtp_rtcp->SetNACKStatus(tbChannel.videoChannel,
true);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);

View File

@ -8,20 +8,9 @@
* be found in the AUTHORS file in the root of the source tree.
*/
//
// vie_autotest_simulcast.cc
//
// This code is also used as sample code for ViE 3.0
//
#include "vie_autotest_defines.h"
#include "vie_autotest.h"
// ===================================================================
//
// BEGIN: VideoEngine 3.0 Sample Code
//
#include "common_types.h"
#include "voe_base.h"
#include "vie_base.h"
@ -316,19 +305,19 @@ int VideoEngineSimulcastTest(void* window1, void* window2)
videoCodec.simulcastStream[0].height = 180;
videoCodec.simulcastStream[0].numberOfTemporalLayers = 0;
videoCodec.simulcastStream[0].maxBitrate = 100;
videoCodec.simulcastStream[0].qpMax = videoCodec.qpMax;
videoCodec.simulcastStream[0].qpMax = videoCodec.qpMax;
videoCodec.simulcastStream[1].width = 640;
videoCodec.simulcastStream[1].height = 360;
videoCodec.simulcastStream[1].numberOfTemporalLayers = 0;
videoCodec.simulcastStream[1].maxBitrate = 500;
videoCodec.simulcastStream[1].qpMax = videoCodec.qpMax;
videoCodec.simulcastStream[1].qpMax = videoCodec.qpMax;
videoCodec.simulcastStream[2].width = 1280;
videoCodec.simulcastStream[2].height = 720;
videoCodec.simulcastStream[2].numberOfTemporalLayers = 0;
videoCodec.simulcastStream[2].maxBitrate = 1200;
videoCodec.simulcastStream[2].qpMax = videoCodec.qpMax;
videoCodec.simulcastStream[2].qpMax = videoCodec.qpMax;
// Set start bit rate
std::string str;
@ -359,7 +348,7 @@ int VideoEngineSimulcastTest(void* window1, void* window2)
}
// Setting External transport
tbExternalTransport extTransport(*(ptrViENetwork));
TbExternalTransport extTransport(*(ptrViENetwork));
error = ptrViENetwork->RegisterSendTransport(videoChannel,
extTransport);
@ -408,7 +397,7 @@ int VideoEngineSimulcastTest(void* window1, void* window2)
//********************************************************
printf("\nSimulcast call started\n\n");
do
do
{
printf("Enter new SSRC filter 1,2 or 3\n");
printf("Press enter to stop...");

View File

@ -0,0 +1,140 @@
/*
* 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_comparison_tests.h"
#include "base_primitives.h"
#include "codec_primitives.h"
#include "general_primitives.h"
#include "tb_interfaces.h"
#include "vie_autotest_defines.h"
#include "vie_fake_camera.h"
#include "vie_to_file_renderer.h"
ViEComparisonTests::ViEComparisonTests() {
ViETest::Init(ViETest::kUseGTestExpectsForTestErrors);
}
ViEComparisonTests::~ViEComparisonTests() {
ViETest::Terminate();
}
void ViEComparisonTests::TestCallSetup(
const std::string& i420_test_video_path,
int width,
int height,
ViEToFileRenderer* local_file_renderer,
ViEToFileRenderer* remote_file_renderer) {
int ignored;
TbInterfaces interfaces("TestCallSetup", ignored);
int video_channel = -1;
int error = interfaces.base->CreateChannel(video_channel);
ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ViEFakeCamera fake_camera(interfaces.capture);
if (!fake_camera.StartCameraInNewThread(i420_test_video_path,
width,
height)) {
// No point in continuing if we have no proper video source
ViETest::TestError(false, "ERROR: %s at line %d: "
"Could not open input video %s: aborting test...",
__FUNCTION__, __LINE__, i420_test_video_path.c_str());
return;
}
int capture_id = fake_camera.capture_id();
// Apparently, we need to connect external capture devices, but we should
// not start them since the external device is not a proper device.
error = interfaces.capture->ConnectCaptureDevice(capture_id,
video_channel);
ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ConfigureRtpRtcp(interfaces.rtp_rtcp, &ignored, video_channel);
webrtc::ViERender *render_interface = interfaces.render;
RenderToFile(render_interface, capture_id, local_file_renderer);
RenderToFile(render_interface, video_channel, remote_file_renderer);
// Run the test itself:
const WebRtc_UWord8* device_name =
reinterpret_cast<const WebRtc_UWord8*>("Fake Capture Device");
::TestI420CallSetup(interfaces.codec, interfaces.video_engine,
interfaces.base, interfaces.network,
&ignored, video_channel, device_name);
AutoTestSleep(KAutoTestSleepTimeMs);
error = interfaces.base->StopReceive(video_channel);
ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
StopAndRemoveRenderers(interfaces.base, render_interface, &ignored,
video_channel, capture_id);
interfaces.capture->DisconnectCaptureDevice(video_channel);
// Stop sending data, clean up the camera thread and release the capture
// device. Note that this all happens after StopEverything, so this
// tests that the system doesn't mind that the external capture device sends
// data after rendering has been stopped.
fake_camera.StopCamera();
error = interfaces.base->DeleteChannel(video_channel);
ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
}
void ViEComparisonTests::TestCodecs(
const std::string& i420_video_file,
int width,
int height,
ViEToFileRenderer* local_file_renderer,
ViEToFileRenderer* remote_file_renderer) {
int ignored = 0;
TbInterfaces interfaces = TbInterfaces("TestCodecs", ignored);
ViEFakeCamera fake_camera(interfaces.capture);
if (!fake_camera.StartCameraInNewThread(i420_video_file, width, height)) {
// No point in continuing if we have no proper video source
ViETest::TestError(false, "ERROR: %s at line %d: "
"Could not open input video %s: aborting test...",
__FUNCTION__, __LINE__, i420_video_file.c_str());
return;
}
int video_channel = -1;
int capture_id = fake_camera.capture_id();
int error = interfaces.base->CreateChannel(video_channel);
ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = interfaces.capture->ConnectCaptureDevice(capture_id, video_channel);
ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
ConfigureRtpRtcp(interfaces.rtp_rtcp, &ignored, video_channel);
RenderToFile(interfaces.render, capture_id, local_file_renderer);
RenderToFile(interfaces.render, video_channel, remote_file_renderer);
// Force the codec resolution to what our input video is so we can make
// comparisons later. Our comparison algorithms wouldn't like scaling.
::TestCodecs(interfaces, ignored, fake_camera.capture_id(), video_channel,
width, height);
fake_camera.StopCamera();
}

View File

@ -24,6 +24,7 @@
'include_dirs': [
'interface/',
'helpers/',
'primitives',
'../../interface',
'../../source',
'../../../../modules/video_coding/codecs/interface/',
@ -52,10 +53,16 @@
# New, fully automated tests
'automated/vie_api_integration_test.cc',
'automated/vie_comparison_test.cc',
'automated/vie_extended_integration_test.cc',
'automated/vie_integration_test_base.cc',
'automated/vie_standard_integration_test.cc',
# Test primitives
'primitives/base_primitives.cc',
'primitives/codec_primitives.cc',
'primitives/general_primitives.cc',
# Platform independent
'source/tb_capture_device.cc',
'source/tb_external_transport.cc',
@ -76,6 +83,7 @@
'source/vie_autotest_rtp_rtcp.cc',
'source/vie_autotest_custom_call.cc',
'source/vie_autotest_simulcast.cc',
'source/vie_comparison_tests.cc',
# Platform dependent
# Linux

View File

@ -1176,7 +1176,7 @@ void CDXChannelDlg::OnBnClickedExttransport()
m_remoteIp1.EnableWindow(FALSE);
m_ctrlPacketLoss.EnableWindow(TRUE);
m_ctrlDelay.EnableWindow(TRUE);
_externalTransport= new tbExternalTransport(*_vieNetwork);
_externalTransport= new TbExternalTransport(*_vieNetwork);
_vieNetwork->RegisterSendTransport(_channelId,*_externalTransport);
}
else

View File

@ -219,7 +219,7 @@ private:
ViECodec* _vieCodec;
ViENetwork* _vieNetwork;
ViEFile* _vieFile;
tbExternalTransport* _externalTransport;
TbExternalTransport* _externalTransport;
char _fileName[256];

View File

@ -23,7 +23,7 @@
using namespace webrtc;
tbExternalTransport::tbExternalTransport(ViENetwork& vieNetwork)
TbExternalTransport::TbExternalTransport(ViENetwork& vieNetwork)
:
_vieNetwork(vieNetwork),
_thread(*ThreadWrapper::CreateThread(ViEExternalTransportRun, this, kHighPriority, "AutotestTransport")),
@ -49,7 +49,7 @@ tbExternalTransport::tbExternalTransport(ViENetwork& vieNetwork)
}
tbExternalTransport::~tbExternalTransport()
TbExternalTransport::~TbExternalTransport()
{
// TODO: stop thread
_thread.SetNotAlive();
@ -67,7 +67,7 @@ tbExternalTransport::~tbExternalTransport()
int tbExternalTransport::SendPacket(int channel, const void *data, int len)
int TbExternalTransport::SendPacket(int channel, const void *data, int len)
{
_statCrit.Enter();
_rtpCount++;
@ -138,7 +138,7 @@ int tbExternalTransport::SendPacket(int channel, const void *data, int len)
return len;
}
int tbExternalTransport::SendRTCPPacket(int channel, const void *data, int len)
int TbExternalTransport::SendRTCPPacket(int channel, const void *data, int len)
{
_statCrit.Enter();
_rtcpCount++;
@ -157,21 +157,21 @@ int tbExternalTransport::SendRTCPPacket(int channel, const void *data, int len)
return len;
}
WebRtc_Word32 tbExternalTransport::SetPacketLoss(WebRtc_Word32 lossRate)
WebRtc_Word32 TbExternalTransport::SetPacketLoss(WebRtc_Word32 lossRate)
{
CriticalSectionScoped cs(_statCrit);
_lossRate = lossRate;
return 0;
}
void tbExternalTransport::SetNetworkDelay(WebRtc_Word64 delayMs)
void TbExternalTransport::SetNetworkDelay(WebRtc_Word64 delayMs)
{
CriticalSectionScoped cs(_crit);
_networkDelayMs = delayMs;
return;
}
void tbExternalTransport::ClearStats()
void TbExternalTransport::ClearStats()
{
CriticalSectionScoped cs(_statCrit);
_rtpCount = 0;
@ -180,7 +180,7 @@ void tbExternalTransport::ClearStats()
return;
}
void tbExternalTransport::GetStats(WebRtc_Word32& numRtpPackets, WebRtc_Word32& numDroppedPackets, WebRtc_Word32& numRtcpPackets)
void TbExternalTransport::GetStats(WebRtc_Word32& numRtpPackets, WebRtc_Word32& numDroppedPackets, WebRtc_Word32& numRtcpPackets)
{
CriticalSectionScoped cs(_statCrit);
numRtpPackets = _rtpCount;
@ -189,35 +189,35 @@ void tbExternalTransport::GetStats(WebRtc_Word32& numRtpPackets, WebRtc_Word32&
return;
}
void tbExternalTransport::EnableSSRCCheck()
void TbExternalTransport::EnableSSRCCheck()
{
CriticalSectionScoped cs(_statCrit);
_checkSSRC = true;
}
unsigned int tbExternalTransport::ReceivedSSRC()
unsigned int TbExternalTransport::ReceivedSSRC()
{
CriticalSectionScoped cs(_statCrit);
return _lastSSRC;
}
void tbExternalTransport::EnableSequenceNumberCheck()
void TbExternalTransport::EnableSequenceNumberCheck()
{
CriticalSectionScoped cs(_statCrit);
_checkSequenceNumber = true;
}
unsigned short tbExternalTransport::GetFirstSequenceNumber()
unsigned short TbExternalTransport::GetFirstSequenceNumber()
{
CriticalSectionScoped cs(_statCrit);
return _firstSequenceNumber;
}
bool tbExternalTransport::ViEExternalTransportRun(void* object)
bool TbExternalTransport::ViEExternalTransportRun(void* object)
{
return static_cast<tbExternalTransport*>(object)->ViEExternalTransportProcess();
return static_cast<TbExternalTransport*>(object)->ViEExternalTransportProcess();
}
bool tbExternalTransport::ViEExternalTransportProcess()
bool TbExternalTransport::ViEExternalTransportProcess()
{
unsigned int waitTime = KMaxWaitTimeMs;
@ -311,7 +311,7 @@ bool tbExternalTransport::ViEExternalTransportProcess()
return true;
}
WebRtc_Word64 tbExternalTransport::NowMs()
WebRtc_Word64 TbExternalTransport::NowMs()
{
return TickTime::MillisecondTimestamp();
}

View File

@ -26,11 +26,11 @@ class ThreadWrapper;
class ViENetwork;
}
class tbExternalTransport : public webrtc::Transport
class TbExternalTransport : public webrtc::Transport
{
public:
tbExternalTransport(webrtc::ViENetwork& vieNetwork);
~tbExternalTransport(void);
TbExternalTransport(webrtc::ViENetwork& vieNetwork);
~TbExternalTransport(void);
virtual int SendPacket(int channel, const void *data, int len);
virtual int SendRTCPPacket(int channel, const void *data, int len);