Revert r4562

R=mallinath@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2117004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4623 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
elham@webrtc.org 2013-08-26 23:21:03 +00:00
parent 01cb3ad883
commit 814e28413d
7 changed files with 591 additions and 702 deletions

View File

@ -66,18 +66,6 @@ class WEBRTC_DLLEXPORT ViEDecoderObserver {
class WEBRTC_DLLEXPORT ViECodec { class WEBRTC_DLLEXPORT ViECodec {
public: public:
enum ViEDecodeErrorMode {
kNoErrors, // Never decode with errors. Video will freeze
// if nack is disabled.
kSelectiveErrors, // Frames that are determined decodable in
// VCMSessionInfo may be decoded with missing
// packets. As not all incomplete frames will be
// decodable, video will freeze if nack is disabled.
kWithErrors // Release frames as needed. Errors may be
// introduced as some encoded frames may not be
// complete.
};
// Factory for the ViECodec subAPI and increases an internal reference // Factory for the ViECodec subAPI and increases an internal reference
// counter if successful. Returns NULL if the API is not supported or if // counter if successful. Returns NULL if the API is not supported or if
// construction fails. // construction fails.
@ -183,10 +171,6 @@ class WEBRTC_DLLEXPORT ViECodec {
virtual int WaitForFirstKeyFrame(const int video_channel, virtual int WaitForFirstKeyFrame(const int video_channel,
const bool wait) = 0; const bool wait) = 0;
// Set the decode error mode.
virtual int SetDecodeErrorMode(const int video_channel,
const ViEDecodeErrorMode error_mode) = 0;
// Enables recording of debugging information. // Enables recording of debugging information.
virtual int StartDebugRecording(int video_channel, virtual int StartDebugRecording(int video_channel,
const char* file_name_utf8) = 0; const char* file_name_utf8) = 0;

View File

@ -40,36 +40,8 @@
#define VCM_RED_PAYLOAD_TYPE 96 #define VCM_RED_PAYLOAD_TYPE 96
#define VCM_ULPFEC_PAYLOAD_TYPE 97 #define VCM_ULPFEC_PAYLOAD_TYPE 97
DEFINE_int32(capture_device, -1, "Capture device to use.\n" int VideoEngineSampleCode(void* window1, void* window2)
"\t1. Default"); {
DEFINE_int32(codec, -1, "Available codecs:\n"
"\t1. VP8\n"
"\t2. I420");
DEFINE_int32(frame_size, -1, "Frame size:\n"
"\t1. QCIF (176x144)\n"
"\t2. CIF (352x288)\n"
"\t3. VGA (640x480)\n"
"\t4. 4CIF (704x576)\n"
"\t5. WHD (1280x720)\n"
"\t6. FHD (1920x1080)");
DEFINE_int32(temporal_layers, -1, "Number of temporal layers (1 to 4).");
DEFINE_int32(start_rate, -1, "Start rate (in kbps).");
DEFINE_int32(protection_method, -1, "Protection method:\n"
"\t0. None\n"
"\t1. FEC\n"
"\t2. NACK\n"
"\t3. NACK+FEC");
DEFINE_int32(decode_error_mode, -1, "Decode error mode:\n"
"\t0. No Errors\n"
"\t1. Selective Errors\n"
"\t2. With Errors");
DEFINE_int32(buffering_delay, -1, "Set buffering delay (ms)");
DEFINE_int32(percent_loss, -1, "Packet loss percentage.");
DEFINE_int32(network_delay, -1, "Network delay value (ms)");
// TEST = trybots, vie_auto_test --automated
int VideoEngineSampleCode(void* window1, void* window2) {
//******************************************************** //********************************************************
// Begin create/initialize Video Engine for testing // Begin create/initialize Video Engine for testing
//******************************************************** //********************************************************
@ -81,13 +53,15 @@ int VideoEngineSampleCode(void* window1, void* window2) {
// //
webrtc::VideoEngine* ptrViE = NULL; webrtc::VideoEngine* ptrViE = NULL;
ptrViE = webrtc::VideoEngine::Create(); ptrViE = webrtc::VideoEngine::Create();
if (ptrViE == NULL) { if (ptrViE == NULL)
{
printf("ERROR in VideoEngine::Create\n"); printf("ERROR in VideoEngine::Create\n");
return -1; return -1;
} }
error = ptrViE->SetTraceFilter(webrtc::kTraceAll); error = ptrViE->SetTraceFilter(webrtc::kTraceAll);
if (error == -1) { if (error == -1)
{
printf("ERROR in VideoEngine::SetTraceFilter\n"); printf("ERROR in VideoEngine::SetTraceFilter\n");
return -1; return -1;
} }
@ -95,7 +69,8 @@ int VideoEngineSampleCode(void* window1, void* window2) {
std::string trace_file = std::string trace_file =
ViETest::GetResultOutputPath() + "ViELoopbackCall_trace.txt"; ViETest::GetResultOutputPath() + "ViELoopbackCall_trace.txt";
error = ptrViE->SetTraceFile(trace_file.c_str()); error = ptrViE->SetTraceFile(trace_file.c_str());
if (error == -1) { if (error == -1)
{
printf("ERROR in VideoEngine::SetTraceFile\n"); printf("ERROR in VideoEngine::SetTraceFile\n");
return -1; return -1;
} }
@ -104,27 +79,31 @@ int VideoEngineSampleCode(void* window1, void* window2) {
// Init VideoEngine and create a channel // Init VideoEngine and create a channel
// //
webrtc::ViEBase* ptrViEBase = webrtc::ViEBase::GetInterface(ptrViE); webrtc::ViEBase* ptrViEBase = webrtc::ViEBase::GetInterface(ptrViE);
if (ptrViEBase == NULL) { if (ptrViEBase == NULL)
{
printf("ERROR in ViEBase::GetInterface\n"); printf("ERROR in ViEBase::GetInterface\n");
return -1; return -1;
} }
error = ptrViEBase->Init(); error = ptrViEBase->Init();
if (error == -1) { if (error == -1)
{
printf("ERROR in ViEBase::Init\n"); printf("ERROR in ViEBase::Init\n");
return -1; return -1;
} }
webrtc::ViERTP_RTCP* ptrViERtpRtcp = webrtc::ViERTP_RTCP* ptrViERtpRtcp =
webrtc::ViERTP_RTCP::GetInterface(ptrViE); webrtc::ViERTP_RTCP::GetInterface(ptrViE);
if (ptrViERtpRtcp == NULL) { if (ptrViERtpRtcp == NULL)
{
printf("ERROR in ViERTP_RTCP::GetInterface\n"); printf("ERROR in ViERTP_RTCP::GetInterface\n");
return -1; return -1;
} }
int videoChannel = -1; int videoChannel = -1;
error = ptrViEBase->CreateChannel(videoChannel); error = ptrViEBase->CreateChannel(videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViEBase::CreateChannel\n"); printf("ERROR in ViEBase::CreateChannel\n");
return -1; return -1;
} }
@ -132,8 +111,10 @@ int VideoEngineSampleCode(void* window1, void* window2) {
// //
// List available capture devices, allocate and connect. // List available capture devices, allocate and connect.
// //
webrtc::ViECapture* ptrViECapture = webrtc::ViECapture::GetInterface(ptrViE); webrtc::ViECapture* ptrViECapture =
if (ptrViEBase == NULL) { webrtc::ViECapture::GetInterface(ptrViE);
if (ptrViEBase == NULL)
{
printf("ERROR in ViECapture::GetInterface\n"); printf("ERROR in ViECapture::GetInterface\n");
return -1; return -1;
} }
@ -145,20 +126,20 @@ int VideoEngineSampleCode(void* window1, void* window2) {
char uniqueId[KMaxUniqueIdLength]; char uniqueId[KMaxUniqueIdLength];
memset(uniqueId, 0, KMaxUniqueIdLength); memset(uniqueId, 0, KMaxUniqueIdLength);
int captureIdx = 0;
if (FLAGS_capture_device > 0) {
captureIdx = FLAGS_capture_device;
} else {
printf("Available capture devices:\n"); printf("Available capture devices:\n");
int captureIdx = 0;
for (captureIdx = 0; for (captureIdx = 0;
captureIdx < ptrViECapture->NumberOfCaptureDevices(); captureIdx < ptrViECapture->NumberOfCaptureDevices();
captureIdx++) { captureIdx++)
{
memset(deviceName, 0, KMaxDeviceNameLength); memset(deviceName, 0, KMaxDeviceNameLength);
memset(uniqueId, 0, KMaxUniqueIdLength); memset(uniqueId, 0, KMaxUniqueIdLength);
error = ptrViECapture->GetCaptureDevice(captureIdx, deviceName, error = ptrViECapture->GetCaptureDevice(captureIdx, deviceName,
KMaxDeviceNameLength, uniqueId, KMaxUniqueIdLength); KMaxDeviceNameLength, uniqueId,
if (error == -1) { KMaxUniqueIdLength);
if (error == -1)
{
printf("ERROR in ViECapture::GetCaptureDevice\n"); printf("ERROR in ViECapture::GetCaptureDevice\n");
return -1; return -1;
} }
@ -169,18 +150,19 @@ int VideoEngineSampleCode(void* window1, void* window2) {
captureIdx = 0; captureIdx = 0;
printf("0\n"); printf("0\n");
#else #else
if (scanf("%d", &captureIdx) != 1) { if (scanf("%d", &captureIdx) != 1)
{
printf("Error in scanf()\n"); printf("Error in scanf()\n");
return -1; return -1;
} }
getchar(); getchar();
captureIdx = captureIdx - 1; // Compensate for idx start at 1. captureIdx = captureIdx - 1; // Compensate for idx start at 1.
#endif #endif
}
error = ptrViECapture->GetCaptureDevice(captureIdx, deviceName, error = ptrViECapture->GetCaptureDevice(captureIdx, deviceName,
KMaxDeviceNameLength, uniqueId, KMaxDeviceNameLength, uniqueId,
KMaxUniqueIdLength); KMaxUniqueIdLength);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViECapture::GetCaptureDevice\n"); printf("ERROR in ViECapture::GetCaptureDevice\n");
return -1; return -1;
} }
@ -188,19 +170,22 @@ int VideoEngineSampleCode(void* window1, void* window2) {
int captureId = 0; int captureId = 0;
error = ptrViECapture->AllocateCaptureDevice(uniqueId, KMaxUniqueIdLength, error = ptrViECapture->AllocateCaptureDevice(uniqueId, KMaxUniqueIdLength,
captureId); captureId);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViECapture::AllocateCaptureDevice\n"); printf("ERROR in ViECapture::AllocateCaptureDevice\n");
return -1; return -1;
} }
error = ptrViECapture->ConnectCaptureDevice(captureId, videoChannel); error = ptrViECapture->ConnectCaptureDevice(captureId, videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViECapture::ConnectCaptureDevice\n"); printf("ERROR in ViECapture::ConnectCaptureDevice\n");
return -1; return -1;
} }
error = ptrViECapture->StartCapture(captureId); error = ptrViECapture->StartCapture(captureId);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViECapture::StartCapture\n"); printf("ERROR in ViECapture::StartCapture\n");
return -1; return -1;
} }
@ -211,20 +196,23 @@ int VideoEngineSampleCode(void* window1, void* window2) {
error = ptrViERtpRtcp->SetRTCPStatus(videoChannel, error = ptrViERtpRtcp->SetRTCPStatus(videoChannel,
webrtc::kRtcpCompound_RFC4585); webrtc::kRtcpCompound_RFC4585);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERTP_RTCP::SetRTCPStatus\n"); printf("ERROR in ViERTP_RTCP::SetRTCPStatus\n");
return -1; return -1;
} }
error = ptrViERtpRtcp->SetKeyFrameRequestMethod( error = ptrViERtpRtcp->SetKeyFrameRequestMethod(
videoChannel, webrtc::kViEKeyFrameRequestPliRtcp); videoChannel, webrtc::kViEKeyFrameRequestPliRtcp);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERTP_RTCP::SetKeyFrameRequestMethod\n"); printf("ERROR in ViERTP_RTCP::SetKeyFrameRequestMethod\n");
return -1; return -1;
} }
error = ptrViERtpRtcp->SetRembStatus(videoChannel, true, true); error = ptrViERtpRtcp->SetRembStatus(videoChannel, true, true);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERTP_RTCP::SetTMMBRStatus\n"); printf("ERROR in ViERTP_RTCP::SetTMMBRStatus\n");
return -1; return -1;
} }
@ -232,7 +220,8 @@ int VideoEngineSampleCode(void* window1, void* window2) {
// Setting SSRC manually (arbitrary value), as otherwise we will get a clash // Setting SSRC manually (arbitrary value), as otherwise we will get a clash
// (loopback), and a new SSRC will be set, which will reset the receiver. // (loopback), and a new SSRC will be set, which will reset the receiver.
error = ptrViERtpRtcp->SetLocalSSRC(videoChannel, 0x01234567); error = ptrViERtpRtcp->SetLocalSSRC(videoChannel, 0x01234567);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERTP_RTCP::SetLocalSSRC\n"); printf("ERROR in ViERTP_RTCP::SetLocalSSRC\n");
return -1; return -1;
} }
@ -241,32 +230,38 @@ int VideoEngineSampleCode(void* window1, void* window2) {
// Set up rendering // Set up rendering
// //
webrtc::ViERender* ptrViERender = webrtc::ViERender::GetInterface(ptrViE); webrtc::ViERender* ptrViERender = webrtc::ViERender::GetInterface(ptrViE);
if (ptrViERender == NULL) { if (ptrViERender == NULL)
{
printf("ERROR in ViERender::GetInterface\n"); printf("ERROR in ViERender::GetInterface\n");
return -1; return -1;
} }
error = ptrViERender->AddRenderer(captureId, window1, 0, 0.0, 0.0, 1.0, 1.0); error
if (error == -1) { = ptrViERender->AddRenderer(captureId, window1, 0, 0.0, 0.0, 1.0, 1.0);
if (error == -1)
{
printf("ERROR in ViERender::AddRenderer\n"); printf("ERROR in ViERender::AddRenderer\n");
return -1; return -1;
} }
error = ptrViERender->StartRender(captureId); error = ptrViERender->StartRender(captureId);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERender::StartRender\n"); printf("ERROR in ViERender::StartRender\n");
return -1; return -1;
} }
error = ptrViERender->AddRenderer(videoChannel, window2, 1, 0.0, 0.0, 1.0, error = ptrViERender->AddRenderer(videoChannel, window2, 1, 0.0, 0.0, 1.0,
1.0); 1.0);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERender::AddRenderer\n"); printf("ERROR in ViERender::AddRenderer\n");
return -1; return -1;
} }
error = ptrViERender->StartRender(videoChannel); error = ptrViERender->StartRender(videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERender::StartRender\n"); printf("ERROR in ViERender::StartRender\n");
return -1; return -1;
} }
@ -275,39 +270,42 @@ int VideoEngineSampleCode(void* window1, void* window2) {
// Setup codecs // Setup codecs
// //
webrtc::ViECodec* ptrViECodec = webrtc::ViECodec::GetInterface(ptrViE); webrtc::ViECodec* ptrViECodec = webrtc::ViECodec::GetInterface(ptrViE);
if (ptrViECodec == NULL) { if (ptrViECodec == NULL)
{
printf("ERROR in ViECodec::GetInterface\n"); printf("ERROR in ViECodec::GetInterface\n");
return -1; return -1;
} }
int codecIdx = 0;
webrtc::VideoCodec videoCodec;
memset(&videoCodec, 0, sizeof(webrtc::VideoCodec));
if (FLAGS_codec > 0) {
codecIdx = FLAGS_codec;
} else {
// Check available codecs and prepare receive codecs // Check available codecs and prepare receive codecs
printf("\nAvailable codecs:\n"); printf("\nAvailable codecs:\n");
for (codecIdx = 0; codecIdx < ptrViECodec->NumberOfCodecs(); codecIdx++) { webrtc::VideoCodec videoCodec;
memset(&videoCodec, 0, sizeof(webrtc::VideoCodec));
int codecIdx = 0;
for (codecIdx = 0; codecIdx < ptrViECodec->NumberOfCodecs(); codecIdx++)
{
error = ptrViECodec->GetCodec(codecIdx, videoCodec); error = ptrViECodec->GetCodec(codecIdx, videoCodec);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViECodec::GetCodec\n"); printf("ERROR in ViECodec::GetCodec\n");
return -1; return -1;
} }
// try to keep the test frame size small when I420 // try to keep the test frame size small when I420
if (videoCodec.codecType == webrtc::kVideoCodecI420) { if (videoCodec.codecType == webrtc::kVideoCodecI420)
{
videoCodec.width = 176; videoCodec.width = 176;
videoCodec.height = 144; videoCodec.height = 144;
} }
error = ptrViECodec->SetReceiveCodec(videoChannel, videoCodec); error = ptrViECodec->SetReceiveCodec(videoChannel, videoCodec);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViECodec::SetReceiveCodec\n"); printf("ERROR in ViECodec::SetReceiveCodec\n");
return -1; return -1;
} }
if (videoCodec.codecType != webrtc::kVideoCodecRED if (videoCodec.codecType != webrtc::kVideoCodecRED
&& videoCodec.codecType != webrtc::kVideoCodecULPFEC) { && videoCodec.codecType != webrtc::kVideoCodecULPFEC)
{
printf("\t %d. %s\n", codecIdx + 1, videoCodec.plName); printf("\t %d. %s\n", codecIdx + 1, videoCodec.plName);
} }
} }
@ -318,14 +316,14 @@ int VideoEngineSampleCode(void* window1, void* window2) {
codecIdx = 0; codecIdx = 0;
printf("0\n"); printf("0\n");
#else #else
if (scanf("%d", &codecIdx) != 1) { if (scanf("%d", &codecIdx) != 1)
{
printf("Error in scanf()\n"); printf("Error in scanf()\n");
return -1; return -1;
} }
getchar(); getchar();
codecIdx = codecIdx - 1; // Compensate for idx start at 1. codecIdx = codecIdx - 1; // Compensate for idx start at 1.
#endif #endif
}
// VP8 over generic transport gets this special one. // VP8 over generic transport gets this special one.
if (codecIdx == ptrViECodec->NumberOfCodecs()) { if (codecIdx == ptrViECodec->NumberOfCodecs()) {
for (codecIdx = 0; codecIdx < ptrViECodec->NumberOfCodecs(); ++codecIdx) { for (codecIdx = 0; codecIdx < ptrViECodec->NumberOfCodecs(); ++codecIdx) {
@ -359,10 +357,6 @@ int VideoEngineSampleCode(void* window1, void* window2) {
} }
// Set spatial resolution option // Set spatial resolution option
int resolnOption;
if (FLAGS_frame_size > 0 && FLAGS_frame_size < 7) {
resolnOption = FLAGS_frame_size;
} else {
std::string str; std::string str;
std::cout << std::endl; std::cout << std::endl;
std::cout << "Enter frame size option (default is CIF):" << std::endl; std::cout << "Enter frame size option (default is CIF):" << std::endl;
@ -373,9 +367,9 @@ int VideoEngineSampleCode(void* window1, void* window2) {
std::cout << "5. WHD (1280X720) " << std::endl; std::cout << "5. WHD (1280X720) " << std::endl;
std::cout << "6. FHD (1920X1080) " << std::endl; std::cout << "6. FHD (1920X1080) " << std::endl;
std::getline(std::cin, str); std::getline(std::cin, str);
resolnOption = atoi(str.c_str()); int resolnOption = atoi(str.c_str());
} switch (resolnOption)
switch (resolnOption) { {
case 1: case 1:
videoCodec.width = 176; videoCodec.width = 176;
videoCodec.height = 144; videoCodec.height = 144;
@ -403,33 +397,23 @@ int VideoEngineSampleCode(void* window1, void* window2) {
} }
// Set number of temporal layers. // Set number of temporal layers.
int numTemporalLayers;
if (FLAGS_temporal_layers >= 0 && FLAGS_temporal_layers < 5) {
numTemporalLayers = FLAGS_temporal_layers;
} else {
std::string str;
std::cout << std::endl; std::cout << std::endl;
std::cout << "Choose number of temporal layers (1 to 4)."; std::cout << "Choose number of temporal layers (1 to 4).";
std::cout << "Press enter for default: \n"; std::cout << "Press enter for default: \n";
std::getline(std::cin, str); std::getline(std::cin, str);
numTemporalLayers = atoi(str.c_str()); int numTemporalLayers = atoi(str.c_str());
} if(numTemporalLayers != 0)
if (numTemporalLayers != 0) { {
videoCodec.codecSpecific.VP8.numberOfTemporalLayers = numTemporalLayers; videoCodec.codecSpecific.VP8.numberOfTemporalLayers = numTemporalLayers;
} }
// Set start bit rate // Set start bit rate
int startRate;
if (FLAGS_start_rate >= 0) {
startRate = FLAGS_start_rate;
} else {
std::string str;
std::cout << std::endl; std::cout << std::endl;
std::cout << "Choose start rate (in kbps). Press enter for default: "; std::cout << "Choose start rate (in kbps). Press enter for default: ";
std::getline(std::cin, str); std::getline(std::cin, str);
startRate = atoi(str.c_str()); int startRate = atoi(str.c_str());
} if(startRate != 0)
if (startRate != 0) { {
videoCodec.startBitrate=startRate; videoCodec.startBitrate=startRate;
} }
@ -438,13 +422,9 @@ int VideoEngineSampleCode(void* window1, void* window2) {
error = ptrViECodec->SetReceiveCodec(videoChannel, videoCodec); error = ptrViECodec->SetReceiveCodec(videoChannel, videoCodec);
assert(error != -1); assert(error != -1);
//
// Choose Protection Mode // Choose Protection Mode
int protectionMethod; //
error = 0;
if (FLAGS_protection_method >= 0) {
protectionMethod = FLAGS_protection_method;
} else {
std::string str;
std::cout << std::endl; std::cout << std::endl;
std::cout << "Enter Protection Method:" << std::endl; std::cout << "Enter Protection Method:" << std::endl;
std::cout << "0. None" << std::endl; std::cout << "0. None" << std::endl;
@ -452,10 +432,11 @@ int VideoEngineSampleCode(void* window1, void* window2) {
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::getline(std::cin, str); std::getline(std::cin, str);
protectionMethod = atoi(str.c_str()); int protectionMethod = atoi(str.c_str());
} error = 0;
bool temporalToggling = true; bool temporalToggling = true;
switch (protectionMethod) { switch (protectionMethod)
{
case 0: // None: default is no protection case 0: // None: default is no protection
break; break;
@ -472,7 +453,7 @@ int VideoEngineSampleCode(void* window1, void* window2) {
break; break;
case 3: // Hybrid Nack and FEC case 3: // Hybrid NAck and FEC
error = ptrViERtpRtcp->SetHybridNACKFECStatus( error = ptrViERtpRtcp->SetHybridNACKFECStatus(
videoChannel, videoChannel,
true, true,
@ -482,52 +463,16 @@ int VideoEngineSampleCode(void* window1, void* window2) {
break; break;
} }
if (error < 0) { if (error < 0)
{
printf("ERROR in ViERTP_RTCP::SetProtectionStatus\n"); printf("ERROR in ViERTP_RTCP::SetProtectionStatus\n");
} }
// Set up decode error mode.
int errorMode;
if (FLAGS_decode_error_mode >= 0) {
errorMode = FLAGS_decode_error_mode;
} else {
std::string str;
std::cout << std::endl;
std::cout << "Enter Decode Error mode:" << std::endl;
std::cout << "0. No Errors" << std::endl;
std::cout << "1. Selective Errors" << std::endl;
std::cout << "2. With Errors" << std::endl;
std::getline(std::cin, str);
errorMode = atoi(str.c_str());
}
error = 0;
switch (errorMode) {
case 0: // No Errors
break;
case 1: // Selective Errors
error = ptrViECodec->SetDecodeErrorMode(videoChannel,
webrtc::ViECodec::kSelectiveErrors);
break;
case 2: // With Errors (missing packets never prevent decoding attempts)
error = ptrViECodec->SetDecodeErrorMode(videoChannel,
webrtc::ViECodec::kWithErrors);
break;
}
if (error < 0) {
printf("ERROR in ViERTP_RTCP::SetDecodeErrorMode\n");
}
// Set up buffering delay. // Set up buffering delay.
int buffering_delay;
if (FLAGS_buffering_delay >= 0) {
buffering_delay = FLAGS_buffering_delay;
} else {
std::string str;
std::cout << std::endl; std::cout << std::endl;
std::cout << "Set buffering delay (mS). Press enter for default(0mS): "; std::cout << "Set buffering delay (mS). Press enter for default(0mS): ";
std::getline(std::cin, str); std::getline(std::cin, str);
buffering_delay = atoi(str.c_str()); int buffering_delay = atoi(str.c_str());
}
if (buffering_delay != 0) { if (buffering_delay != 0) {
error = ptrViERtpRtcp->SetSenderBufferingMode(videoChannel, error = ptrViERtpRtcp->SetSenderBufferingMode(videoChannel,
buffering_delay); buffering_delay);
@ -540,10 +485,13 @@ int VideoEngineSampleCode(void* window1, void* window2) {
printf("ERROR in ViERTP_RTCP::SetReceiverBufferingMode\n"); printf("ERROR in ViERTP_RTCP::SetReceiverBufferingMode\n");
} }
//
// Address settings // Address settings
//
webrtc::ViENetwork* ptrViENetwork = webrtc::ViENetwork* ptrViENetwork =
webrtc::ViENetwork::GetInterface(ptrViE); webrtc::ViENetwork::GetInterface(ptrViE);
if (ptrViENetwork == NULL) { if (ptrViENetwork == NULL)
{
printf("ERROR in ViENetwork::GetInterface\n"); printf("ERROR in ViENetwork::GetInterface\n");
return -1; return -1;
} }
@ -553,19 +501,14 @@ int VideoEngineSampleCode(void* window1, void* window2) {
webrtc::test::VideoChannelTransport* video_channel_transport = NULL; webrtc::test::VideoChannelTransport* video_channel_transport = NULL;
int testMode = 0; int testMode = 0;
if (FLAGS_percent_loss == 0) {
testMode = 0;
} else if (FLAGS_percent_loss > 0) {
testMode = 1;
} else {
std::cout << std::endl; std::cout << std::endl;
std::cout << "Enter 1 for testing packet loss and delay with " std::cout << "Enter 1 for testing packet loss and delay with "
"external transport: "; "external transport: ";
std::string test_str; std::string test_str;
std::getline(std::cin, test_str); std::getline(std::cin, test_str);
testMode = atoi(test_str.c_str()); testMode = atoi(test_str.c_str());
} if (testMode == 1)
if (testMode == 1) { {
// Avoid changing SSRC due to collision. // Avoid changing SSRC due to collision.
error = ptrViERtpRtcp->SetLocalSSRC(videoChannel, 1); error = ptrViERtpRtcp->SetLocalSSRC(videoChannel, 1);
@ -574,7 +517,8 @@ int VideoEngineSampleCode(void* window1, void* window2) {
error = ptrViENetwork->RegisterSendTransport(videoChannel, error = ptrViENetwork->RegisterSendTransport(videoChannel,
*extTransport); *extTransport);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViECodec::RegisterSendTransport \n"); printf("ERROR in ViECodec::RegisterSendTransport \n");
return -1; return -1;
} }
@ -583,29 +527,19 @@ int VideoEngineSampleCode(void* window1, void* window2) {
NetworkParameters network; NetworkParameters network;
network.loss_model = kUniformLoss; network.loss_model = kUniformLoss;
// Set up packet loss value // Set up packet loss value
if (FLAGS_percent_loss > 0) {
network.packet_loss_rate = FLAGS_percent_loss;
} else {
std::cout << "Enter Packet Loss Percentage" << std::endl; std::cout << "Enter Packet Loss Percentage" << std::endl;
std::string rate_str; std::string rate_str;
std::getline(std::cin, rate_str); std::getline(std::cin, rate_str);
network.packet_loss_rate = atoi(rate_str.c_str()); network.packet_loss_rate = atoi(rate_str.c_str());
}
if (network.packet_loss_rate > 0) { if (network.packet_loss_rate > 0) {
temporalToggling = false; temporalToggling = false;
} }
// Set network delay value // Set network delay value
int network_delay;
if (FLAGS_network_delay >= 0) {
network_delay = FLAGS_network_delay;
} else {
std::cout << "Enter network delay value [mS]" << std::endl; std::cout << "Enter network delay value [mS]" << std::endl;
std::string delay_str; std::string delay_str;
std::getline(std::cin, delay_str); std::getline(std::cin, delay_str);
network_delay = atoi(delay_str.c_str()); network.mean_one_way_delay = atoi(delay_str.c_str());
}
network.mean_one_way_delay = network_delay;
extTransport->SetNetworkParameters(network); extTransport->SetNetworkParameters(network);
if (numTemporalLayers > 1 && temporalToggling) { if (numTemporalLayers > 1 && temporalToggling) {
extTransport->SetTemporalToggle(numTemporalLayers); extTransport->SetTemporalToggle(numTemporalLayers);
@ -613,7 +547,9 @@ int VideoEngineSampleCode(void* window1, void* window2) {
// Disabled // Disabled
extTransport->SetTemporalToggle(0); extTransport->SetTemporalToggle(0);
} }
} else { }
else
{
video_channel_transport = new webrtc::test::VideoChannelTransport( video_channel_transport = new webrtc::test::VideoChannelTransport(
ptrViENetwork, videoChannel); ptrViENetwork, videoChannel);
@ -624,25 +560,29 @@ int VideoEngineSampleCode(void* window1, void* window2) {
std::cout << std::endl; std::cout << std::endl;
error = video_channel_transport->SetLocalReceiver(rtpPort); error = video_channel_transport->SetLocalReceiver(rtpPort);
if (error == -1) { if (error == -1)
{
printf("ERROR in SetLocalReceiver\n"); printf("ERROR in SetLocalReceiver\n");
return -1; return -1;
} }
error = video_channel_transport->SetSendDestination(ipAddress, rtpPort); error = video_channel_transport->SetSendDestination(ipAddress, rtpPort);
if (error == -1) { if (error == -1)
{
printf("ERROR in SetSendDestination\n"); printf("ERROR in SetSendDestination\n");
return -1; return -1;
} }
} }
error = ptrViEBase->StartReceive(videoChannel); error = ptrViEBase->StartReceive(videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViENetwork::StartReceive\n"); printf("ERROR in ViENetwork::StartReceive\n");
return -1; return -1;
} }
error = ptrViEBase->StartSend(videoChannel); error = ptrViEBase->StartSend(videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViENetwork::StartSend\n"); printf("ERROR in ViENetwork::StartSend\n");
return -1; return -1;
} }
@ -655,68 +595,79 @@ int VideoEngineSampleCode(void* window1, void* window2) {
// Call started // Call started
printf("\nLoopback call started\n\n"); printf("\nLoopback call started\n\n");
printf("Press enter to stop..."); printf("Press enter to stop...");
while ((getchar()) != '\n') {} while ((getchar()) != '\n')
;
//******************************************************** //********************************************************
// Testing finished. Tear down Video Engine // Testing finished. Tear down Video Engine
//******************************************************** //********************************************************
error = ptrViEBase->StopReceive(videoChannel); error = ptrViEBase->StopReceive(videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViEBase::StopReceive\n"); printf("ERROR in ViEBase::StopReceive\n");
return -1; return -1;
} }
error = ptrViEBase->StopSend(videoChannel); error = ptrViEBase->StopSend(videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViEBase::StopSend\n"); printf("ERROR in ViEBase::StopSend\n");
return -1; return -1;
} }
error = ptrViERender->StopRender(captureId); error = ptrViERender->StopRender(captureId);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERender::StopRender\n"); printf("ERROR in ViERender::StopRender\n");
return -1; return -1;
} }
error = ptrViERender->RemoveRenderer(captureId); error = ptrViERender->RemoveRenderer(captureId);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERender::RemoveRenderer\n"); printf("ERROR in ViERender::RemoveRenderer\n");
return -1; return -1;
} }
error = ptrViERender->StopRender(videoChannel); error = ptrViERender->StopRender(videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERender::StopRender\n"); printf("ERROR in ViERender::StopRender\n");
return -1; return -1;
} }
error = ptrViERender->RemoveRenderer(videoChannel); error = ptrViERender->RemoveRenderer(videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViERender::RemoveRenderer\n"); printf("ERROR in ViERender::RemoveRenderer\n");
return -1; return -1;
} }
error = ptrViECapture->StopCapture(captureId); error = ptrViECapture->StopCapture(captureId);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViECapture::StopCapture\n"); printf("ERROR in ViECapture::StopCapture\n");
return -1; return -1;
} }
error = ptrViECapture->DisconnectCaptureDevice(videoChannel); error = ptrViECapture->DisconnectCaptureDevice(videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViECapture::DisconnectCaptureDevice\n"); printf("ERROR in ViECapture::DisconnectCaptureDevice\n");
return -1; return -1;
} }
error = ptrViECapture->ReleaseCaptureDevice(captureId); error = ptrViECapture->ReleaseCaptureDevice(captureId);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViECapture::ReleaseCaptureDevice\n"); printf("ERROR in ViECapture::ReleaseCaptureDevice\n");
return -1; return -1;
} }
error = ptrViEBase->DeleteChannel(videoChannel); error = ptrViEBase->DeleteChannel(videoChannel);
if (error == -1) { if (error == -1)
{
printf("ERROR in ViEBase::DeleteChannel\n"); printf("ERROR in ViEBase::DeleteChannel\n");
return -1; return -1;
} }
@ -731,13 +682,15 @@ int VideoEngineSampleCode(void* window1, void* window2) {
remainingInterfaces += ptrViERender->Release(); remainingInterfaces += ptrViERender->Release();
remainingInterfaces += ptrViENetwork->Release(); remainingInterfaces += ptrViENetwork->Release();
remainingInterfaces += ptrViEBase->Release(); remainingInterfaces += ptrViEBase->Release();
if (remainingInterfaces > 0) { if (remainingInterfaces > 0)
{
printf("ERROR: Could not release all interfaces\n"); printf("ERROR: Could not release all interfaces\n");
return -1; return -1;
} }
bool deleted = webrtc::VideoEngine::Delete(ptrViE); bool deleted = webrtc::VideoEngine::Delete(ptrViE);
if (deleted == false) { if (deleted == false)
{
printf("ERROR in VideoEngine::Delete\n"); printf("ERROR in VideoEngine::Delete\n");
return -1; return -1;
} }
@ -750,12 +703,14 @@ int VideoEngineSampleCode(void* window1, void* window2) {
// =================================================================== // ===================================================================
} }
int ViEAutoTest::ViELoopbackCall() { int ViEAutoTest::ViELoopbackCall()
{
ViETest::Log(" "); ViETest::Log(" ");
ViETest::Log("========================================"); ViETest::Log("========================================");
ViETest::Log(" ViE Autotest Loopback Call\n"); ViETest::Log(" ViE Autotest Loopback Call\n");
if (VideoEngineSampleCode(_window1, _window2) == 0) { if (VideoEngineSampleCode(_window1, _window2) == 0)
{
ViETest::Log(" "); ViETest::Log(" ");
ViETest::Log(" ViE Autotest Loopback Call Done"); ViETest::Log(" ViE Autotest Loopback Call Done");
ViETest::Log("========================================"); ViETest::Log("========================================");
@ -769,4 +724,5 @@ int ViEAutoTest::ViELoopbackCall() {
ViETest::Log("========================================"); ViETest::Log("========================================");
ViETest::Log(" "); ViETest::Log(" ");
return 1; return 1;
} }

View File

@ -19,17 +19,7 @@
#include "webrtc/video_engine/test/auto_test/interface/vie_window_creator.h" #include "webrtc/video_engine/test/auto_test/interface/vie_window_creator.h"
DEFINE_bool(automated, false, "Run Video engine tests in noninteractive mode."); DEFINE_bool(automated, false, "Run Video engine tests in noninteractive mode.");
DEFINE_int32(test_type, -1, "Test type:\n" DEFINE_bool(auto_custom_call, false, "Run custom call directly.");
"\t1. All standard tests (delivery test)\n"
"\t2. All API tests\n"
"\t3. All extended tests\n"
"\t4. Specific standard test\n"
"\t5. Specific API test\n"
"\t6. Specific extended test\n"
"\t7. Simple loopback call\n"
"\t8. Custom configure a call\n"
"\t9. Simulcast in loopback\n"
"\t10. Record");
static const std::string kStandardTest = "ViEStandardIntegrationTest"; static const std::string kStandardTest = "ViEStandardIntegrationTest";
static const std::string kExtendedTest = "ViEExtendedIntegrationTest"; static const std::string kExtendedTest = "ViEExtendedIntegrationTest";
@ -60,7 +50,7 @@ int ViEAutoTestMain::RunTests(int argc, char** argv) {
if (FLAGS_automated) { if (FLAGS_automated) {
// Run in automated mode. // Run in automated mode.
result = RUN_ALL_TESTS(); result = RUN_ALL_TESTS();
} else if (FLAGS_test_type == 8) { } else if (FLAGS_auto_custom_call) {
// Run automated custom call. // Run automated custom call.
result = RunSpecialTestCase(8); result = RunSpecialTestCase(8);
} else { } else {
@ -121,7 +111,8 @@ int ViEAutoTestMain::RunTestMatching(const std::string test_case,
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }
int ViEAutoTestMain::RunSpecificTestCaseIn(const std::string test_case_name) { int ViEAutoTestMain::RunSpecificTestCaseIn(const std::string test_case_name)
{
// If user says 0, it means don't run anything. // If user says 0, it means don't run anything.
int specific_choice = AskUserForTestCase(); int specific_choice = AskUserForTestCase();
if (specific_choice != 0){ if (specific_choice != 0){
@ -163,9 +154,6 @@ int ViEAutoTestMain::RunInteractiveMode() {
int choice = 0; int choice = 0;
int errors = 0; int errors = 0;
if (FLAGS_test_type > 0 && FLAGS_test_type < 11) {
choice = FLAGS_test_type;
} else {
do { do {
ViETest::Log("Test types: "); ViETest::Log("Test types: ");
ViETest::Log("\t 0. Quit"); ViETest::Log("\t 0. Quit");
@ -185,10 +173,8 @@ int ViEAutoTestMain::RunInteractiveMode() {
if (choice == kInvalidChoice) { if (choice == kInvalidChoice) {
continue; continue;
} }
} while (choice != 0);
}
switch (choice) { switch (choice) {
case 0: break;
case 1: errors = RunTestMatching(kStandardTest, "*"); break; case 1: errors = RunTestMatching(kStandardTest, "*"); break;
case 2: errors = RunTestMatching(kApiTest, "*"); break; case 2: errors = RunTestMatching(kApiTest, "*"); break;
case 3: errors = RunTestMatching(kExtendedTest, "*"); break; case 3: errors = RunTestMatching(kExtendedTest, "*"); break;
@ -197,6 +183,7 @@ int ViEAutoTestMain::RunInteractiveMode() {
case 6: errors = RunSpecificTestCaseIn(kExtendedTest); break; case 6: errors = RunSpecificTestCaseIn(kExtendedTest); break;
default: errors = RunSpecialTestCase(choice); break; default: errors = RunSpecialTestCase(choice); break;
} }
} while (choice != 0);
if (errors) { if (errors) {
ViETest::Log("Test done with errors, see ViEAutotestLog.txt for test " ViETest::Log("Test done with errors, see ViEAutotestLog.txt for test "

View File

@ -768,20 +768,6 @@ int32_t ViEChannel::SetHybridNACKFECStatus(
return ProcessFECRequest(enable, payload_typeRED, payload_typeFEC); return ProcessFECRequest(enable, payload_typeRED, payload_typeFEC);
} }
void ViEChannel::SetDecodeErrorMode(ViECodec::ViEDecodeErrorMode error_mode) {
switch (error_mode) {
case ViECodec::kNoErrors:
vcm_.SetDecodeErrorMode(kNoErrors);
break;
case ViECodec::kSelectiveErrors:
vcm_.SetDecodeErrorMode(kSelectiveErrors);
break;
case ViECodec::kWithErrors:
vcm_.SetDecodeErrorMode(kWithErrors);
break;
}
}
int ViEChannel::SetSenderBufferingMode(int target_delay_ms) { int ViEChannel::SetSenderBufferingMode(int target_delay_ms) {
if ((target_delay_ms < 0) || (target_delay_ms > kMaxTargetDelayMs)) { if ((target_delay_ms < 0) || (target_delay_ms > kMaxTargetDelayMs)) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_), WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, channel_id_),

View File

@ -15,12 +15,10 @@
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
#include "webrtc/modules/video_coding/main/interface/video_coding.h"
#include "webrtc/modules/video_coding/main/interface/video_coding_defines.h" #include "webrtc/modules/video_coding/main/interface/video_coding_defines.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h"
#include "webrtc/system_wrappers/interface/tick_util.h" #include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
#include "webrtc/video_engine/include/vie_codec.h"
#include "webrtc/video_engine/include/vie_network.h" #include "webrtc/video_engine/include/vie_network.h"
#include "webrtc/video_engine/include/vie_rtp_rtcp.h" #include "webrtc/video_engine/include/vie_rtp_rtcp.h"
#include "webrtc/video_engine/vie_defines.h" #include "webrtc/video_engine/vie_defines.h"
@ -117,7 +115,6 @@ class ViEChannel
int32_t SetHybridNACKFECStatus(const bool enable, int32_t SetHybridNACKFECStatus(const bool enable,
const unsigned char payload_typeRED, const unsigned char payload_typeRED,
const unsigned char payload_typeFEC); const unsigned char payload_typeFEC);
void SetDecodeErrorMode(ViECodec::ViEDecodeErrorMode error_mode);
int SetSenderBufferingMode(int target_delay_ms); int SetSenderBufferingMode(int target_delay_ms);
int SetReceiverBufferingMode(int target_delay_ms); int SetReceiverBufferingMode(int target_delay_ms);
int32_t SetKeyFrameRequestMethod(const KeyFrameRequestMethod method); int32_t SetKeyFrameRequestMethod(const KeyFrameRequestMethod method);

View File

@ -690,25 +690,6 @@ int ViECodecImpl::WaitForFirstKeyFrame(const int video_channel,
return 0; return 0;
} }
int ViECodecImpl::SetDecodeErrorMode(const int video_channel,
const ViEDecodeErrorMode error_mode) {
WEBRTC_TRACE(kTraceApiCall, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s(channel: %d)", __FUNCTION__, video_channel);
ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));
ViEChannel* vie_channel = cs.Channel(video_channel);
if (!vie_channel) {
WEBRTC_TRACE(kTraceError, kTraceVideo,
ViEId(shared_data_->instance_id(), video_channel),
"%s: Channel %d does not exist", __FUNCTION__, video_channel);
shared_data_->SetLastError(kViEBaseInvalidChannelId);
return -1;
}
vie_channel->SetDecodeErrorMode(error_mode);
return 0;
}
int ViECodecImpl::StartDebugRecording(int video_channel, int ViECodecImpl::StartDebugRecording(int video_channel,
const char* file_name_utf8) { const char* file_name_utf8) {
ViEChannelManagerScoped cs(*(shared_data_->channel_manager())); ViEChannelManagerScoped cs(*(shared_data_->channel_manager()));

View File

@ -69,8 +69,6 @@ class ViECodecImpl
virtual int WaitForFirstKeyFrame(const int video_channel, const bool wait); virtual int WaitForFirstKeyFrame(const int video_channel, const bool wait);
virtual int StartDebugRecording(int video_channel, virtual int StartDebugRecording(int video_channel,
const char* file_name_utf8); const char* file_name_utf8);
virtual int SetDecodeErrorMode(const int video_channel,
const ViEDecodeErrorMode error_mode);
virtual int StopDebugRecording(int video_channel); virtual int StopDebugRecording(int video_channel);
protected: protected: