Refactore base, Capture, Codec and Custom Call parts of autotest. The CL doesn't contain any real functional changes, only style changes, cast changes and changing reference to pointer as input argument to functions.
Custome call still doesn't pass cpplint, but I'll take that in another CL to not change the structure in the style change CL. BUG= TEST= Review URL: https://webrtc-codereview.appspot.com/523001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2193 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
113f851cc3
commit
e553031580
@ -8,13 +8,12 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "vie_autotest.h"
|
||||
|
||||
#include "base_primitives.h"
|
||||
#include "general_primitives.h"
|
||||
#include "tb_interfaces.h"
|
||||
#include "vie_autotest_defines.h"
|
||||
#include "video_capture_factory.h"
|
||||
#include "modules/video_capture/main/interface/video_capture_factory.h"
|
||||
#include "video_engine/test/auto_test/interface/vie_autotest.h"
|
||||
#include "video_engine/test/auto_test/interface/vie_autotest_defines.h"
|
||||
#include "video_engine/test/auto_test/primitives/base_primitives.h"
|
||||
#include "video_engine/test/auto_test/primitives/general_primitives.h"
|
||||
#include "video_engine/test/libvietest/include/tb_interfaces.h"
|
||||
|
||||
class BaseObserver : public webrtc::ViEBaseObserver {
|
||||
public:
|
||||
@ -46,9 +45,9 @@ void ViEAutoTest::ViEBaseStandardTest() {
|
||||
memset(device_name, 0, kMaxDeviceNameLength);
|
||||
int capture_id;
|
||||
|
||||
webrtc::ViEBase *base_interface = interfaces.base;
|
||||
webrtc::ViERender *render_interface = interfaces.render;
|
||||
webrtc::ViECapture *capture_interface = interfaces.capture;
|
||||
webrtc::ViEBase* base_interface = interfaces.base;
|
||||
webrtc::ViERender* render_interface = interfaces.render;
|
||||
webrtc::ViECapture* capture_interface = interfaces.capture;
|
||||
|
||||
FindCaptureDeviceOnSystem(capture_interface,
|
||||
device_name,
|
||||
@ -107,11 +106,11 @@ void ViEAutoTest::ViEBaseExtendedTest() {
|
||||
// ***************************************************************
|
||||
// TODO(mflodman) Add test for base observer. Cpu load must be over 75%.
|
||||
// BaseObserver base_observer;
|
||||
// EXPECT_EQ(ptrViEBase->RegisterObserver(base_observer), 0);
|
||||
// EXPECT_EQ(vie_base->RegisterObserver(base_observer), 0);
|
||||
//
|
||||
// AutoTestSleep(KAutoTestSleepTimeMs);
|
||||
//
|
||||
// EXPECT_EQ(ptrViEBase->DeregisterObserver(), 0);
|
||||
// EXPECT_EQ(vie_base->DeregisterObserver(), 0);
|
||||
// EXPECT_GT(base_observer.cpu_load, 0);
|
||||
}
|
||||
|
||||
@ -120,114 +119,117 @@ void ViEAutoTest::ViEBaseAPITest() {
|
||||
// Begin create/initialize WebRTC Video Engine for testing
|
||||
// ***************************************************************
|
||||
// Get the ViEBase API
|
||||
webrtc::ViEBase* ptrViEBase = webrtc::ViEBase::GetInterface(NULL);
|
||||
EXPECT_EQ(NULL, ptrViEBase) << "Should return null for a bad ViE pointer";
|
||||
webrtc::ViEBase* vie_base = webrtc::ViEBase::GetInterface(NULL);
|
||||
EXPECT_EQ(NULL, vie_base) << "Should return null for a bad ViE pointer";
|
||||
|
||||
webrtc::VideoEngine* ptrViE = webrtc::VideoEngine::Create();
|
||||
EXPECT_TRUE(NULL != ptrViE);
|
||||
webrtc::VideoEngine* video_engine = webrtc::VideoEngine::Create();
|
||||
EXPECT_TRUE(NULL != video_engine);
|
||||
|
||||
std::string trace_file_path =
|
||||
ViETest::GetResultOutputPath() + "ViEBaseAPI_trace.txt";
|
||||
EXPECT_EQ(0, ptrViE->SetTraceFile(trace_file_path.c_str()));
|
||||
EXPECT_EQ(0, video_engine->SetTraceFile(trace_file_path.c_str()));
|
||||
|
||||
ptrViEBase = webrtc::ViEBase::GetInterface(ptrViE);
|
||||
EXPECT_TRUE(NULL != ptrViEBase);
|
||||
vie_base = webrtc::ViEBase::GetInterface(video_engine);
|
||||
EXPECT_TRUE(NULL != vie_base);
|
||||
|
||||
webrtc::ViENetwork* ptrVieNetwork = webrtc::ViENetwork::GetInterface(ptrViE);
|
||||
EXPECT_TRUE(ptrVieNetwork != NULL);
|
||||
webrtc::ViENetwork* vie_network =
|
||||
webrtc::ViENetwork::GetInterface(video_engine);
|
||||
EXPECT_TRUE(vie_network != NULL);
|
||||
|
||||
// ***************************************************************
|
||||
// Engine ready. Begin testing class
|
||||
// ***************************************************************
|
||||
char version[1024] = "";
|
||||
EXPECT_EQ(0, ptrViEBase->GetVersion(version));
|
||||
EXPECT_EQ(0, ptrViEBase->LastError());
|
||||
EXPECT_EQ(0, vie_base->GetVersion(version));
|
||||
EXPECT_EQ(0, vie_base->LastError());
|
||||
|
||||
// Create without init
|
||||
int videoChannel = -1;
|
||||
EXPECT_NE(0, ptrViEBase->CreateChannel(videoChannel)) <<
|
||||
int video_channel = -1;
|
||||
EXPECT_NE(0, vie_base->CreateChannel(video_channel)) <<
|
||||
"Should fail since Init has not been called yet";
|
||||
EXPECT_EQ(0, ptrViEBase->Init());
|
||||
EXPECT_EQ(0, ptrViEBase->CreateChannel(videoChannel));
|
||||
EXPECT_EQ(0, vie_base->Init());
|
||||
EXPECT_EQ(0, vie_base->CreateChannel(video_channel));
|
||||
|
||||
int videoChannel2 = -1;
|
||||
int videoChannel3 = -1;
|
||||
EXPECT_EQ(0, ptrViEBase->CreateChannel(videoChannel2));
|
||||
EXPECT_NE(videoChannel, videoChannel2) <<
|
||||
int video_channel2 = -1;
|
||||
int video_channel3 = -1;
|
||||
EXPECT_EQ(0, vie_base->CreateChannel(video_channel2));
|
||||
EXPECT_NE(video_channel, video_channel2) <<
|
||||
"Should allocate new number for independent channel";
|
||||
|
||||
EXPECT_EQ(0, ptrViEBase->DeleteChannel(videoChannel2));
|
||||
EXPECT_EQ(0, vie_base->DeleteChannel(video_channel2));
|
||||
|
||||
EXPECT_EQ(-1, ptrViEBase->CreateChannel(videoChannel2, videoChannel + 1))
|
||||
EXPECT_EQ(-1, vie_base->CreateChannel(video_channel2, video_channel + 1))
|
||||
<< "Should fail since neither channel exists (the second must)";
|
||||
|
||||
// Create a receive only channel and a send channel. Verify we can't send on
|
||||
// the receive only channel.
|
||||
EXPECT_EQ(0, ptrViEBase->CreateReceiveChannel(videoChannel2, videoChannel));
|
||||
EXPECT_EQ(0, ptrViEBase->CreateChannel(videoChannel3, videoChannel));
|
||||
EXPECT_EQ(0, vie_base->CreateReceiveChannel(video_channel2,
|
||||
video_channel));
|
||||
EXPECT_EQ(0, vie_base->CreateChannel(video_channel3, video_channel));
|
||||
|
||||
const char* ipAddress = "127.0.0.1\0";
|
||||
const int sendPort = 1234;
|
||||
EXPECT_EQ(0, ptrVieNetwork->SetSendDestination(videoChannel, ipAddress,
|
||||
sendPort));
|
||||
EXPECT_EQ(0, ptrVieNetwork->SetSendDestination(videoChannel2,ipAddress,
|
||||
sendPort + 2));
|
||||
EXPECT_EQ(0, ptrVieNetwork->SetSendDestination(videoChannel3,ipAddress,
|
||||
sendPort + 4));
|
||||
const char* ip_address = "127.0.0.1\0";
|
||||
const int send_port = 1234;
|
||||
EXPECT_EQ(0, vie_network->SetSendDestination(video_channel, ip_address,
|
||||
send_port));
|
||||
EXPECT_EQ(0, vie_network->SetSendDestination(video_channel2, ip_address,
|
||||
send_port + 2));
|
||||
EXPECT_EQ(0, vie_network->SetSendDestination(video_channel3, ip_address,
|
||||
send_port + 4));
|
||||
|
||||
EXPECT_EQ(0, ptrViEBase->StartSend(videoChannel));
|
||||
EXPECT_EQ(-1, ptrViEBase->StartSend(videoChannel2));
|
||||
EXPECT_EQ(0, ptrViEBase->StartSend(videoChannel3));
|
||||
EXPECT_EQ(0, ptrViEBase->StopSend(videoChannel));
|
||||
EXPECT_EQ(0, ptrViEBase->StopSend(videoChannel3));
|
||||
EXPECT_EQ(0, vie_base->StartSend(video_channel));
|
||||
EXPECT_EQ(-1, vie_base->StartSend(video_channel2));
|
||||
EXPECT_EQ(0, vie_base->StartSend(video_channel3));
|
||||
EXPECT_EQ(0, vie_base->StopSend(video_channel));
|
||||
EXPECT_EQ(0, vie_base->StopSend(video_channel3));
|
||||
|
||||
// Test Voice Engine integration with Video Engine.
|
||||
webrtc::VoiceEngine* ptrVoE = NULL;
|
||||
webrtc::VoEBase* ptrVoEBase = NULL;
|
||||
int audioChannel = -1;
|
||||
webrtc::VoiceEngine* voice_engine = NULL;
|
||||
webrtc::VoEBase* voe_base = NULL;
|
||||
int audio_channel = -1;
|
||||
|
||||
ptrVoE = webrtc::VoiceEngine::Create();
|
||||
EXPECT_TRUE(NULL != ptrVoE);
|
||||
voice_engine = webrtc::VoiceEngine::Create();
|
||||
EXPECT_TRUE(NULL != voice_engine);
|
||||
|
||||
ptrVoEBase = webrtc::VoEBase::GetInterface(ptrVoE);
|
||||
EXPECT_TRUE(NULL != ptrVoEBase);
|
||||
EXPECT_EQ(0, ptrVoEBase->Init());
|
||||
voe_base = webrtc::VoEBase::GetInterface(voice_engine);
|
||||
EXPECT_TRUE(NULL != voe_base);
|
||||
EXPECT_EQ(0, voe_base->Init());
|
||||
|
||||
audioChannel = ptrVoEBase->CreateChannel();
|
||||
EXPECT_NE(-1, audioChannel);
|
||||
audio_channel = voe_base->CreateChannel();
|
||||
EXPECT_NE(-1, audio_channel);
|
||||
|
||||
// Connect before setting VoE.
|
||||
EXPECT_NE(0, ptrViEBase->ConnectAudioChannel(videoChannel, audioChannel)) <<
|
||||
"Should fail since Voice Engine is not set yet.";
|
||||
EXPECT_NE(0, vie_base->ConnectAudioChannel(video_channel, audio_channel))
|
||||
<< "Should fail since Voice Engine is not set yet.";
|
||||
|
||||
// Then do it right.
|
||||
EXPECT_EQ(0, ptrViEBase->SetVoiceEngine(ptrVoE));
|
||||
EXPECT_EQ(0, ptrViEBase->ConnectAudioChannel(videoChannel, audioChannel));
|
||||
EXPECT_EQ(0, vie_base->SetVoiceEngine(voice_engine));
|
||||
EXPECT_EQ(0, vie_base->ConnectAudioChannel(video_channel, audio_channel));
|
||||
|
||||
// ***************************************************************
|
||||
// Testing finished. Tear down Video Engine
|
||||
// ***************************************************************
|
||||
EXPECT_NE(0, ptrViEBase->DisconnectAudioChannel(videoChannel + 5)) <<
|
||||
EXPECT_NE(0, vie_base->DisconnectAudioChannel(video_channel + 5)) <<
|
||||
"Should fail: disconnecting bogus channel";
|
||||
|
||||
EXPECT_EQ(0, ptrViEBase->DisconnectAudioChannel(videoChannel));
|
||||
EXPECT_EQ(0, vie_base->DisconnectAudioChannel(video_channel));
|
||||
|
||||
// Clean up voice engine
|
||||
EXPECT_EQ(0, ptrVieNetwork->Release());
|
||||
EXPECT_EQ(0, ptrViEBase->SetVoiceEngine(NULL));
|
||||
EXPECT_EQ(0, vie_network->Release());
|
||||
EXPECT_EQ(0, vie_base->SetVoiceEngine(NULL));
|
||||
// VoiceEngine reference counting is per object, not per interface, so
|
||||
// Release should return != 0.
|
||||
EXPECT_NE(0, ptrVoEBase->Release());
|
||||
EXPECT_TRUE(webrtc::VoiceEngine::Delete(ptrVoE));
|
||||
EXPECT_NE(0, voe_base->Release());
|
||||
EXPECT_TRUE(webrtc::VoiceEngine::Delete(voice_engine));
|
||||
|
||||
webrtc::ViEBase* ptrViEBase2 = webrtc::ViEBase::GetInterface(ptrViE);
|
||||
EXPECT_TRUE(NULL != ptrViEBase2);
|
||||
webrtc::ViEBase* vie_base2 = webrtc::ViEBase::GetInterface(video_engine);
|
||||
EXPECT_TRUE(NULL != vie_base2);
|
||||
|
||||
EXPECT_EQ(1, ptrViEBase->Release()) << "There should be one interface left.";
|
||||
EXPECT_EQ(1, vie_base->Release()) <<
|
||||
"There should be one interface left.";
|
||||
|
||||
EXPECT_FALSE(webrtc::VideoEngine::Delete(ptrViE)) <<
|
||||
EXPECT_FALSE(webrtc::VideoEngine::Delete(video_engine)) <<
|
||||
"Should fail since there are interfaces left.";
|
||||
|
||||
EXPECT_EQ(0, ptrViEBase->Release());
|
||||
EXPECT_TRUE(webrtc::VideoEngine::Delete(ptrViE));
|
||||
EXPECT_EQ(0, vie_base->Release());
|
||||
EXPECT_TRUE(webrtc::VideoEngine::Delete(video_engine));
|
||||
}
|
||||
|
@ -8,43 +8,39 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "vie_autotest.h"
|
||||
|
||||
#include "common_types.h"
|
||||
#include "engine_configurations.h"
|
||||
#include "common_types.h" // NOLINT
|
||||
#include "engine_configurations.h" // NOLINT
|
||||
#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 "voe_base.h"
|
||||
#include "modules/video_capture/main/interface/video_capture_factory.h"
|
||||
#include "system_wrappers/interface/tick_util.h"
|
||||
#include "video_engine/include/vie_base.h"
|
||||
#include "video_engine/include/vie_capture.h"
|
||||
#include "video_engine/include/vie_codec.h"
|
||||
#include "video_engine/include/vie_network.h"
|
||||
#include "video_engine/include/vie_render.h"
|
||||
#include "video_engine/include/vie_rtp_rtcp.h"
|
||||
#include "video_engine/test/auto_test/interface/vie_autotest.h"
|
||||
#include "video_engine/test/auto_test/interface/vie_autotest_defines.h"
|
||||
#include "video_engine/test/libvietest/include/tb_interfaces.h"
|
||||
#include "video_engine/test/libvietest/include/tb_video_channel.h"
|
||||
#include "voice_engine/main/interface/voe_base.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
|
||||
{
|
||||
public:
|
||||
CaptureObserver() :
|
||||
_brightness(webrtc::Normal),
|
||||
_alarm(webrtc::AlarmCleared),
|
||||
_frameRate(0) {}
|
||||
class CaptureObserver : public webrtc::ViECaptureObserver {
|
||||
public:
|
||||
CaptureObserver()
|
||||
: brightness_(webrtc::Normal),
|
||||
alarm_(webrtc::AlarmCleared),
|
||||
frame_rate_(0) {}
|
||||
|
||||
virtual void BrightnessAlarm(const int captureId,
|
||||
const webrtc::Brightness brightness)
|
||||
{
|
||||
_brightness = brightness;
|
||||
switch (brightness)
|
||||
{
|
||||
virtual void BrightnessAlarm(const int capture_id,
|
||||
const webrtc::Brightness brightness) {
|
||||
brightness_ = brightness;
|
||||
switch (brightness) {
|
||||
case webrtc::Normal:
|
||||
ViETest::Log(" BrightnessAlarm Normal");
|
||||
break;
|
||||
@ -57,33 +53,28 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void CapturedFrameRate(const int captureId,
|
||||
const unsigned char frameRate)
|
||||
{
|
||||
ViETest::Log(" CapturedFrameRate %u", frameRate);
|
||||
_frameRate = frameRate;
|
||||
virtual void CapturedFrameRate(const int capture_id,
|
||||
const unsigned char frame_rate) {
|
||||
ViETest::Log(" CapturedFrameRate %u", frame_rate);
|
||||
frame_rate_ = frame_rate;
|
||||
}
|
||||
|
||||
virtual void NoPictureAlarm(const int captureId,
|
||||
const webrtc::CaptureAlarm alarm)
|
||||
{
|
||||
_alarm = alarm;
|
||||
if (alarm == webrtc::AlarmRaised)
|
||||
{
|
||||
virtual void NoPictureAlarm(const int capture_id,
|
||||
const webrtc::CaptureAlarm alarm) {
|
||||
alarm_ = alarm;
|
||||
if (alarm == webrtc::AlarmRaised) {
|
||||
ViETest::Log("NoPictureAlarm CARaised.");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ViETest::Log("NoPictureAlarm CACleared.");
|
||||
}
|
||||
}
|
||||
|
||||
webrtc::Brightness _brightness;
|
||||
webrtc::CaptureAlarm _alarm;
|
||||
unsigned char _frameRate;
|
||||
webrtc::Brightness brightness_;
|
||||
webrtc::CaptureAlarm alarm_;
|
||||
unsigned char frame_rate_;
|
||||
};
|
||||
|
||||
class CaptureEffectFilter: public webrtc::ViEEffectFilter {
|
||||
class CaptureEffectFilter : public webrtc::ViEEffectFilter {
|
||||
public:
|
||||
CaptureEffectFilter(unsigned int expected_width, unsigned int expected_height)
|
||||
: number_of_captured_frames_(0),
|
||||
@ -91,11 +82,11 @@ class CaptureEffectFilter: public webrtc::ViEEffectFilter {
|
||||
expected_height_(expected_height) {
|
||||
}
|
||||
|
||||
// Implements ViEEffectFilter
|
||||
virtual int Transform(int size, unsigned char* frameBuffer,
|
||||
unsigned int timeStamp90KHz, unsigned int width,
|
||||
// Implements video_engineEffectFilter.
|
||||
virtual int Transform(int size, unsigned char* frame_buffer,
|
||||
unsigned int time_stamp90KHz, unsigned int width,
|
||||
unsigned int height) {
|
||||
EXPECT_TRUE(frameBuffer != NULL);
|
||||
EXPECT_TRUE(frame_buffer != NULL);
|
||||
EXPECT_EQ(expected_width_, width);
|
||||
EXPECT_EQ(expected_height_, height);
|
||||
++number_of_captured_frames_;
|
||||
@ -107,68 +98,64 @@ class CaptureEffectFilter: public webrtc::ViEEffectFilter {
|
||||
protected:
|
||||
unsigned int expected_width_;
|
||||
unsigned int expected_height_;
|
||||
};
|
||||
};
|
||||
|
||||
void ViEAutoTest::ViECaptureStandardTest()
|
||||
{
|
||||
//***************************************************************
|
||||
void ViEAutoTest::ViECaptureStandardTest() {
|
||||
/// **************************************************************
|
||||
// Begin create/initialize WebRTC Video Engine for testing
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
// Engine ready. Begin testing class
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
|
||||
TbInterfaces ViE("ViECaptureStandardTest");
|
||||
TbInterfaces video_engine("video_engineCaptureStandardTest");
|
||||
|
||||
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
|
||||
webrtc::VideoCaptureModule::DeviceInfo* dev_info =
|
||||
webrtc::VideoCaptureFactory::CreateDeviceInfo(0);
|
||||
ASSERT_TRUE(devInfo != NULL);
|
||||
ASSERT_TRUE(dev_info != NULL);
|
||||
|
||||
int numberOfCaptureDevices = devInfo->NumberOfDevices();
|
||||
ViETest::Log("Number of capture devices %d", numberOfCaptureDevices);
|
||||
ASSERT_GT(numberOfCaptureDevices, 0)
|
||||
int number_of_capture_devices = dev_info->NumberOfDevices();
|
||||
ViETest::Log("Number of capture devices %d",
|
||||
number_of_capture_devices);
|
||||
ASSERT_GT(number_of_capture_devices, 0)
|
||||
<< "This test requires a capture device (i.e. a webcam)";
|
||||
|
||||
int captureDeviceId[10];
|
||||
memset(captureDeviceId, 0, sizeof(captureDeviceId));
|
||||
int capture_device_id[10];
|
||||
memset(capture_device_id, 0, sizeof(capture_device_id));
|
||||
webrtc::VideoCaptureModule* vcpms[10];
|
||||
memset(vcpms, 0, sizeof(vcpms));
|
||||
|
||||
// Check capabilities
|
||||
for (int deviceIndex = 0;
|
||||
deviceIndex < numberOfCaptureDevices;
|
||||
++deviceIndex)
|
||||
{
|
||||
char deviceName[128];
|
||||
char deviceUniqueName[512];
|
||||
for (int device_index = 0; device_index < number_of_capture_devices;
|
||||
++device_index) {
|
||||
char device_name[128];
|
||||
char device_unique_name[512];
|
||||
|
||||
EXPECT_EQ(0, devInfo->GetDeviceName(deviceIndex,
|
||||
deviceName,
|
||||
sizeof(deviceName),
|
||||
deviceUniqueName,
|
||||
sizeof(deviceUniqueName)));
|
||||
ViETest::Log("Found capture device %s\nUnique name %s", deviceName,
|
||||
deviceUniqueName);
|
||||
EXPECT_EQ(0, dev_info->GetDeviceName(device_index,
|
||||
device_name,
|
||||
sizeof(device_name),
|
||||
device_unique_name,
|
||||
sizeof(device_unique_name)));
|
||||
ViETest::Log("Found capture device %s\nUnique name %s",
|
||||
device_name, device_unique_name);
|
||||
|
||||
#if !defined(WEBRTC_MAC_INTEL) // these functions will return -1
|
||||
int numberOfCapabilities =
|
||||
devInfo->NumberOfCapabilities(deviceUniqueName);
|
||||
EXPECT_GT(numberOfCapabilities, 0);
|
||||
int number_of_capabilities =
|
||||
dev_info->NumberOfCapabilities(device_unique_name);
|
||||
EXPECT_GT(number_of_capabilities, 0);
|
||||
|
||||
for (int capIndex = 0; capIndex < numberOfCapabilities; ++capIndex)
|
||||
{
|
||||
for (int cap_index = 0; cap_index < number_of_capabilities; ++cap_index) {
|
||||
webrtc::VideoCaptureCapability capability;
|
||||
EXPECT_EQ(0, devInfo->GetCapability(deviceUniqueName, capIndex,
|
||||
EXPECT_EQ(0, dev_info->GetCapability(device_unique_name, cap_index,
|
||||
capability));
|
||||
ViETest::Log("Capture capability %d (of %u)", capIndex + 1,
|
||||
numberOfCapabilities);
|
||||
ViETest::Log("Capture capability %d (of %u)", cap_index + 1,
|
||||
number_of_capabilities);
|
||||
ViETest::Log("witdh %d, height %d, frame rate %d",
|
||||
capability.width, capability.height, capability.maxFPS);
|
||||
ViETest::Log("expected delay %d, color type %d, encoding %d",
|
||||
capability.expectedCaptureDelay, capability.rawType,
|
||||
capability.codecType);
|
||||
|
||||
EXPECT_GT(capability.width, 0);
|
||||
EXPECT_GT(capability.height, 0);
|
||||
EXPECT_GT(capability.maxFPS, -1); // >= 0
|
||||
@ -180,40 +167,35 @@ void ViEAutoTest::ViECaptureStandardTest()
|
||||
#if !defined(WEBRTC_MAC_INTEL)
|
||||
|
||||
// Check allocation. Try to allocate them all after each other.
|
||||
for (int deviceIndex = 0;
|
||||
deviceIndex < numberOfCaptureDevices;
|
||||
++deviceIndex)
|
||||
{
|
||||
char deviceName[128];
|
||||
char deviceUniqueName[512];
|
||||
|
||||
EXPECT_EQ(0, devInfo->GetDeviceName(deviceIndex,
|
||||
deviceName,
|
||||
sizeof(deviceName),
|
||||
deviceUniqueName,
|
||||
sizeof(deviceUniqueName)));
|
||||
|
||||
for (int device_index = 0; device_index < number_of_capture_devices;
|
||||
++device_index) {
|
||||
char device_name[128];
|
||||
char device_unique_name[512];
|
||||
EXPECT_EQ(0, dev_info->GetDeviceName(device_index,
|
||||
device_name,
|
||||
sizeof(device_name),
|
||||
device_unique_name,
|
||||
sizeof(device_unique_name)));
|
||||
webrtc::VideoCaptureModule* vcpm =
|
||||
webrtc::VideoCaptureFactory::Create(
|
||||
deviceIndex, deviceUniqueName);
|
||||
webrtc::VideoCaptureFactory::Create(device_index, device_unique_name);
|
||||
EXPECT_TRUE(vcpm != NULL);
|
||||
vcpm->AddRef();
|
||||
vcpms[deviceIndex] = vcpm;
|
||||
vcpms[device_index] = vcpm;
|
||||
|
||||
EXPECT_EQ(0, ViE.capture->AllocateCaptureDevice(
|
||||
*vcpm, captureDeviceId[deviceIndex]));
|
||||
EXPECT_EQ(0, video_engine.capture->AllocateCaptureDevice(
|
||||
*vcpm, capture_device_id[device_index]));
|
||||
|
||||
webrtc::VideoCaptureCapability capability;
|
||||
EXPECT_EQ(0, devInfo->GetCapability(deviceUniqueName, 0, capability));
|
||||
EXPECT_EQ(0, dev_info->GetCapability(device_unique_name, 0, capability));
|
||||
|
||||
// Test that the camera select the closest capability to the selected
|
||||
// width and height.
|
||||
CaptureEffectFilter filter(capability.width, capability.height);
|
||||
EXPECT_EQ(0, ViE.image_process->RegisterCaptureEffectFilter(
|
||||
captureDeviceId[deviceIndex], filter));
|
||||
EXPECT_EQ(0, video_engine.image_process->RegisterCaptureEffectFilter(
|
||||
capture_device_id[device_index], filter));
|
||||
|
||||
ViETest::Log("Testing Device %s capability width %d height %d",
|
||||
deviceUniqueName, capability.width, capability.height);
|
||||
device_unique_name, capability.width, capability.height);
|
||||
|
||||
if (FLAGS_capture_test_ensure_resolution_alignment_in_capture_device) {
|
||||
// This tests that the capture device properly aligns to a
|
||||
@ -222,53 +204,51 @@ void ViEAutoTest::ViECaptureStandardTest()
|
||||
capability.width = capability.width - 2;
|
||||
}
|
||||
|
||||
webrtc::CaptureCapability vieCapability;
|
||||
vieCapability.width = capability.width;
|
||||
vieCapability.height = capability.height;
|
||||
vieCapability.codecType = capability.codecType;
|
||||
vieCapability.maxFPS = capability.maxFPS;
|
||||
vieCapability.rawType = capability.rawType;
|
||||
webrtc::CaptureCapability vie_capability;
|
||||
vie_capability.width = capability.width;
|
||||
vie_capability.height = capability.height;
|
||||
vie_capability.codecType = capability.codecType;
|
||||
vie_capability.maxFPS = capability.maxFPS;
|
||||
vie_capability.rawType = capability.rawType;
|
||||
|
||||
EXPECT_EQ(0, ViE.capture->StartCapture(captureDeviceId[deviceIndex],
|
||||
vieCapability));
|
||||
webrtc::TickTime startTime = webrtc::TickTime::Now();
|
||||
EXPECT_EQ(0, video_engine.capture->StartCapture(
|
||||
capture_device_id[device_index], vie_capability));
|
||||
webrtc::TickTime start_time = webrtc::TickTime::Now();
|
||||
|
||||
while (filter.number_of_captured_frames_ < 10
|
||||
&& (webrtc::TickTime::Now() - startTime).Milliseconds() < 10000)
|
||||
{
|
||||
while (filter.number_of_captured_frames_ < 10 &&
|
||||
(webrtc::TickTime::Now() - start_time).Milliseconds() < 10000) {
|
||||
AutoTestSleep(100);
|
||||
}
|
||||
|
||||
EXPECT_GT(filter.number_of_captured_frames_, 9) <<
|
||||
"Should capture at least some frames";
|
||||
EXPECT_GT(filter.number_of_captured_frames_, 9)
|
||||
<< "Should capture at least some frames";
|
||||
|
||||
EXPECT_EQ(0, ViE.image_process->DeregisterCaptureEffectFilter(
|
||||
captureDeviceId[deviceIndex]));
|
||||
EXPECT_EQ(0, video_engine.image_process->DeregisterCaptureEffectFilter(
|
||||
capture_device_id[device_index]));
|
||||
|
||||
#ifdef WEBRTC_ANDROID // Can only allocate one camera at the time on Android.
|
||||
EXPECT_EQ(0, ViE.capture->StopCapture(captureDeviceId[deviceIndex]));
|
||||
EXPECT_EQ(0, ViE.capture->ReleaseCaptureDevice(
|
||||
captureDeviceId[deviceIndex]));
|
||||
EXPECT_EQ(0, video_engine.capture->StopCapture(
|
||||
capture_device_id[device_index]));
|
||||
EXPECT_EQ(0, video_engine.capture->ReleaseCaptureDevice(
|
||||
capture_device_id[device_index]));
|
||||
#endif
|
||||
}
|
||||
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
// Testing finished. Tear down Video Engine
|
||||
//***************************************************************
|
||||
|
||||
/// **************************************************************
|
||||
|
||||
// Stop all started capture devices.
|
||||
for (int deviceIndex = 0;
|
||||
deviceIndex < numberOfCaptureDevices;
|
||||
++deviceIndex) {
|
||||
for (int device_index = 0; device_index < number_of_capture_devices;
|
||||
++device_index) {
|
||||
#if !defined(WEBRTC_ANDROID)
|
||||
// Don't stop on Android since we can only allocate one camera.
|
||||
EXPECT_EQ(0, ViE.capture->StopCapture(
|
||||
captureDeviceId[deviceIndex]));
|
||||
EXPECT_EQ(0, ViE.capture->ReleaseCaptureDevice(
|
||||
captureDeviceId[deviceIndex]));
|
||||
EXPECT_EQ(0, video_engine.capture->StopCapture(
|
||||
capture_device_id[device_index]));
|
||||
EXPECT_EQ(0, video_engine.capture->ReleaseCaptureDevice(
|
||||
capture_device_id[device_index]));
|
||||
#endif // !WEBRTC_ANDROID
|
||||
vcpms[deviceIndex]->Release();
|
||||
vcpms[device_index]->Release();
|
||||
}
|
||||
#endif // !WEBRTC_MAC_INTEL
|
||||
}
|
||||
@ -279,285 +259,278 @@ void ViEAutoTest::ViECaptureExtendedTest() {
|
||||
ViECaptureExternalCaptureTest();
|
||||
}
|
||||
|
||||
void ViEAutoTest::ViECaptureAPITest()
|
||||
{
|
||||
//***************************************************************
|
||||
void ViEAutoTest::ViECaptureAPITest() {
|
||||
/// **************************************************************
|
||||
// Begin create/initialize WebRTC Video Engine for testing
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
// Engine ready. Begin testing class
|
||||
//***************************************************************
|
||||
TbInterfaces ViE("ViECaptureAPITest");
|
||||
/// **************************************************************
|
||||
TbInterfaces video_engine("video_engineCaptureAPITest");
|
||||
|
||||
ViE.capture->NumberOfCaptureDevices();
|
||||
video_engine.capture->NumberOfCaptureDevices();
|
||||
|
||||
char deviceName[128];
|
||||
char deviceUniqueName[512];
|
||||
int captureId = 0;
|
||||
char device_name[128];
|
||||
char device_unique_name[512];
|
||||
int capture_id = 0;
|
||||
|
||||
webrtc::VideoCaptureModule::DeviceInfo* devInfo =
|
||||
webrtc::VideoCaptureModule::DeviceInfo* dev_info =
|
||||
webrtc::VideoCaptureFactory::CreateDeviceInfo(0);
|
||||
ASSERT_TRUE(devInfo != NULL);
|
||||
ASSERT_GT(devInfo->NumberOfDevices(), 0u)
|
||||
ASSERT_TRUE(dev_info != NULL);
|
||||
ASSERT_GT(dev_info->NumberOfDevices(), 0u)
|
||||
<< "This test requires a capture device (i.e. a webcam)";
|
||||
|
||||
// Get the first capture device
|
||||
EXPECT_EQ(0, devInfo->GetDeviceName(0, deviceName,
|
||||
sizeof(deviceName),
|
||||
deviceUniqueName,
|
||||
sizeof(deviceUniqueName)));
|
||||
EXPECT_EQ(0, dev_info->GetDeviceName(0, device_name,
|
||||
sizeof(device_name),
|
||||
device_unique_name,
|
||||
sizeof(device_unique_name)));
|
||||
|
||||
webrtc::VideoCaptureModule* vcpm =
|
||||
webrtc::VideoCaptureFactory::Create(0, deviceUniqueName);
|
||||
webrtc::VideoCaptureFactory::Create(0, device_unique_name);
|
||||
vcpm->AddRef();
|
||||
EXPECT_TRUE(vcpm != NULL);
|
||||
|
||||
// Allocate capture device.
|
||||
EXPECT_EQ(0, ViE.capture->AllocateCaptureDevice(*vcpm, captureId));
|
||||
EXPECT_EQ(0, video_engine.capture->AllocateCaptureDevice(*vcpm, capture_id));
|
||||
|
||||
// Start the capture device.
|
||||
EXPECT_EQ(0, ViE.capture->StartCapture(captureId));
|
||||
EXPECT_EQ(0, video_engine.capture->StartCapture(capture_id));
|
||||
|
||||
// Start again. Should fail.
|
||||
EXPECT_NE(0, ViE.capture->StartCapture(captureId));
|
||||
EXPECT_EQ(kViECaptureDeviceAlreadyStarted, ViE.LastError());
|
||||
EXPECT_NE(0, video_engine.capture->StartCapture(capture_id));
|
||||
EXPECT_EQ(kViECaptureDeviceAlreadyStarted, video_engine.LastError());
|
||||
|
||||
// Start invalid capture device.
|
||||
EXPECT_NE(0, ViE.capture->StartCapture(captureId + 1));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, ViE.LastError());
|
||||
EXPECT_NE(0, video_engine.capture->StartCapture(capture_id + 1));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, video_engine.LastError());
|
||||
|
||||
// Stop invalid capture device.
|
||||
EXPECT_NE(0, ViE.capture->StopCapture(captureId + 1));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, ViE.LastError());
|
||||
EXPECT_NE(0, video_engine.capture->StopCapture(capture_id + 1));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, video_engine.LastError());
|
||||
|
||||
// Stop the capture device.
|
||||
EXPECT_EQ(0, ViE.capture->StopCapture(captureId));
|
||||
EXPECT_EQ(0, video_engine.capture->StopCapture(capture_id));
|
||||
|
||||
// Stop the capture device again.
|
||||
EXPECT_NE(0, ViE.capture->StopCapture(captureId));
|
||||
EXPECT_EQ(kViECaptureDeviceNotStarted, ViE.LastError());
|
||||
EXPECT_NE(0, video_engine.capture->StopCapture(capture_id));
|
||||
EXPECT_EQ(kViECaptureDeviceNotStarted, video_engine.LastError());
|
||||
|
||||
// Connect to invalid channel.
|
||||
EXPECT_NE(0, ViE.capture->ConnectCaptureDevice(captureId, 0));
|
||||
EXPECT_EQ(kViECaptureDeviceInvalidChannelId, ViE.LastError());
|
||||
EXPECT_NE(0, video_engine.capture->ConnectCaptureDevice(capture_id, 0));
|
||||
EXPECT_EQ(kViECaptureDeviceInvalidChannelId,
|
||||
video_engine.LastError());
|
||||
|
||||
TbVideoChannel channel(ViE);
|
||||
TbVideoChannel channel(video_engine);
|
||||
|
||||
// Connect invalid captureId.
|
||||
EXPECT_NE(0, ViE.capture->ConnectCaptureDevice(captureId + 1,
|
||||
// Connect invalid capture_id.
|
||||
EXPECT_NE(0, video_engine.capture->ConnectCaptureDevice(capture_id + 1,
|
||||
channel.videoChannel));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, ViE.LastError());
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, video_engine.LastError());
|
||||
|
||||
// Connect the capture device to the channel.
|
||||
EXPECT_EQ(0, ViE.capture->ConnectCaptureDevice(captureId,
|
||||
EXPECT_EQ(0, video_engine.capture->ConnectCaptureDevice(capture_id,
|
||||
channel.videoChannel));
|
||||
|
||||
// Connect the channel again.
|
||||
EXPECT_NE(0, ViE.capture->ConnectCaptureDevice(captureId,
|
||||
EXPECT_NE(0, video_engine.capture->ConnectCaptureDevice(capture_id,
|
||||
channel.videoChannel));
|
||||
EXPECT_EQ(kViECaptureDeviceAlreadyConnected, ViE.LastError());
|
||||
EXPECT_EQ(kViECaptureDeviceAlreadyConnected,
|
||||
video_engine.LastError());
|
||||
|
||||
// Start the capture device.
|
||||
EXPECT_EQ(0, ViE.capture->StartCapture(captureId));
|
||||
EXPECT_EQ(0, video_engine.capture->StartCapture(capture_id));
|
||||
|
||||
// Release invalid capture device.
|
||||
EXPECT_NE(0, ViE.capture->ReleaseCaptureDevice(captureId + 1));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, ViE.LastError());
|
||||
EXPECT_NE(0, video_engine.capture->ReleaseCaptureDevice(capture_id + 1));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, video_engine.LastError());
|
||||
|
||||
// Release the capture device.
|
||||
EXPECT_EQ(0, ViE.capture->ReleaseCaptureDevice(captureId));
|
||||
EXPECT_EQ(0, video_engine.capture->ReleaseCaptureDevice(capture_id));
|
||||
|
||||
// Release the capture device again.
|
||||
EXPECT_NE(0, ViE.capture->ReleaseCaptureDevice(captureId));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, ViE.LastError());
|
||||
EXPECT_NE(0, video_engine.capture->ReleaseCaptureDevice(capture_id));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, video_engine.LastError());
|
||||
|
||||
// Test GetOrientation.
|
||||
webrtc::VideoCaptureRotation orientation;
|
||||
char dummy_name[5];
|
||||
EXPECT_NE(0, devInfo->GetOrientation(dummy_name, orientation));
|
||||
EXPECT_NE(0, dev_info->GetOrientation(dummy_name, orientation));
|
||||
|
||||
// Test SetRotation.
|
||||
EXPECT_NE(0, ViE.capture->SetRotateCapturedFrames(
|
||||
captureId, webrtc::RotateCapturedFrame_90));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, ViE.LastError());
|
||||
EXPECT_NE(0, video_engine.capture->SetRotateCapturedFrames(
|
||||
capture_id, webrtc::RotateCapturedFrame_90));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, video_engine.LastError());
|
||||
|
||||
// Allocate capture device.
|
||||
EXPECT_EQ(0, ViE.capture->AllocateCaptureDevice(*vcpm, captureId));
|
||||
EXPECT_EQ(0, video_engine.capture->AllocateCaptureDevice(*vcpm, capture_id));
|
||||
|
||||
EXPECT_EQ(0, ViE.capture->SetRotateCapturedFrames(
|
||||
captureId, webrtc::RotateCapturedFrame_0));
|
||||
EXPECT_EQ(0, ViE.capture->SetRotateCapturedFrames(
|
||||
captureId, webrtc::RotateCapturedFrame_90));
|
||||
EXPECT_EQ(0, ViE.capture->SetRotateCapturedFrames(
|
||||
captureId, webrtc::RotateCapturedFrame_180));
|
||||
EXPECT_EQ(0, ViE.capture->SetRotateCapturedFrames(
|
||||
captureId, webrtc::RotateCapturedFrame_270));
|
||||
EXPECT_EQ(0, video_engine.capture->SetRotateCapturedFrames(
|
||||
capture_id, webrtc::RotateCapturedFrame_0));
|
||||
EXPECT_EQ(0, video_engine.capture->SetRotateCapturedFrames(
|
||||
capture_id, webrtc::RotateCapturedFrame_90));
|
||||
EXPECT_EQ(0, video_engine.capture->SetRotateCapturedFrames(
|
||||
capture_id, webrtc::RotateCapturedFrame_180));
|
||||
EXPECT_EQ(0, video_engine.capture->SetRotateCapturedFrames(
|
||||
capture_id, webrtc::RotateCapturedFrame_270));
|
||||
|
||||
// Release the capture device
|
||||
EXPECT_EQ(0, ViE.capture->ReleaseCaptureDevice(captureId));
|
||||
EXPECT_EQ(0, video_engine.capture->ReleaseCaptureDevice(capture_id));
|
||||
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
// Testing finished. Tear down Video Engine
|
||||
//***************************************************************
|
||||
delete devInfo;
|
||||
/// **************************************************************
|
||||
delete dev_info;
|
||||
vcpm->Release();
|
||||
}
|
||||
|
||||
void ViEAutoTest::ViECaptureExternalCaptureTest()
|
||||
{
|
||||
//***************************************************************
|
||||
void ViEAutoTest::ViECaptureExternalCaptureTest() {
|
||||
/// **************************************************************
|
||||
// Begin create/initialize WebRTC Video Engine for testing
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
|
||||
TbInterfaces ViE("ViECaptureExternalCaptureTest");
|
||||
TbVideoChannel channel(ViE);
|
||||
TbInterfaces video_engine("video_engineCaptureExternalCaptureTest");
|
||||
TbVideoChannel channel(video_engine);
|
||||
channel.StartReceive();
|
||||
channel.StartSend();
|
||||
|
||||
webrtc::VideoCaptureExternal* externalCapture;
|
||||
int captureId = 0;
|
||||
webrtc::VideoCaptureExternal* external_capture = NULL;
|
||||
int capture_id = 0;
|
||||
|
||||
// Allocate the external capture device.
|
||||
webrtc::VideoCaptureModule* vcpm = webrtc::VideoCaptureFactory::Create(
|
||||
0, externalCapture);
|
||||
webrtc::VideoCaptureModule* vcpm =
|
||||
webrtc::VideoCaptureFactory::Create(0, external_capture);
|
||||
EXPECT_TRUE(vcpm != NULL);
|
||||
EXPECT_TRUE(externalCapture != NULL);
|
||||
EXPECT_TRUE(external_capture != NULL);
|
||||
vcpm->AddRef();
|
||||
|
||||
EXPECT_EQ(0, ViE.capture->AllocateCaptureDevice(*vcpm, captureId));
|
||||
EXPECT_EQ(0, video_engine.capture->AllocateCaptureDevice(*vcpm, capture_id));
|
||||
|
||||
// Connect the capture device to the channel.
|
||||
EXPECT_EQ(0, ViE.capture->ConnectCaptureDevice(captureId,
|
||||
EXPECT_EQ(0, video_engine.capture->ConnectCaptureDevice(capture_id,
|
||||
channel.videoChannel));
|
||||
|
||||
// Render the local capture.
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(captureId, _window1, 1, 0.0, 0.0,
|
||||
1.0, 1.0));
|
||||
EXPECT_EQ(0, video_engine.render->AddRenderer(capture_id, _window1, 1, 0.0,
|
||||
0.0, 1.0, 1.0));
|
||||
|
||||
// Render the remote capture.
|
||||
EXPECT_EQ(0, ViE.render->AddRenderer(channel.videoChannel, _window2, 1,
|
||||
0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(captureId));
|
||||
EXPECT_EQ(0, ViE.render->StartRender(channel.videoChannel));
|
||||
EXPECT_EQ(0, video_engine.render->AddRenderer(channel.videoChannel, _window2,
|
||||
1, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, video_engine.render->StartRender(capture_id));
|
||||
EXPECT_EQ(0, video_engine.render->StartRender(channel.videoChannel));
|
||||
|
||||
// Register observer.
|
||||
CaptureObserver observer;
|
||||
EXPECT_EQ(0, ViE.capture->RegisterObserver(captureId, observer));
|
||||
EXPECT_EQ(0, video_engine.capture->RegisterObserver(capture_id, observer));
|
||||
|
||||
// Enable brightness alarm.
|
||||
EXPECT_EQ(0, ViE.capture->EnableBrightnessAlarm(captureId, true));
|
||||
EXPECT_EQ(0, video_engine.capture->EnableBrightnessAlarm(capture_id, true));
|
||||
|
||||
CaptureEffectFilter effectFilter(176, 144);
|
||||
EXPECT_EQ(0, ViE.image_process->RegisterCaptureEffectFilter(captureId,
|
||||
effectFilter));
|
||||
CaptureEffectFilter effect_filter(176, 144);
|
||||
EXPECT_EQ(0, video_engine.image_process->RegisterCaptureEffectFilter(
|
||||
capture_id, effect_filter));
|
||||
|
||||
// Call started.
|
||||
ViETest::Log("You should see local preview from external capture\n"
|
||||
"in window 1 and the remote video in window 2.\n");
|
||||
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
// Engine ready. Begin testing class
|
||||
//***************************************************************
|
||||
const unsigned int videoFrameLength = (176 * 144 * 3) / 2;
|
||||
unsigned char* videoFrame = new unsigned char[videoFrameLength];
|
||||
memset(videoFrame, 128, 176 * 144);
|
||||
/// **************************************************************
|
||||
const unsigned int video_frame_length = (176 * 144 * 3) / 2;
|
||||
unsigned char* video_frame = new unsigned char[video_frame_length];
|
||||
memset(video_frame, 128, 176 * 144);
|
||||
|
||||
int frameCount = 0;
|
||||
int frame_count = 0;
|
||||
webrtc::VideoCaptureCapability capability;
|
||||
capability.width = 176;
|
||||
capability.height = 144;
|
||||
capability.rawType = webrtc::kVideoI420;
|
||||
|
||||
ViETest::Log("Testing external capturing and frame rate callbacks.");
|
||||
// TODO: Change when using a real file!
|
||||
// while (fread(videoFrame, videoFrameLength, 1, foreman) == 1)
|
||||
while (frameCount < 120)
|
||||
{
|
||||
externalCapture->IncomingFrame(
|
||||
videoFrame, videoFrameLength, capability,
|
||||
// TODO(mflodman) Change when using a real file!
|
||||
// while (fread(video_frame, video_frame_length, 1, foreman) == 1)
|
||||
while (frame_count < 120) {
|
||||
external_capture->IncomingFrame(
|
||||
video_frame, video_frame_length, capability,
|
||||
webrtc::TickTime::Now().MillisecondTimestamp());
|
||||
AutoTestSleep(33);
|
||||
|
||||
if (effectFilter.number_of_captured_frames_ > 2)
|
||||
{
|
||||
EXPECT_EQ(webrtc::Normal, observer._brightness) <<
|
||||
if (effect_filter.number_of_captured_frames_ > 2) {
|
||||
EXPECT_EQ(webrtc::Normal, observer.brightness_) <<
|
||||
"Brightness or picture alarm should not have been called yet.";
|
||||
EXPECT_EQ(webrtc::AlarmCleared, observer._alarm) <<
|
||||
EXPECT_EQ(webrtc::AlarmCleared, observer.alarm_) <<
|
||||
"Brightness or picture alarm should not have been called yet.";
|
||||
}
|
||||
frameCount++;
|
||||
frame_count++;
|
||||
}
|
||||
|
||||
// Test brightness alarm
|
||||
// Test bright image
|
||||
for (int i = 0; i < 176 * 144; ++i)
|
||||
{
|
||||
if (videoFrame[i] <= 155)
|
||||
videoFrame[i] = videoFrame[i] + 100;
|
||||
// Test brightness alarm.
|
||||
// Test bright image.
|
||||
for (int i = 0; i < 176 * 144; ++i) {
|
||||
if (video_frame[i] <= 155)
|
||||
video_frame[i] = video_frame[i] + 100;
|
||||
else
|
||||
videoFrame[i] = 255;
|
||||
video_frame[i] = 255;
|
||||
}
|
||||
ViETest::Log("Testing Brighness alarm");
|
||||
for (int frame = 0; frame < 30; ++frame)
|
||||
{
|
||||
externalCapture->IncomingFrame(
|
||||
videoFrame, videoFrameLength, capability,
|
||||
for (int frame = 0; frame < 30; ++frame) {
|
||||
external_capture->IncomingFrame(
|
||||
video_frame, video_frame_length, capability,
|
||||
webrtc::TickTime::Now().MillisecondTimestamp());
|
||||
AutoTestSleep(33);
|
||||
}
|
||||
EXPECT_EQ(webrtc::Bright, observer._brightness) <<
|
||||
EXPECT_EQ(webrtc::Bright, observer.brightness_) <<
|
||||
"Should be bright at this point since we are using a bright image.";
|
||||
|
||||
// Test Dark image
|
||||
for (int i = 0; i < 176 * 144; ++i)
|
||||
{
|
||||
videoFrame[i] = videoFrame[i] > 200 ? videoFrame[i] - 200 : 0;
|
||||
for (int i = 0; i < 176 * 144; ++i) {
|
||||
video_frame[i] = video_frame[i] > 200 ? video_frame[i] - 200 : 0;
|
||||
}
|
||||
for (int frame = 0; frame < 30; ++frame)
|
||||
{
|
||||
externalCapture->IncomingFrame(
|
||||
videoFrame, videoFrameLength, capability,
|
||||
for (int frame = 0; frame < 30; ++frame) {
|
||||
external_capture->IncomingFrame(
|
||||
video_frame, video_frame_length, capability,
|
||||
webrtc::TickTime::Now().MillisecondTimestamp());
|
||||
AutoTestSleep(33);
|
||||
}
|
||||
EXPECT_EQ(webrtc::Dark, observer._brightness) <<
|
||||
EXPECT_EQ(webrtc::Dark, observer.brightness_) <<
|
||||
"Should be dark at this point since we are using a dark image.";
|
||||
EXPECT_GT(effectFilter.number_of_captured_frames_, 150) <<
|
||||
EXPECT_GT(effect_filter.number_of_captured_frames_, 150) <<
|
||||
"Frames should have been played.";
|
||||
|
||||
EXPECT_GE(observer._frameRate, 29) <<
|
||||
EXPECT_GE(observer.frame_rate_, 29) <<
|
||||
"Frame rate callback should be approximately correct.";
|
||||
EXPECT_LE(observer._frameRate, 30) <<
|
||||
EXPECT_LE(observer.frame_rate_, 30) <<
|
||||
"Frame rate callback should be approximately correct.";
|
||||
|
||||
// Test no picture alarm
|
||||
ViETest::Log("Testing NoPictureAlarm.");
|
||||
AutoTestSleep(1050);
|
||||
|
||||
EXPECT_EQ(webrtc::AlarmRaised, observer._alarm) <<
|
||||
EXPECT_EQ(webrtc::AlarmRaised, observer.alarm_) <<
|
||||
"No picture alarm should be raised.";
|
||||
for (int frame = 0; frame < 10; ++frame)
|
||||
{
|
||||
externalCapture->IncomingFrame(
|
||||
videoFrame, videoFrameLength, capability,
|
||||
for (int frame = 0; frame < 10; ++frame) {
|
||||
external_capture->IncomingFrame(
|
||||
video_frame, video_frame_length, capability,
|
||||
webrtc::TickTime::Now().MillisecondTimestamp());
|
||||
AutoTestSleep(33);
|
||||
}
|
||||
EXPECT_EQ(webrtc::AlarmCleared, observer._alarm) <<
|
||||
EXPECT_EQ(webrtc::AlarmCleared, observer.alarm_) <<
|
||||
"Alarm should be cleared since ge just got some data.";
|
||||
|
||||
delete videoFrame;
|
||||
delete video_frame;
|
||||
|
||||
// Release the capture device
|
||||
EXPECT_EQ(0, ViE.capture->ReleaseCaptureDevice(captureId));
|
||||
EXPECT_EQ(0, video_engine.capture->ReleaseCaptureDevice(capture_id));
|
||||
|
||||
// Release the capture device again
|
||||
EXPECT_NE(0, ViE.capture->ReleaseCaptureDevice(captureId));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, ViE.LastError());
|
||||
EXPECT_NE(0, video_engine.capture->ReleaseCaptureDevice(capture_id));
|
||||
EXPECT_EQ(kViECaptureDeviceDoesNotExist, video_engine.LastError());
|
||||
vcpm->Release();
|
||||
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
// Testing finished. Tear down Video Engine
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
}
|
||||
|
@ -8,33 +8,33 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "vie_autotest_defines.h"
|
||||
#include "vie_autotest.h"
|
||||
#include "engine_configurations.h"
|
||||
#include "common_types.h" // NOLINT
|
||||
#include "engine_configurations.h" // NOLINT
|
||||
#include "video_engine/test/auto_test/interface/vie_autotest_defines.h"
|
||||
#include "video_engine/test/auto_test/interface/vie_autotest.h"
|
||||
#include "video_engine/test/libvietest/include/tb_capture_device.h"
|
||||
#include "video_engine/test/libvietest/include/tb_I420_codec.h"
|
||||
#include "video_engine/test/libvietest/include/tb_interfaces.h"
|
||||
#include "video_engine/test/libvietest/include/tb_video_channel.h"
|
||||
#include "video_engine/include/vie_base.h"
|
||||
#include "video_engine/include/vie_capture.h"
|
||||
#include "video_engine/include/vie_codec.h"
|
||||
#include "video_engine/include/vie_network.h"
|
||||
#include "video_engine/include/vie_render.h"
|
||||
#include "video_engine/include/vie_rtp_rtcp.h"
|
||||
#include "voice_engine/main/interface/voe_base.h"
|
||||
|
||||
#include "common_types.h"
|
||||
#include "tb_capture_device.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"
|
||||
|
||||
class TestCodecObserver : public webrtc::ViEEncoderObserver,
|
||||
class TestCodecObserver
|
||||
: public webrtc::ViEEncoderObserver,
|
||||
public webrtc::ViEDecoderObserver {
|
||||
public:
|
||||
public:
|
||||
int incoming_codec_called_;
|
||||
int incoming_rate_called_;
|
||||
int outgoing_rate_called_;
|
||||
|
||||
unsigned char last_payload_type_;
|
||||
unsigned short last_width_;
|
||||
unsigned short last_height_;
|
||||
uint16_t last_width_;
|
||||
uint16_t last_height_;
|
||||
|
||||
unsigned int last_outgoing_framerate_;
|
||||
unsigned int last_outgoing_bitrate_;
|
||||
@ -43,49 +43,51 @@ public:
|
||||
|
||||
webrtc::VideoCodec incoming_codec_;
|
||||
|
||||
TestCodecObserver() {
|
||||
incoming_codec_called_ = 0;
|
||||
incoming_rate_called_ = 0;
|
||||
outgoing_rate_called_ = 0;
|
||||
last_payload_type_ = 0;
|
||||
last_width_ = 0;
|
||||
last_height_ = 0;
|
||||
last_outgoing_framerate_ = 0;
|
||||
last_outgoing_bitrate_ = 0;
|
||||
last_incoming_framerate_ = 0;
|
||||
last_incoming_bitrate_ = 0;
|
||||
TestCodecObserver()
|
||||
: incoming_codec_called_(0),
|
||||
incoming_rate_called_(0),
|
||||
outgoing_rate_called_(0),
|
||||
last_payload_type_(0),
|
||||
last_width_(0),
|
||||
last_height_(0),
|
||||
last_outgoing_framerate_(0),
|
||||
last_outgoing_bitrate_(0),
|
||||
last_incoming_framerate_(0),
|
||||
last_incoming_bitrate_(0) {
|
||||
memset(&incoming_codec_, 0, sizeof(incoming_codec_));
|
||||
}
|
||||
virtual void IncomingCodecChanged(const int videoChannel,
|
||||
const webrtc::VideoCodec& videoCodec) {
|
||||
virtual void IncomingCodecChanged(const int video_channel,
|
||||
const webrtc::VideoCodec& video_codec) {
|
||||
incoming_codec_called_++;
|
||||
last_payload_type_ = videoCodec.plType;
|
||||
last_width_ = videoCodec.width;
|
||||
last_height_ = videoCodec.height;
|
||||
last_payload_type_ = video_codec.plType;
|
||||
last_width_ = video_codec.width;
|
||||
last_height_ = video_codec.height;
|
||||
|
||||
memcpy(&incoming_codec_, &videoCodec, sizeof(videoCodec));
|
||||
memcpy(&incoming_codec_, &video_codec, sizeof(video_codec));
|
||||
}
|
||||
|
||||
virtual void IncomingRate(const int videoChannel,
|
||||
const unsigned int framerate, const unsigned int bitrate) {
|
||||
virtual void IncomingRate(const int video_channel,
|
||||
const unsigned int framerate,
|
||||
const unsigned int bitrate) {
|
||||
incoming_rate_called_++;
|
||||
last_incoming_framerate_ += framerate;
|
||||
last_incoming_bitrate_ += bitrate;
|
||||
}
|
||||
|
||||
virtual void OutgoingRate(const int videoChannel,
|
||||
const unsigned int framerate, const unsigned int bitrate) {
|
||||
virtual void OutgoingRate(const int video_channel,
|
||||
const unsigned int framerate,
|
||||
const unsigned int bitrate) {
|
||||
outgoing_rate_called_++;
|
||||
last_outgoing_framerate_ += framerate;
|
||||
last_outgoing_bitrate_ += bitrate;
|
||||
}
|
||||
|
||||
virtual void RequestNewKeyFrame(const int videoChannel) {
|
||||
virtual void RequestNewKeyFrame(const int video_channel) {
|
||||
}
|
||||
};
|
||||
|
||||
class RenderFilter : public webrtc::ViEEffectFilter {
|
||||
public:
|
||||
public:
|
||||
int num_frames_;
|
||||
unsigned int last_render_width_;
|
||||
unsigned int last_render_height_;
|
||||
@ -99,8 +101,11 @@ public:
|
||||
virtual ~RenderFilter() {
|
||||
}
|
||||
|
||||
virtual int Transform(int size, unsigned char* frameBuffer,
|
||||
unsigned int timeStamp90KHz, unsigned int width, unsigned int height) {
|
||||
virtual int Transform(int size,
|
||||
unsigned char* frame_buffer,
|
||||
unsigned int time_stamp90KHz,
|
||||
unsigned int width,
|
||||
unsigned int height) {
|
||||
num_frames_++;
|
||||
last_render_width_ = width;
|
||||
last_render_height_ = height;
|
||||
@ -125,16 +130,16 @@ void ViEAutoTest::ViECodecStandardTest() {
|
||||
int video_channel = -1;
|
||||
EXPECT_EQ(0, base->CreateChannel(video_channel));
|
||||
EXPECT_EQ(0, capture->ConnectCaptureDevice(capture_id, video_channel));
|
||||
EXPECT_EQ( 0, rtp_rtcp->SetRTCPStatus(
|
||||
EXPECT_EQ(0, rtp_rtcp->SetRTCPStatus(
|
||||
video_channel, webrtc::kRtcpCompound_RFC4585));
|
||||
|
||||
EXPECT_EQ(0, rtp_rtcp->SetKeyFrameRequestMethod(
|
||||
video_channel, webrtc::kViEKeyFrameRequestPliRtcp));
|
||||
EXPECT_EQ(0, rtp_rtcp->SetTMMBRStatus(video_channel, true));
|
||||
EXPECT_EQ(0, render->AddRenderer(
|
||||
capture_id, _window1, 0, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, render->AddRenderer(
|
||||
video_channel, _window2, 1, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, render->AddRenderer(capture_id, _window1, 0, 0.0, 0.0, 1.0,
|
||||
1.0));
|
||||
EXPECT_EQ(0, render->AddRenderer(video_channel, _window2, 1, 0.0, 0.0, 1.0,
|
||||
1.0));
|
||||
EXPECT_EQ(0, render->StartRender(capture_id));
|
||||
EXPECT_EQ(0, render->StartRender(video_channel));
|
||||
|
||||
@ -142,7 +147,6 @@ void ViEAutoTest::ViECodecStandardTest() {
|
||||
memset(&video_codec, 0, sizeof(webrtc::VideoCodec));
|
||||
for (int idx = 0; idx < codec->NumberOfCodecs(); idx++) {
|
||||
EXPECT_EQ(0, codec->GetCodec(idx, video_codec));
|
||||
|
||||
if (video_codec.codecType != webrtc::kVideoCodecI420) {
|
||||
video_codec.width = 640;
|
||||
video_codec.height = 480;
|
||||
@ -163,22 +167,19 @@ void ViEAutoTest::ViECodecStandardTest() {
|
||||
}
|
||||
|
||||
const char* ip_address = "127.0.0.1";
|
||||
const unsigned short rtp_port = 6000;
|
||||
const uint16_t rtp_port = 6000;
|
||||
EXPECT_EQ(0, network->SetLocalReceiver(video_channel, rtp_port));
|
||||
EXPECT_EQ(0, base->StartReceive(video_channel));
|
||||
EXPECT_EQ(0, network->SetSendDestination(
|
||||
video_channel, ip_address, rtp_port));
|
||||
EXPECT_EQ(0, base->StartSend(video_channel));
|
||||
|
||||
//
|
||||
// Make sure all codecs runs
|
||||
//
|
||||
{
|
||||
webrtc::ViEImageProcess* image_process =
|
||||
webrtc::ViEImageProcess::GetInterface(video_engine);
|
||||
TestCodecObserver codec_observer;
|
||||
EXPECT_EQ(0, codec->RegisterDecoderObserver(
|
||||
video_channel, codec_observer));
|
||||
EXPECT_EQ(0, codec->RegisterDecoderObserver(video_channel, codec_observer));
|
||||
ViETest::Log("Loop through all codecs for %d seconds",
|
||||
KAutoTestSleepTimeMs / 1000);
|
||||
|
||||
@ -194,8 +195,8 @@ void ViEAutoTest::ViECodecStandardTest() {
|
||||
ViETest::Log("\t %d. %s", i, video_codec.plName);
|
||||
|
||||
RenderFilter frame_counter;
|
||||
EXPECT_EQ(0, image_process->RegisterRenderEffectFilter(
|
||||
video_channel, frame_counter));
|
||||
EXPECT_EQ(0, image_process->RegisterRenderEffectFilter(video_channel,
|
||||
frame_counter));
|
||||
AutoTestSleep(KAutoTestSleepTimeMs);
|
||||
|
||||
// Verify we've received and decoded correct payload.
|
||||
@ -211,8 +212,7 @@ void ViEAutoTest::ViECodecStandardTest() {
|
||||
} else {
|
||||
#ifdef WEBRTC_ANDROID
|
||||
// To get the autotest to pass on some slow devices
|
||||
EXPECT_GT(
|
||||
frame_counter.num_frames_, max_number_of_possible_frames / 6);
|
||||
EXPECT_GT(frame_counter.num_frames_, max_number_of_possible_frames / 6);
|
||||
#else
|
||||
EXPECT_GT(frame_counter.num_frames_, max_number_of_possible_frames / 4);
|
||||
#endif
|
||||
@ -226,15 +226,10 @@ void ViEAutoTest::ViECodecStandardTest() {
|
||||
ViETest::Log("Done!");
|
||||
}
|
||||
|
||||
//
|
||||
// Test Callbacks
|
||||
//
|
||||
|
||||
TestCodecObserver codecObserver;
|
||||
EXPECT_EQ(0, codec->RegisterEncoderObserver(
|
||||
video_channel, codecObserver));
|
||||
EXPECT_EQ(0, codec->RegisterDecoderObserver(
|
||||
video_channel, codecObserver));
|
||||
TestCodecObserver codec_observer;
|
||||
EXPECT_EQ(0, codec->RegisterEncoderObserver(video_channel, codec_observer));
|
||||
EXPECT_EQ(0, codec->RegisterDecoderObserver(video_channel, codec_observer));
|
||||
|
||||
ViETest::Log("\nTesting codec callbacks...");
|
||||
|
||||
@ -251,9 +246,9 @@ void ViEAutoTest::ViECodecStandardTest() {
|
||||
EXPECT_EQ(0, codec->DeregisterEncoderObserver(video_channel));
|
||||
EXPECT_EQ(0, codec->DeregisterDecoderObserver(video_channel));
|
||||
|
||||
EXPECT_GT(codecObserver.incoming_codec_called_, 0);
|
||||
EXPECT_GT(codecObserver.incoming_rate_called_, 0);
|
||||
EXPECT_GT(codecObserver.outgoing_rate_called_, 0);
|
||||
EXPECT_GT(codec_observer.incoming_codec_called_, 0);
|
||||
EXPECT_GT(codec_observer.incoming_rate_called_, 0);
|
||||
EXPECT_GT(codec_observer.outgoing_rate_called_, 0);
|
||||
|
||||
EXPECT_EQ(0, base->StopReceive(video_channel));
|
||||
EXPECT_EQ(0, render->StopRender(video_channel));
|
||||
@ -292,11 +287,11 @@ void ViEAutoTest::ViECodecExtendedTest() {
|
||||
EXPECT_EQ(0, rtp_rtcp->SetKeyFrameRequestMethod(
|
||||
video_channel, webrtc::kViEKeyFrameRequestPliRtcp));
|
||||
EXPECT_EQ(0, rtp_rtcp->SetTMMBRStatus(video_channel, true));
|
||||
EXPECT_EQ(0, render->AddRenderer(
|
||||
capture_id, _window1, 0, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, render->AddRenderer(capture_id, _window1, 0, 0.0, 0.0, 1.0,
|
||||
1.0));
|
||||
|
||||
EXPECT_EQ(0, render->AddRenderer(
|
||||
video_channel, _window2, 1, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, render->AddRenderer(video_channel, _window2, 1, 0.0, 0.0, 1.0,
|
||||
1.0));
|
||||
EXPECT_EQ(0, render->StartRender(capture_id));
|
||||
EXPECT_EQ(0, render->StartRender(video_channel));
|
||||
|
||||
@ -312,16 +307,14 @@ void ViEAutoTest::ViECodecExtendedTest() {
|
||||
}
|
||||
|
||||
const char* ip_address = "127.0.0.1";
|
||||
const unsigned short rtp_port = 6000;
|
||||
const uint16_t rtp_port = 6000;
|
||||
EXPECT_EQ(0, network->SetLocalReceiver(video_channel, rtp_port));
|
||||
EXPECT_EQ(0, base->StartReceive(video_channel));
|
||||
EXPECT_EQ(0, network->SetSendDestination(
|
||||
video_channel, ip_address, rtp_port));
|
||||
EXPECT_EQ(0, base->StartSend(video_channel));
|
||||
|
||||
//
|
||||
// Codec specific tests
|
||||
//
|
||||
memset(&video_codec, 0, sizeof(webrtc::VideoCodec));
|
||||
EXPECT_EQ(0, base->StopSend(video_channel));
|
||||
|
||||
@ -337,16 +330,13 @@ void ViEAutoTest::ViECodecExtendedTest() {
|
||||
EXPECT_EQ(0, base->DeleteChannel(video_channel));
|
||||
}
|
||||
|
||||
//
|
||||
// Multiple send channels.
|
||||
//
|
||||
{
|
||||
// Create two channels, where the second channel is created from the
|
||||
// first channel. Send different resolutions on the channels and verify
|
||||
// the received streams.
|
||||
|
||||
TbInterfaces video_engine("ViECodecExtendedTest2");
|
||||
TbCaptureDevice tbCapture(video_engine);
|
||||
TbCaptureDevice tb_capture(video_engine);
|
||||
|
||||
// Create channel 1.
|
||||
int video_channel_1 = -1;
|
||||
@ -359,8 +349,8 @@ void ViEAutoTest::ViECodecExtendedTest() {
|
||||
EXPECT_NE(video_channel_1, video_channel_2)
|
||||
<< "Channel 2 should be unique.";
|
||||
|
||||
unsigned short rtp_port_1 = 12000;
|
||||
unsigned short rtp_port_2 = 13000;
|
||||
uint16_t rtp_port_1 = 12000;
|
||||
uint16_t rtp_port_2 = 13000;
|
||||
EXPECT_EQ(0, video_engine.network->SetLocalReceiver(
|
||||
video_channel_1, rtp_port_1));
|
||||
EXPECT_EQ(0, video_engine.network->SetSendDestination(
|
||||
@ -369,47 +359,46 @@ void ViEAutoTest::ViECodecExtendedTest() {
|
||||
video_channel_2, rtp_port_2));
|
||||
EXPECT_EQ(0, video_engine.network->SetSendDestination(
|
||||
video_channel_2, "127.0.0.1", rtp_port_2));
|
||||
|
||||
tbCapture.ConnectTo(video_channel_1);
|
||||
tbCapture.ConnectTo(video_channel_2);
|
||||
|
||||
tb_capture.ConnectTo(video_channel_1);
|
||||
tb_capture.ConnectTo(video_channel_2);
|
||||
EXPECT_EQ(0, video_engine.rtp_rtcp->SetKeyFrameRequestMethod(
|
||||
video_channel_1, webrtc::kViEKeyFrameRequestPliRtcp));
|
||||
EXPECT_EQ(0, video_engine.rtp_rtcp->SetKeyFrameRequestMethod(
|
||||
video_channel_2, webrtc::kViEKeyFrameRequestPliRtcp));
|
||||
EXPECT_EQ(0, video_engine.render->AddRenderer(
|
||||
video_channel_1, _window1, 0, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, video_engine.render->AddRenderer(video_channel_1, _window1, 0,
|
||||
0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, video_engine.render->StartRender(video_channel_1));
|
||||
EXPECT_EQ(0, video_engine.render->AddRenderer(
|
||||
video_channel_2, _window2, 0, 0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, video_engine.render->AddRenderer(video_channel_2, _window2, 0,
|
||||
0.0, 0.0, 1.0, 1.0));
|
||||
EXPECT_EQ(0, video_engine.render->StartRender(video_channel_2));
|
||||
|
||||
// Set Send codec
|
||||
unsigned short codecWidth = 320;
|
||||
unsigned short codecHeight = 240;
|
||||
bool codecSet = false;
|
||||
webrtc::VideoCodec videoCodec;
|
||||
webrtc::VideoCodec sendCodec1;
|
||||
webrtc::VideoCodec sendCodec2;
|
||||
// Set Send codec.
|
||||
uint16_t codec_width = 320;
|
||||
uint16_t codec_height = 240;
|
||||
bool codec_set = false;
|
||||
webrtc::VideoCodec video_codec;
|
||||
webrtc::VideoCodec send_codec1;
|
||||
webrtc::VideoCodec send_codec2;
|
||||
for (int idx = 0; idx < video_engine.codec->NumberOfCodecs(); idx++) {
|
||||
EXPECT_EQ(0, video_engine.codec->GetCodec(idx, videoCodec));
|
||||
EXPECT_EQ(0, video_engine.codec->SetReceiveCodec(
|
||||
video_channel_1, videoCodec));
|
||||
if (videoCodec.codecType == webrtc::kVideoCodecVP8) {
|
||||
memcpy(&sendCodec1, &videoCodec, sizeof(videoCodec));
|
||||
sendCodec1.width = codecWidth;
|
||||
sendCodec1.height = codecHeight;
|
||||
EXPECT_EQ(0, video_engine.codec->GetCodec(idx, video_codec));
|
||||
EXPECT_EQ(0, video_engine.codec->SetReceiveCodec(video_channel_1,
|
||||
video_codec));
|
||||
if (video_codec.codecType == webrtc::kVideoCodecVP8) {
|
||||
memcpy(&send_codec1, &video_codec, sizeof(video_codec));
|
||||
send_codec1.width = codec_width;
|
||||
send_codec1.height = codec_height;
|
||||
EXPECT_EQ(0, video_engine.codec->SetSendCodec(
|
||||
video_channel_1, sendCodec1));
|
||||
memcpy(&sendCodec2, &videoCodec, sizeof(videoCodec));
|
||||
sendCodec2.width = 2 * codecWidth;
|
||||
sendCodec2.height = 2 * codecHeight;
|
||||
video_channel_1, send_codec1));
|
||||
memcpy(&send_codec2, &video_codec, sizeof(video_codec));
|
||||
send_codec2.width = 2 * codec_width;
|
||||
send_codec2.height = 2 * codec_height;
|
||||
EXPECT_EQ(0, video_engine.codec->SetSendCodec(
|
||||
video_channel_2, sendCodec2));
|
||||
codecSet = true;
|
||||
video_channel_2, send_codec2));
|
||||
codec_set = true;
|
||||
break;
|
||||
}
|
||||
}EXPECT_TRUE(codecSet);
|
||||
}
|
||||
EXPECT_TRUE(codec_set);
|
||||
|
||||
// We need to verify using render effect filter since we won't trigger
|
||||
// a decode reset in loopback (due to using the same SSRC).
|
||||
@ -436,10 +425,10 @@ void ViEAutoTest::ViECodecExtendedTest() {
|
||||
video_channel_1));
|
||||
EXPECT_EQ(0, video_engine.image_process->DeregisterRenderEffectFilter(
|
||||
video_channel_2));
|
||||
EXPECT_EQ(sendCodec1.width, filter1.last_render_width_);
|
||||
EXPECT_EQ(sendCodec1.height, filter1.last_render_height_);
|
||||
EXPECT_EQ(sendCodec2.width, filter2.last_render_width_);
|
||||
EXPECT_EQ(sendCodec2.height, filter2.last_render_height_);
|
||||
EXPECT_EQ(send_codec1.width, filter1.last_render_width_);
|
||||
EXPECT_EQ(send_codec1.height, filter1.last_render_height_);
|
||||
EXPECT_EQ(send_codec2.width, filter2.last_render_width_);
|
||||
EXPECT_EQ(send_codec2.height, filter2.last_render_height_);
|
||||
|
||||
EXPECT_EQ(0, video_engine.base->DeleteChannel(video_channel_1));
|
||||
EXPECT_EQ(0, video_engine.base->DeleteChannel(video_channel_2));
|
||||
@ -467,7 +456,6 @@ void ViEAutoTest::ViECodecAPITest() {
|
||||
|
||||
for (int i = 0; i < number_of_codecs; i++) {
|
||||
EXPECT_EQ(0, codec->GetCodec(i, video_codec));
|
||||
|
||||
if (video_codec.codecType == webrtc::kVideoCodecVP8) {
|
||||
EXPECT_EQ(0, codec->SetSendCodec(video_channel, video_codec));
|
||||
break;
|
||||
@ -496,263 +484,247 @@ void ViEAutoTest::ViECodecAPITest() {
|
||||
}
|
||||
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
|
||||
#include "vie_external_codec.h"
|
||||
#include "video_engine/include/vie_external_codec.h"
|
||||
#endif
|
||||
void ViEAutoTest::ViECodecExternalCodecTest() {
|
||||
ViETest::Log(" ");
|
||||
ViETest::Log("========================================");
|
||||
ViETest::Log(" ViEExternalCodec Test\n");
|
||||
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
// Begin create/initialize WebRTC Video Engine for testing
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
// Engine ready. Begin testing class
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
|
||||
#ifdef WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API
|
||||
int numberOfErrors=0;
|
||||
int number_of_errors = 0;
|
||||
{
|
||||
int error=0;
|
||||
int error = 0;
|
||||
TbInterfaces ViE("ViEExternalCodec");
|
||||
TbCaptureDevice captureDevice(ViE);
|
||||
TbVideoChannel channel(ViE, webrtc::kVideoCodecI420,
|
||||
352,288,30,(352*288*3*8*30)/(2*1000));
|
||||
TbCaptureDevice capture_device(ViE);
|
||||
TbVideoChannel channel(ViE, webrtc::kVideoCodecI420, 352, 288, 30,
|
||||
(352 * 288 * 3 * 8 * 30) / (2 * 1000));
|
||||
capture_device.ConnectTo(channel.videoChannel);
|
||||
|
||||
captureDevice.ConnectTo(channel.videoChannel);
|
||||
|
||||
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",
|
||||
error = ViE.render->AddRenderer(channel.videoChannel, _window1, 0, 0.0, 0.0,
|
||||
1.0, 1.0);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
error = ViE.render->StartRender(channel.videoChannel);
|
||||
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
channel.StartReceive();
|
||||
channel.StartSend();
|
||||
|
||||
ViETest::Log("Using internal I420 codec");
|
||||
AutoTestSleep(KAutoTestSleepTimeMs/2);
|
||||
AutoTestSleep(KAutoTestSleepTimeMs / 2);
|
||||
|
||||
webrtc::ViEExternalCodec* ptrViEExtCodec =
|
||||
webrtc::ViEExternalCodec* vie_external_codec =
|
||||
webrtc::ViEExternalCodec::GetInterface(ViE.video_engine);
|
||||
numberOfErrors += ViETest::TestError(ptrViEExtCodec != NULL,
|
||||
number_of_errors += ViETest::TestError(vie_external_codec != NULL,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
webrtc::VideoCodec codec_struct;
|
||||
error = ViE.codec->GetSendCodec(channel.videoChannel, codecStruct);
|
||||
number_of_errors += ViETest::TestError(vie_external_codec != NULL,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
webrtc::VideoCodec codecStruct;
|
||||
|
||||
error=ViE.codec->GetSendCodec(channel.videoChannel,codecStruct);
|
||||
numberOfErrors += ViETest::TestError(ptrViEExtCodec != NULL,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
// Use external encoder instead
|
||||
// Use external encoder instead.
|
||||
{
|
||||
TbI420Encoder extEncoder;
|
||||
TbI420Encoder ext_encoder;
|
||||
|
||||
// Test to register on wrong channel
|
||||
error = ptrViEExtCodec->RegisterExternalSendCodec(
|
||||
channel.videoChannel+5,codecStruct.plType,&extEncoder);
|
||||
numberOfErrors += ViETest::TestError(error == -1,
|
||||
// Test to register on wrong channel.
|
||||
error = vie_external_codec->RegisterExternalSendCodec(
|
||||
channel.videoChannel + 5, codecStruct.plType, &ext_encoder);
|
||||
number_of_errors += ViETest::TestError(error == -1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(
|
||||
number_of_errors += ViETest::TestError(
|
||||
ViE.LastError() == kViECodecInvalidArgument,
|
||||
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
|
||||
|
||||
error = ptrViEExtCodec->RegisterExternalSendCodec(
|
||||
channel.videoChannel,codecStruct.plType,&extEncoder);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
error = vie_external_codec->RegisterExternalSendCodec(
|
||||
channel.videoChannel, codecStruct.plType, &ext_encoder);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
// Use new external encoder
|
||||
error = ViE.codec->SetSendCodec(channel.videoChannel,codecStruct);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
error = ViE.codec->SetSendCodec(channel.videoChannel, codecStruct);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
TbI420Decoder extDecoder;
|
||||
error = ptrViEExtCodec->RegisterExternalReceiveCodec(
|
||||
channel.videoChannel,codecStruct.plType,&extDecoder);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
TbI420Decoder ext_decoder;
|
||||
error = vie_external_codec->RegisterExternalReceiveCodec(
|
||||
channel.videoChannel, codecStruct.plType, &ext_decoder);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
error = ViE.codec->SetReceiveCodec(channel.videoChannel,
|
||||
codecStruct);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
error = ViE.codec->SetReceiveCodec(channel.videoChannel, codec_struct);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
ViETest::Log("Using external I420 codec");
|
||||
AutoTestSleep(KAutoTestSleepTimeMs);
|
||||
|
||||
// Test to deregister on wrong channel
|
||||
error = ptrViEExtCodec->DeRegisterExternalSendCodec(
|
||||
channel.videoChannel+5,codecStruct.plType);
|
||||
numberOfErrors += ViETest::TestError(error == -1,
|
||||
error = vie_external_codec->DeRegisterExternalSendCodec(
|
||||
channel.videoChannel + 5, codecStruct.plType);
|
||||
number_of_errors += ViETest::TestError(error == -1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(
|
||||
ViE.LastError() == kViECodecInvalidArgument,
|
||||
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
|
||||
number_of_errors += ViETest::TestError(
|
||||
ViE.LastError() == kViECodecInvalidArgument, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
// Test to deregister wrong payload type.
|
||||
error = ptrViEExtCodec->DeRegisterExternalSendCodec(
|
||||
channel.videoChannel,codecStruct.plType-1);
|
||||
numberOfErrors += ViETest::TestError(error == -1,
|
||||
error = vie_external_codec->DeRegisterExternalSendCodec(
|
||||
channel.videoChannel, codecStruct.plType - 1);
|
||||
number_of_errors += ViETest::TestError(error == -1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
// Deregister external send codec
|
||||
error = ptrViEExtCodec->DeRegisterExternalSendCodec(
|
||||
channel.videoChannel,codecStruct.plType);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
|
||||
error = vie_external_codec->DeRegisterExternalSendCodec(
|
||||
channel.videoChannel, codecStruct.plType);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
error = ptrViEExtCodec->DeRegisterExternalReceiveCodec(
|
||||
channel.videoChannel,codecStruct.plType);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
error = vie_external_codec->DeRegisterExternalReceiveCodec(
|
||||
channel.videoChannel, codecStruct.plType);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
// Verify that the encoder and decoder has been used
|
||||
TbI420Encoder::FunctionCalls encodeCalls =
|
||||
extEncoder.GetFunctionCalls();
|
||||
numberOfErrors += ViETest::TestError(encodeCalls.InitEncode == 1,
|
||||
TbI420Encoder::FunctionCalls encode_calls =
|
||||
ext_encoder.GetFunctionCalls();
|
||||
number_of_errors += ViETest::TestError(encode_calls.InitEncode == 1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(encodeCalls.Release == 1,
|
||||
number_of_errors += ViETest::TestError(encode_calls.Release == 1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(encodeCalls.Encode > 30,
|
||||
number_of_errors += ViETest::TestError(encode_calls.Encode > 30,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(
|
||||
encodeCalls.RegisterEncodeCompleteCallback ==1,
|
||||
number_of_errors += ViETest::TestError(
|
||||
encode_calls.RegisterEncodeCompleteCallback == 1,
|
||||
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(encodeCalls.SetRates > 1,
|
||||
number_of_errors += ViETest::TestError(encode_calls.SetRates > 1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(encodeCalls.SetPacketLoss > 1,
|
||||
number_of_errors += ViETest::TestError(encode_calls.SetPacketLoss > 1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
TbI420Decoder::FunctionCalls decodeCalls =
|
||||
extDecoder.GetFunctionCalls();
|
||||
numberOfErrors += ViETest::TestError(decodeCalls.InitDecode == 1,
|
||||
TbI420Decoder::FunctionCalls decode_calls =
|
||||
ext_decoder.GetFunctionCalls();
|
||||
number_of_errors += ViETest::TestError(decode_calls.InitDecode == 1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(decodeCalls.Release == 1,
|
||||
number_of_errors += ViETest::TestError(decode_calls.Release == 1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(decodeCalls.Decode > 30,
|
||||
number_of_errors += ViETest::TestError(decode_calls.Decode > 30,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(
|
||||
decodeCalls.RegisterDecodeCompleteCallback ==1,
|
||||
number_of_errors += ViETest::TestError(
|
||||
decode_calls.RegisterDecodeCompleteCallback == 1,
|
||||
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
|
||||
|
||||
ViETest::Log("Changing payload type Using external I420 codec");
|
||||
|
||||
codecStruct.plType=codecStruct.plType-1;
|
||||
error = ptrViEExtCodec->RegisterExternalReceiveCodec(
|
||||
channel.videoChannel, codecStruct.plType, &extDecoder);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
codec_struct.plType = codecStruct.plType - 1;
|
||||
error = vie_external_codec->RegisterExternalReceiveCodec(
|
||||
channel.videoChannel, codec_struct.plType, &ext_decoder);
|
||||
number_of_errors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
error = ViE.codec->SetReceiveCodec(channel.videoChannel,
|
||||
codecStruct);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
codec_struct);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
error = ptrViEExtCodec->RegisterExternalSendCodec(
|
||||
channel.videoChannel, codecStruct.plType, &extEncoder);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
error = vie_external_codec->RegisterExternalSendCodec(
|
||||
channel.videoChannel, codec_struct.plType, &ext_encoder);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
// Use new external encoder
|
||||
error = ViE.codec->SetSendCodec(channel.videoChannel,
|
||||
codecStruct);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
codec_struct);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
AutoTestSleep(KAutoTestSleepTimeMs/2);
|
||||
AutoTestSleep(KAutoTestSleepTimeMs / 2);
|
||||
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
// Testing finished. Tear down Video Engine
|
||||
//***************************************************************
|
||||
/// **************************************************************
|
||||
|
||||
error = ptrViEExtCodec->DeRegisterExternalSendCodec(
|
||||
channel.videoChannel,codecStruct.plType);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
error = vie_external_codec->DeRegisterExternalSendCodec(
|
||||
channel.videoChannel, codecStruct.plType);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
error = ptrViEExtCodec->DeRegisterExternalReceiveCodec(
|
||||
channel.videoChannel,codecStruct.plType);
|
||||
numberOfErrors += ViETest::TestError(error == 0,
|
||||
"ERROR: %s at line %d",
|
||||
error = vie_external_codec->DeRegisterExternalReceiveCodec(
|
||||
channel.videoChannel, codecStruct.plType);
|
||||
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
// Verify that the encoder and decoder has been used
|
||||
encodeCalls = extEncoder.GetFunctionCalls();
|
||||
numberOfErrors += ViETest::TestError(encodeCalls.InitEncode == 2,
|
||||
encode_calls = ext_encoder.GetFunctionCalls();
|
||||
number_of_errors += ViETest::TestError(encode_calls.InitEncode == 2,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(encodeCalls.Release == 2,
|
||||
number_of_errors += ViETest::TestError(encode_calls.Release == 2,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(encodeCalls.Encode > 30,
|
||||
number_of_errors += ViETest::TestError(encode_calls.Encode > 30,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(
|
||||
encodeCalls.RegisterEncodeCompleteCallback == 2,
|
||||
number_of_errors += ViETest::TestError(
|
||||
encode_calls.RegisterEncodeCompleteCallback == 2,
|
||||
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(encodeCalls.SetRates > 1,
|
||||
number_of_errors += ViETest::TestError(encode_calls.SetRates > 1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(encodeCalls.SetPacketLoss > 1,
|
||||
number_of_errors += ViETest::TestError(encode_calls.SetPacketLoss > 1,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
decodeCalls = extDecoder.GetFunctionCalls();
|
||||
numberOfErrors += ViETest::TestError(decodeCalls.InitDecode == 2,
|
||||
decode_calls = ext_decoder.GetFunctionCalls();
|
||||
number_of_errors += ViETest::TestError(decode_calls.InitDecode == 2,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(decodeCalls.Release == 2,
|
||||
number_of_errors += ViETest::TestError(decode_calls.Release == 2,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(decodeCalls.Decode > 30,
|
||||
number_of_errors += ViETest::TestError(decode_calls.Decode > 30,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
numberOfErrors += ViETest::TestError(
|
||||
decodeCalls.RegisterDecodeCompleteCallback == 2,
|
||||
number_of_errors += ViETest::TestError(
|
||||
decode_calls.RegisterDecodeCompleteCallback == 2,
|
||||
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
|
||||
|
||||
int remainingInterfaces = ptrViEExtCodec->Release();
|
||||
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
|
||||
int remaining_interfaces = vie_external_codec->Release();
|
||||
number_of_errors += ViETest::TestError(remaining_interfaces == 0,
|
||||
"ERROR: %s at line %d",
|
||||
__FUNCTION__, __LINE__);
|
||||
} // tbI420Encoder and extDecoder goes out of scope
|
||||
} // tbI420Encoder and ext_decoder goes out of scope.
|
||||
|
||||
ViETest::Log("Using internal I420 codec");
|
||||
AutoTestSleep(KAutoTestSleepTimeMs/2);
|
||||
|
||||
AutoTestSleep(KAutoTestSleepTimeMs / 2);
|
||||
}
|
||||
if (numberOfErrors > 0)
|
||||
{
|
||||
if (number_of_errors > 0) {
|
||||
// Test failed
|
||||
ViETest::Log(" ");
|
||||
ViETest::Log(" ERROR ViEExternalCodec Test FAILED!");
|
||||
ViETest::Log(" Number of errors: %d", numberOfErrors);
|
||||
ViETest::Log(" Number of errors: %d", number_of_errors);
|
||||
ViETest::Log("========================================");
|
||||
ViETest::Log(" ");
|
||||
return;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user