Fixed ViE AutoTest trace file names to be consistent

Fixed some space issues in vie_autotest_custom_call.cc
Fixed incorrect default codec W&H for I420 in vie_autotest_custom_call.cc
Added functionality to modify a running custom call.  The following options were added:
0. Finished modifying custom call
1. Change Video Codec
2. Change Video Size by Common Resolutions
3. Change Video Size by Width & Height
4. Change Video Device
5. Record Incoming Call
6. Record Outgoing Call
7. Play File on Video Channel(Assumes you recorded incoming & outgoing call)
8. Print Call information

Tested with r670, builds fine on Ubuntu & Win7.  Mac is not building due to changes in r666, but this patch should be fine on top of it mac as well (compiles fine with r661).
Review URL: http://webrtc-codereview.appspot.com/188003

git-svn-id: http://webrtc.googlecode.com/svn/trunk@728 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
amyfong@webrtc.org 2011-10-11 18:17:22 +00:00
parent ea89922b56
commit 6330cf2a14
7 changed files with 555 additions and 179 deletions

View File

@ -69,8 +69,14 @@ public:
// video settings functions // video settings functions
bool GetVideoPorts(int* txPort, int* rxPort); bool GetVideoPorts(int* txPort, int* rxPort);
bool GetVideoCodec(webrtc::ViECodec* ptrViECodec, bool GetVideoCodecType(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec); webrtc::VideoCodec& videoCodec);
bool GetVideoCodecResolution(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec);
bool GetVideoCodecSize(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec);
bool GetVideoCodecBitrate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec);
// audio settings functions // audio settings functions
bool GetAudioDevices(webrtc::VoEBase* ptrVEBase, bool GetAudioDevices(webrtc::VoEBase* ptrVEBase,

View File

@ -55,6 +55,8 @@
#define DEFAULT_VIDEO_CODEC_BITRATE 100 #define DEFAULT_VIDEO_CODEC_BITRATE 100
#define DEFAULT_AUDIO_PORT 11113 #define DEFAULT_AUDIO_PORT 11113
#define DEFAULT_AUDIO_CODEC "isac" #define DEFAULT_AUDIO_CODEC "isac"
#define DEFAULT_INCOMING_FILE_NAME "IncomingFile.avi"
#define DEFAULT_OUTGOING_FILE_NAME "OutgoingFile.avi"
enum enum
{ {

View File

@ -14,14 +14,12 @@ tbInterfaces::tbInterfaces(const char* testName, int& nrOfErrors) :
numberOfErrors(nrOfErrors) numberOfErrors(nrOfErrors)
{ {
char traceFile[256] = ""; char traceFile[256] = "";
char traceFileEnc[256] = "";
#ifdef WEBRTC_ANDROID #ifdef WEBRTC_ANDROID
strcat(traceFile,"/sdcard/"); strcat(traceFile,"/sdcard/");
#endif #endif
strcat(traceFile, testName); strcat(traceFile, testName);
strcat(traceFileEnc, traceFile); strcat(traceFile, "_trace.txt");
strcat(traceFileEnc, "_encrypted");
ViETest::Log("Creating ViE Interfaces for test %s\n", testName); ViETest::Log("Creating ViE Interfaces for test %s\n", testName);

View File

@ -38,12 +38,12 @@ int ViEAutoTest::ViEBaseStandardTest()
"ERROR: %s at line %d", __FUNCTION__, "ERROR: %s at line %d", __FUNCTION__,
__LINE__); __LINE__);
#ifdef WEBRTC_ANDROID #ifdef WEBRTC_ANDROID
error = ptrViE->SetTraceFile("/sdcard/ViEBaseStandardTest.txt"); error = ptrViE->SetTraceFile("/sdcard/ViEBaseStandardTest_trace.txt");
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", __FUNCTION__, "ERROR: %s at line %d", __FUNCTION__,
__LINE__); __LINE__);
#else #else
error = ptrViE->SetTraceFile("ViEBaseStandardTest.txt"); error = ptrViE->SetTraceFile("ViEBaseStandardTest_trace.txt");
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d", numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
#endif #endif
@ -419,14 +419,10 @@ int ViEAutoTest::ViEBaseAPITest()
numberOfErrors += ViETest::TestError(ptrViE != NULL, "VideoEngine::Create"); numberOfErrors += ViETest::TestError(ptrViE != NULL, "VideoEngine::Create");
#ifdef WEBRTC_ANDROID #ifdef WEBRTC_ANDROID
error = ptrViE->SetTraceFile("/sdcard/WebRTC/ViESampleCodeTrace.txt"); error = ptrViE->SetTraceFile("/sdcard/WebRTC/ViEBaseAPI_trace.txt");
numberOfErrors += ViETest::TestError(error == 0, "SetTraceFile error"); numberOfErrors += ViETest::TestError(error == 0, "SetTraceFile error");
error = ptrViE->SetTraceFile(
"/sdcard/WebRTC/ViESampleCodeTraceEncrypted.txt");
numberOfErrors += ViETest::TestError(error == 0, "SetTraceFile");
#else #else
error = ptrViE->SetTraceFile("WebRTCViESampleCodeTrace.txt"); error = ptrViE->SetTraceFile("ViEBaseAPI_trace.txt");
numberOfErrors += ViETest::TestError(error == 0, "SetTraceFile error"); numberOfErrors += ViETest::TestError(error == 0, "SetTraceFile error");
#endif #endif

View File

@ -135,7 +135,7 @@ int ViEAutoTest::ViECaptureStandardTest()
int error = 0; int error = 0;
tbInterfaces ViE("WebRTCViECapture_Standard", numberOfErrors); tbInterfaces ViE("ViECaptureStandardTest", numberOfErrors);
webrtc::VideoCaptureModule::DeviceInfo* devInfo = webrtc::VideoCaptureModule::DeviceInfo* devInfo =
webrtc::VideoCaptureFactory::CreateDeviceInfo(0); webrtc::VideoCaptureFactory::CreateDeviceInfo(0);
@ -377,7 +377,7 @@ int ViEAutoTest::ViECaptureAPITest()
//*************************************************************** //***************************************************************
int error = 0; int error = 0;
tbInterfaces ViE("WebRTCViECapture_API", numberOfErrors); tbInterfaces ViE("ViECapture_API", numberOfErrors);
ViE.ptrViECapture->NumberOfCaptureDevices(); ViE.ptrViECapture->NumberOfCaptureDevices();
@ -598,7 +598,7 @@ int ViEAutoTest::ViECaptureExternalCaptureTest()
int error = 0; int error = 0;
tbInterfaces ViE("WebRTCViECapture_ExternalCapture", numberOfErrors); tbInterfaces ViE("ViECapture_ExternalCapture", numberOfErrors);
tbVideoChannel channel(ViE, numberOfErrors); tbVideoChannel channel(ViE, numberOfErrors);
channel.StartReceive(); channel.StartReceive();
channel.StartSend(); channel.StartSend();

View File

@ -21,9 +21,20 @@
#define VCM_RED_PAYLOAD_TYPE 96 #define VCM_RED_PAYLOAD_TYPE 96
#define VCM_ULPFEC_PAYLOAD_TYPE 97 #define VCM_ULPFEC_PAYLOAD_TYPE 97
class ViEAutotestFileObserver: public webrtc::ViEFileObserver
{
public:
ViEAutotestFileObserver() {};
~ViEAutotestFileObserver() {};
void PlayFileEnded(const WebRtc_Word32 fileId)
{
ViETest::Log("PlayFile ended");
}
};
int ViEAutoTest::ViECustomCall() int ViEAutoTest::ViECustomCall()
{ {
ViETest::Log(" "); ViETest::Log(" ");
ViETest::Log("========================================"); ViETest::Log("========================================");
ViETest::Log(" Enter values to use custom settings\n"); ViETest::Log(" Enter values to use custom settings\n");
@ -52,13 +63,13 @@ int ViEAutoTest::ViECustomCall()
__LINE__); __LINE__);
webrtc::VoEHardware* ptrVEHardware = webrtc::VoEHardware* ptrVEHardware =
webrtc::VoEHardware::GetInterface(ptrVE); webrtc::VoEHardware::GetInterface(ptrVE);
numberOfErrors += ViETest::TestError(ptrVEHardware != NULL, numberOfErrors += ViETest::TestError(ptrVEHardware != NULL,
"ERROR: %s at line %d", __FUNCTION__, "ERROR: %s at line %d", __FUNCTION__,
__LINE__); __LINE__);
webrtc::VoEAudioProcessing* ptrVEAPM = webrtc::VoEAudioProcessing* ptrVEAPM =
webrtc::VoEAudioProcessing::GetInterface(ptrVE); webrtc::VoEAudioProcessing::GetInterface(ptrVE);
numberOfErrors += ViETest::TestError(ptrVEAPM != NULL, numberOfErrors += ViETest::TestError(ptrVEAPM != NULL,
"ERROR: %s at line %d", __FUNCTION__, "ERROR: %s at line %d", __FUNCTION__,
__LINE__); __LINE__);
@ -78,8 +89,8 @@ int ViEAutoTest::ViECustomCall()
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d", numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
webrtc::ViECapture* ptrViECapture = webrtc::ViECapture* ptrViECapture =
webrtc::ViECapture::GetInterface(ptrViE); webrtc::ViECapture::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViECapture != NULL, numberOfErrors += ViETest::TestError(ptrViECapture != NULL,
"ERROR: %s at line %d", __FUNCTION__, "ERROR: %s at line %d", __FUNCTION__,
__LINE__); __LINE__);
@ -95,11 +106,16 @@ int ViEAutoTest::ViECustomCall()
__LINE__); __LINE__);
webrtc::ViENetwork* ptrViENetwork = webrtc::ViENetwork* ptrViENetwork =
webrtc::ViENetwork::GetInterface(ptrViE); webrtc::ViENetwork::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViENetwork != NULL, numberOfErrors += ViETest::TestError(ptrViENetwork != NULL,
"ERROR: %s at line %d", __FUNCTION__, "ERROR: %s at line %d", __FUNCTION__,
__LINE__); __LINE__);
webrtc::ViEFile* ptrViEFile = webrtc::ViEFile::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViEFile != NULL,
"ERROR: %s at line %d", __FUNCTION__,
__LINE__);
bool startCall = false; bool startCall = false;
const unsigned int kMaxIPLength = 16; const unsigned int kMaxIPLength = 16;
char ipAddress[kMaxIPLength] = ""; char ipAddress[kMaxIPLength] = "";
@ -136,17 +152,20 @@ int ViEAutoTest::ViECustomCall()
videoRxPort = 0; videoRxPort = 0;
GetVideoPorts(&videoTxPort, &videoRxPort); GetVideoPorts(&videoTxPort, &videoRxPort);
// video codecs // video codecs
memset((void*)&videoCodec, 0, sizeof(videoCodec)); memset((void*)&videoCodec, 0, sizeof(videoCodec));
GetVideoCodec(ptrViECodec, videoCodec); GetVideoCodecType(ptrViECodec, videoCodec);
GetVideoCodecSize(ptrViECodec, videoCodec);
GetVideoCodecBitrate(ptrViECodec, videoCodec);
// Choose video protection mode // Choose video protection mode
std::cout << "Enter Video Protection Method:" << std::endl; std::cout << "Available Video Protection Method" << std::endl;
std::cout << "0. None" << std::endl; std::cout << "0. None" << std::endl;
std::cout << "1. FEC" << std::endl; std::cout << "1. FEC" << std::endl;
std::cout << "2. NACK" << std::endl; std::cout << "2. NACK" << std::endl;
std::cout << "3. NACK+FEC" << std::endl; std::cout << "3. NACK+FEC" << std::endl;
std::cout << "Enter Video Protection Method: ";
std::string method; std::string method;
std::getline(std::cin, method); std::getline(std::cin, method);
protectionMethod = atoi(method.c_str()); protectionMethod = atoi(method.c_str());
@ -178,7 +197,7 @@ int ViEAutoTest::ViECustomCall()
std::cout << "2. Reconfigure call settings" << std::endl; std::cout << "2. Reconfigure call settings" << std::endl;
std::cout << "3. Go back to main menu" << std::endl; std::cout << "3. Go back to main menu" << std::endl;
std::cout << "What do you want to do? Press enter for default " std::cout << "What do you want to do? Press enter for default "
"(Start the call): "; << "(Start the call): ";
std::getline(std::cin, str); std::getline(std::cin, str);
int selection = 0; int selection = 0;
@ -249,9 +268,8 @@ int ViEAutoTest::ViECustomCall()
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
// Configure Video now // Configure Video now
error = ptrViE->SetTraceFile("ViECustomCall.txt"); error = ptrViE->SetTraceFile("ViECustomCall_trace.txt");
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
@ -290,7 +308,7 @@ int ViEAutoTest::ViECustomCall()
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
webrtc::ViERTP_RTCP* ptrViERtpRtcp = webrtc::ViERTP_RTCP* ptrViERtpRtcp =
webrtc::ViERTP_RTCP::GetInterface(ptrViE); webrtc::ViERTP_RTCP::GetInterface(ptrViE);
numberOfErrors += ViETest::TestError(ptrViE != NULL, numberOfErrors += ViETest::TestError(ptrViE != NULL,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
@ -301,8 +319,8 @@ int ViEAutoTest::ViECustomCall()
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
error = ptrViERtpRtcp->SetKeyFrameRequestMethod( error = ptrViERtpRtcp->SetKeyFrameRequestMethod(videoChannel,
videoChannel, webrtc::kViEKeyFrameRequestPliRtcp); webrtc::kViEKeyFrameRequestPliRtcp);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
@ -311,48 +329,48 @@ int ViEAutoTest::ViECustomCall()
switch (protectionMethod) switch (protectionMethod)
{ {
case 0: // None case 0: // None
error = ptrViERtpRtcp->SetFECStatus(videoChannel, false, error = ptrViERtpRtcp->SetFECStatus(videoChannel, false,
VCM_RED_PAYLOAD_TYPE, VCM_RED_PAYLOAD_TYPE,
VCM_ULPFEC_PAYLOAD_TYPE); VCM_ULPFEC_PAYLOAD_TYPE);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
error = ptrViERtpRtcp->SetNACKStatus(videoChannel, false); error = ptrViERtpRtcp->SetNACKStatus(videoChannel, false);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
break; break;
case 1: // FEC only case 1: // FEC only
error = ptrViERtpRtcp->SetFECStatus(videoChannel, true, error = ptrViERtpRtcp->SetFECStatus(videoChannel, true,
VCM_RED_PAYLOAD_TYPE, VCM_RED_PAYLOAD_TYPE,
VCM_ULPFEC_PAYLOAD_TYPE); VCM_ULPFEC_PAYLOAD_TYPE);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
error = ptrViERtpRtcp->SetNACKStatus(videoChannel, false); error = ptrViERtpRtcp->SetNACKStatus(videoChannel, false);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
break; break;
case 2: // NACK only case 2: // NACK only
error = ptrViERtpRtcp->SetNACKStatus(videoChannel, true); error = ptrViERtpRtcp->SetNACKStatus(videoChannel, true);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
break; break;
case 3: // Hybrid NACK and FEC case 3: // Hybrid NACK and FEC
error = ptrViERtpRtcp->SetHybridNACKFECStatus(videoChannel, true, error = ptrViERtpRtcp->SetHybridNACKFECStatus(
VCM_RED_PAYLOAD_TYPE, videoChannel, true, VCM_RED_PAYLOAD_TYPE,
VCM_ULPFEC_PAYLOAD_TYPE); VCM_ULPFEC_PAYLOAD_TYPE);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
break; break;
} }
error = ptrViERtpRtcp->SetTMMBRStatus(videoChannel, true); error = ptrViERtpRtcp->SetTMMBRStatus(videoChannel, true);
@ -360,13 +378,13 @@ int ViEAutoTest::ViECustomCall()
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
error = ptrViERender->AddRenderer(captureId, _window1, 0, 0.0, 0.0, error = ptrViERender->AddRenderer(captureId, _window1, 0, 0.0, 0.0,
1.0, 1.0); 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
error = ptrViERender->AddRenderer(videoChannel, _window2, 1, 0.0, 0.0, error = ptrViERender->AddRenderer(videoChannel, _window2, 1, 0.0, 0.0,
1.0, 1.0); 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
@ -410,7 +428,7 @@ int ViEAutoTest::ViECustomCall()
// ULPFEC // ULPFEC
error = ptrViECodec->GetCodec(ptrViECodec->NumberOfCodecs() - 1, error = ptrViECodec->GetCodec(ptrViECodec->NumberOfCodecs() - 1,
videoCodec); videoCodec);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
@ -438,7 +456,6 @@ int ViEAutoTest::ViECustomCall()
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
// ViE next // ViE next
error = ptrViEBase->StartSend(videoChannel); error = ptrViEBase->StartSend(videoChannel);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
@ -459,24 +476,297 @@ int ViEAutoTest::ViECustomCall()
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
ViEAutotestFileObserver fileObserver;
int fileId;
//*************************************************************** //***************************************************************
// Engine ready. Wait for input // Engine ready. Wait for input
//*************************************************************** //***************************************************************
// Call started // Call started
std::cout << std::endl; std::cout << std::endl;
std::cout << "Custom call started" << std::endl; std::cout << "Custom call started" << std::endl;
std::cout << std::endl << std::endl; std::cout << std::endl << std::endl;
// Modify call or stop call
std::cout << "Custom call in progress, would you like do?" << std::endl;
std::cout << " 0. Stop the call" << std::endl;
std::cout << " 1. Modify the call" << std::endl;
std::cout << "What do you want to do? "
<< "Press enter for default (Stop the call): ";
std::getline(std::cin, str);
int selection = 0;
selection = atoi(str.c_str());
// keep on modifying the call until user selects finish modify call
bool modify_call = false;
while (selection == 1) {
std::cout << "Modify Custom Call" << std::endl;
std::cout << " 0. Finished modifying custom call" << std::endl;
std::cout << " 1. Change Video Codec" << std::endl;
std::cout << " 2. Change Video Size by Common Resolutions"
<< std::endl;
std::cout << " 3. Change Video Size by Width & Height" << std::endl;
std::cout << " 4. Change Video Capture Device" << std::endl;
std::cout << " 5. Record Incoming Call" << std::endl;
std::cout << " 6. Record Outgoing Call" << std::endl;
std::cout << " 7. Play File on Video Channel"
<< "(Assumes you recorded incoming & outgoing call)"
<< std::endl;
std::cout << " 8. Print Call information" << std::endl;
std::cout << "What do you want to do? ";
std::cout << "Press enter for default "
<< "(Finished modifying custom call): ";
std::getline(std::cin, str);
int modify_selection = 0;
int file_selection = 0;
modify_selection = atoi(str.c_str());
switch (modify_selection) {
case 0:
std::cout << "Finished modifying custom call." << std::endl;
modify_call = false;
break;
case 1:
// Change video Codec
GetVideoCodecType(ptrViECodec, videoCodec);
PrintCallInformation(ipAddress, deviceName,
uniqueId, videoCodec,
videoTxPort, videoRxPort,
audioCaptureDeviceName,
audioPlaybackDeviceName, audioCodec,
audioTxPort, audioRxPort);
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__);
modify_call = true;
break;
case 2:
// Change Video codec size by common resolution
GetVideoCodecResolution(ptrViECodec, videoCodec);
PrintCallInformation(ipAddress, deviceName,
uniqueId, videoCodec,
videoTxPort, videoRxPort,
audioCaptureDeviceName,
audioPlaybackDeviceName, audioCodec,
audioTxPort, audioRxPort);
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__);
modify_call = true;
break;
case 3:
// Change Video codec size by common resolution
GetVideoCodecSize(ptrViECodec, videoCodec);
PrintCallInformation(ipAddress, deviceName,
uniqueId, videoCodec,
videoTxPort, videoRxPort,
audioCaptureDeviceName,
audioPlaybackDeviceName, audioCodec,
audioTxPort, audioRxPort);
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__);
modify_call = true;
break;
case 4:
error = ptrViERender->StopRender(captureId);
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 = ptrViECapture->StopCapture(captureId);
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__);
error = ptrViECapture->ReleaseCaptureDevice(captureId);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
memset(deviceName, 0, KMaxUniqueIdLength);
memset(uniqueId, 0, KMaxUniqueIdLength);
GetVideoDevice(ptrViEBase, ptrViECapture, deviceName, uniqueId);
captureId = 0;
error = ptrViECapture->AllocateCaptureDevice(uniqueId,
KMaxUniqueIdLength,
captureId);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViECapture->ConnectCaptureDevice(
captureId, videoChannel);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViECapture->StartCapture(captureId);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->AddRenderer(
captureId, _window1, 0, 0.0, 0.0, 1.0, 1.0);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ptrViERender->StartRender(captureId);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
modify_call = true;
break;
case 5:
// Record the incoming call
std::cout << "Start Recording Incoming Video "
<< DEFAULT_INCOMING_FILE_NAME << std::endl;
error = ptrViEFile->StartRecordIncomingVideo(
videoChannel, DEFAULT_INCOMING_FILE_NAME,
webrtc::NO_AUDIO, audioCodec, videoCodec);
std::cout << "Press enter to stop...";
std::getline(std::cin, str);
error = ptrViEFile->StopRecordIncomingVideo(videoChannel);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR:%d %s at line %d",
ptrViEBase->LastError(),
__FUNCTION__, __LINE__);
modify_call = true;
break;
case 6:
// Record the outgoing call
std::cout << "Start Recording Outgoing Video "
<< DEFAULT_OUTGOING_FILE_NAME << std::endl;
error = ptrViEFile->StartRecordOutgoingVideo(
videoChannel, DEFAULT_OUTGOING_FILE_NAME,
webrtc::NO_AUDIO, audioCodec, videoCodec);
std::cout << "Press enter to stop...";
std::getline(std::cin, str);
error = ptrViEFile->StopRecordOutgoingVideo(videoChannel);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR:%d %s at line %d",
ptrViEBase->LastError(),
__FUNCTION__, __LINE__);
modify_call = true;
break;
case 7:
// Send the file on the videoChannel
file_selection = 0;
std::cout << "Available files to play" << std::endl;
std::cout << " 0. " << DEFAULT_INCOMING_FILE_NAME << std::endl;
std::cout << " 1. " << DEFAULT_OUTGOING_FILE_NAME << std::endl;
std::cout << "Press enter for default ("
<< DEFAULT_INCOMING_FILE_NAME << "): ";
std::getline(std::cin, str);
file_selection = atoi(str.c_str());
// Disconnect the camera first
error = ptrViECapture->DisconnectCaptureDevice(videoChannel);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR:%d %s at line %d",
ptrViEBase->LastError(),
__FUNCTION__, __LINE__);
if (file_selection == 1)
error = ptrViEFile->StartPlayFile(DEFAULT_OUTGOING_FILE_NAME,
fileId, true);
else
error = ptrViEFile->StartPlayFile(DEFAULT_INCOMING_FILE_NAME,
fileId, true);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR:%d %s at line %d",
ptrViEBase->LastError(),
__FUNCTION__, __LINE__);
ViETest::Log("Registering file observer");
error = ptrViEFile->RegisterObserver(fileId, fileObserver);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR:%d %s at line %d",
ptrViEBase->LastError(),
__FUNCTION__, __LINE__);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR:%d %s at line %d",
ptrViEBase->LastError(),
__FUNCTION__, __LINE__);
std::cout << std::endl;
std::cout << "Start sending the file that is played in a loop "
<< std::endl;
error = ptrViEFile->SendFileOnChannel(fileId, videoChannel);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR:%d %s at line %d",
ptrViEBase->LastError(),
__FUNCTION__, __LINE__);
std::cout << "Press enter to stop...";
std::getline(std::cin, str);
ViETest::Log("Stopped sending video on channel");
error = ptrViEFile->StopSendFileOnChannel(videoChannel);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR:%d %s at line %d",
ptrViEBase->LastError(),
__FUNCTION__, __LINE__);
ViETest::Log("Stop playing the file.");
error = ptrViEFile->StopPlayFile(fileId);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR:%d %s at line %d",
ptrViEBase->LastError(),
__FUNCTION__, __LINE__);
error = ptrViECapture->ConnectCaptureDevice(
captureId, videoChannel);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
modify_call = true;
break;
case 8:
// Print Call information
PrintCallInformation(ipAddress, deviceName,
uniqueId, videoCodec,
videoTxPort, videoRxPort,
audioCaptureDeviceName,
audioPlaybackDeviceName,
audioCodec, audioTxPort,
audioRxPort);
modify_call = true;
break;
default:
// invalid selection, shows options menu again
std::cout << "Invalid selection. Select Again." << std::endl;
break;
}
// modify_call is false if user does not select one of the
// modify options
if (modify_call == false) {
selection = 0;
}
}
// Stop the Call
std::cout << "Press enter to stop..."; std::cout << "Press enter to stop...";
std::getline(std::cin, str); std::getline(std::cin, str);
//*************************************************************** //***************************************************************
// Testing finished. Tear down Video Engine // Testing finished. Tear down Video Engine
//*************************************************************** //***************************************************************
// audio engine first // audio engine first
error = ptrVEBase->StopReceive(audioChannel); error = ptrVEBase->StopReceive(audioChannel);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
@ -492,7 +782,6 @@ int ViEAutoTest::ViECustomCall()
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
// now do video // now do video
error = ptrViEBase->DisconnectAudioChannel(videoChannel); error = ptrViEBase->DisconnectAudioChannel(videoChannel);
@ -547,6 +836,10 @@ int ViEAutoTest::ViECustomCall()
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
int remainingInterfaces = 0; int remainingInterfaces = 0;
remainingInterfaces = ptrViEFile->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
remainingInterfaces = ptrViECodec->Release(); remainingInterfaces = ptrViECodec->Release();
numberOfErrors += ViETest::TestError(remainingInterfaces == 0, numberOfErrors += ViETest::TestError(remainingInterfaces == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
@ -611,7 +904,7 @@ bool ViEAutoTest::GetVideoDevice(webrtc::ViEBase* ptrViEBase,
memset(uniqueId, 0, KMaxUniqueIdLength); memset(uniqueId, 0, KMaxUniqueIdLength);
std::cout << std::endl; std::cout << std::endl;
std::cout << "Available capture devices:" << std::endl; std::cout << "Available video capture devices:" << std::endl;
int captureIdx = 0; int captureIdx = 0;
for (captureIdx = 0; for (captureIdx = 0;
captureIdx < ptrViECapture->NumberOfCaptureDevices(); captureIdx++) captureIdx < ptrViECapture->NumberOfCaptureDevices(); captureIdx++)
@ -627,6 +920,7 @@ bool ViEAutoTest::GetVideoDevice(webrtc::ViEBase* ptrViEBase,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
std::cout << " " << captureIdx+1 << ". " << deviceName std::cout << " " << captureIdx+1 << ". " << deviceName
<< "/" << uniqueId
<< std::endl; << std::endl;
} }
// Get the devName of the default (or first) camera for display // Get the devName of the default (or first) camera for display
@ -638,7 +932,7 @@ bool ViEAutoTest::GetVideoDevice(webrtc::ViEBase* ptrViEBase,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
std::cout << "Choose a capture device. Press enter for default (" std::cout << "Choose a video capture device. Press enter for default ("
<< deviceName << "/" << uniqueId << "): "; << deviceName << "/" << uniqueId << "): ";
std::getline(std::cin, str); std::getline(std::cin, str);
captureDeviceIndex = atoi(str.c_str()); captureDeviceIndex = atoi(str.c_str());
@ -935,101 +1229,6 @@ bool ViEAutoTest::GetVideoPorts(int* txPort, int* rxPort)
return false; return false;
} }
bool ViEAutoTest::GetVideoCodec(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec)
{
int error = 0;
int numberOfErrors = 0;
int codecSelection = 0;
std::string str;
memset(&videoCodec, 0, sizeof(webrtc::VideoCodec));
bool exitLoop=false;
while(!exitLoop)
{
std::cout << std::endl;
std::cout << "Available video codecs:" << std::endl;
int codecIdx = 0;
int defaultCodecIdx = 0;
for (codecIdx = 0; codecIdx < ptrViECodec->NumberOfCodecs(); codecIdx++)
{
error = ptrViECodec->GetCodec(codecIdx, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// test for default codec index
if(strcmp(videoCodec.plName, DEFAULT_VIDEO_CODEC) == 0)
{
defaultCodecIdx = codecIdx;
}
std::cout << " " << codecIdx+1 << ". " << videoCodec.plName
<< std::endl;
}
std::cout << std::endl;
std::cout << "Choose video codec. Press enter for default ("
<< DEFAULT_VIDEO_CODEC << "): ";
std::getline(std::cin, str);
codecSelection = atoi(str.c_str());
if(codecSelection == 0)
{
// use default
error = ptrViECodec->GetCodec(defaultCodecIdx, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
exitLoop=true;
}
else
{
// user selection
codecSelection = atoi(str.c_str())-1;
error = ptrViECodec->GetCodec(codecSelection, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
if(error != 0)
{
std::cout << "ERROR: Code=" << error << " Invalid selection"
<< std::endl;
continue;
}
exitLoop=true;
}
}
std::cout << "Choose video width. Press enter for default ("
<< DEFAULT_VIDEO_CODEC_WIDTH << "): ";
std::getline(std::cin, str);
int sizeSelection = atoi(str.c_str());
if(sizeSelection!=0)
{
videoCodec.width=sizeSelection;
}
std::cout << "Choose video height. Press enter for default ("
<< DEFAULT_VIDEO_CODEC_HEIGHT << "): ";
std::getline(std::cin, str);
sizeSelection = atoi(str.c_str());
if(sizeSelection!=0)
{
videoCodec.height=sizeSelection;
}
// Set start bit rate
std::cout << std::endl;
std::cout << "Choose start rate (in kbps). Press enter for default ("
<< DEFAULT_VIDEO_CODEC_BITRATE << "): ";
std::getline(std::cin, str);
int startRate = atoi(str.c_str());
if(startRate != 0)
{
videoCodec.startBitrate=startRate;
}
return true;
}
// audio settings functions // audio settings functions
bool ViEAutoTest::GetAudioPorts(int* txPort, int* rxPort) bool ViEAutoTest::GetAudioPorts(int* txPort, int* rxPort)
{ {
@ -1177,7 +1376,7 @@ void ViEAutoTest::PrintCallInformation(char* IP, char* videoCaptureDeviceName,
std::cout << "************************************************" std::cout << "************************************************"
<< std::endl; << std::endl;
std::cout << "The call will use the following settings: " << std::endl; std::cout << "The call has the following settings: " << std::endl;
std::cout << "\tIP: " << IP << std::endl; std::cout << "\tIP: " << IP << std::endl;
std::cout << "\tVideo Capture Device: " << videoCaptureDeviceName std::cout << "\tVideo Capture Device: " << videoCaptureDeviceName
<< std::endl; << std::endl;
@ -1203,3 +1402,185 @@ void ViEAutoTest::PrintCallInformation(char* IP, char* videoCaptureDeviceName,
std::cout << "************************************************" std::cout << "************************************************"
<< std::endl; << std::endl;
} }
bool ViEAutoTest::GetVideoCodecType(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec)
{
int error = 0;
int numberOfErrors = 0;
int codecSelection = 0;
std::string str;
memset(&videoCodec, 0, sizeof(webrtc::VideoCodec));
bool exitLoop=false;
while(!exitLoop) {
std::cout << std::endl;
std::cout << "Available video codecs:" << std::endl;
int codecIdx = 0;
int defaultCodecIdx = 0;
for (codecIdx = 0; codecIdx < ptrViECodec->NumberOfCodecs(); codecIdx++) {
error = ptrViECodec->GetCodec(codecIdx, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// test for default codec index
if(strcmp(videoCodec.plName, DEFAULT_VIDEO_CODEC) == 0) {
defaultCodecIdx = codecIdx;
}
std::cout << " " << codecIdx+1 << ". " << videoCodec.plName
<< std::endl;
}
std::cout << std::endl;
std::cout << "Choose video codec. Press enter for default ("
<< DEFAULT_VIDEO_CODEC << "): ";
std::getline(std::cin, str);
codecSelection = atoi(str.c_str());
if(codecSelection == 0) {
// use default
error = ptrViECodec->GetCodec(defaultCodecIdx, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
exitLoop=true;
}
else {
// user selection
codecSelection = atoi(str.c_str())-1;
error = ptrViECodec->GetCodec(codecSelection, videoCodec);
numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
if(error != 0) {
std::cout << "ERROR: Code=" << error << " Invalid selection"
<< std::endl;
continue;
}
exitLoop=true;
}
}
if (videoCodec.codecType == webrtc::kVideoCodecI420) {
videoCodec.width = 176;
videoCodec.height = 144;
}
return true;
}
bool ViEAutoTest::GetVideoCodecResolution(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec)
{
std::string str;
int sizeOption = 2;
if (videoCodec.codecType == webrtc::kVideoCodecI420) {
std::cout << "Codec is I420, size is 176 x 144" << std::endl;
sizeOption = 1;
}
else {
std::cout << std::endl;
std::cout << "Available Common Resolutions : " << std::endl;
std::cout << " 1. SQCIF (128X96) " << std::endl;
std::cout << " 2. QQVGA (160X120) " << std::endl;
std::cout << " 3. QCIF (176X144) " << std::endl;
std::cout << " 4. CIF (352X288) " << std::endl;
std::cout << " 5. VGA (640X480) " << std::endl;
std::cout << " 6. WVGA (800x480) " << std::endl;
std::cout << " 7. 4CIF (704X576) " << std::endl;
std::cout << " 8. SVGA (800X600) " << std::endl;
std::cout << " 9. HD (1280X720) " << std::endl;
std::cout << " 10. XGA (1024x768) " << std::endl;
std::cout << "Enter frame size option "
<< "(default keeps current size): ";
std::getline(std::cin, str);
sizeOption = atoi(str.c_str());
}
switch (sizeOption) {
case 1:
videoCodec.width = 128;
videoCodec.height = 96;
break;
case 2:
videoCodec.width = 160;
videoCodec.height = 120;
break;
case 3:
videoCodec.width = 176;
videoCodec.height = 144;
break;
case 4:
videoCodec.width = 352;
videoCodec.height = 288;
break;
case 5:
videoCodec.width = 640;
videoCodec.height = 480;
break;
case 6:
videoCodec.width = 800;
videoCodec.height = 480;
break;
case 7:
videoCodec.width = 704;
videoCodec.height = 576;
break;
case 8:
videoCodec.width = 800;
videoCodec.height = 600;
break;
case 9:
videoCodec.width = 1280;
videoCodec.height = 720;
break;
case 10:
videoCodec.width = 1024;
videoCodec.height = 768;
break;
}
return true;
}
bool ViEAutoTest::GetVideoCodecSize(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec)
{
if (videoCodec.codecType != webrtc::kVideoCodecI420) {
std::string str;
videoCodec.width = DEFAULT_VIDEO_CODEC_WIDTH;
videoCodec.height = DEFAULT_VIDEO_CODEC_HEIGHT;
std::cout << "Choose video width. Press enter for default ("
<< DEFAULT_VIDEO_CODEC_WIDTH << "): ";
std::getline(std::cin, str);
int sizeSelection = atoi(str.c_str());
if(sizeSelection!=0) {
videoCodec.width=sizeSelection;
}
std::cout << "Choose video height. Press enter for default ("
<< DEFAULT_VIDEO_CODEC_HEIGHT << "): ";
std::getline(std::cin, str);
sizeSelection = atoi(str.c_str());
if(sizeSelection!=0) {
videoCodec.height=sizeSelection;
}
}
else if (videoCodec.codecType == webrtc::kVideoCodecI420) {
std::cout << "Codec is I420, size is 176 x 144" << std::endl;
}
return true;
}
bool ViEAutoTest::GetVideoCodecBitrate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec)
{
std::string str;
std::cout << std::endl;
std::cout << "Choose start rate (in kbps). Press enter for default ("
<< DEFAULT_VIDEO_CODEC_BITRATE << "): ";
std::getline(std::cin, str);
int startRate = atoi(str.c_str());
videoCodec.startBitrate=DEFAULT_VIDEO_CODEC_BITRATE;
if(startRate != 0) {
videoCodec.startBitrate=startRate;
}
return true;
}

View File

@ -63,21 +63,14 @@ int VideoEngineSampleCode(void* window1, void* window2)
} }
#ifdef WEBRTC_ANDROID #ifdef WEBRTC_ANDROID
error = ptrViE->SetTraceFile("/sdcard/ViETrace.txt"); error = ptrViE->SetTraceFile("/sdcard/ViELoopbackCall_trace.txt");
if (error == -1)
{
printf("ERROR in VideoEngine::SetTraceFile\n");
return -1;
}
error = ptrViE->SetTraceFile("/sdcard/ViEEncryptedTrace.txt");
if (error == -1) if (error == -1)
{ {
printf("ERROR in VideoEngine::SetTraceFile\n"); printf("ERROR in VideoEngine::SetTraceFile\n");
return -1; return -1;
} }
#else #else
error = ptrViE->SetTraceFile("ViETrace.txt"); error = ptrViE->SetTraceFile("ViELoopbackCall_trace.txt");
if (error == -1) if (error == -1)
{ {
printf("ERROR in VideoEngine::SetTraceFile\n"); printf("ERROR in VideoEngine::SetTraceFile\n");