From 0d6fd2a9433c013aed5b0edfce8c17424923271b Mon Sep 17 00:00:00 2001 From: "marpan@google.com" Date: Thu, 28 Jul 2011 17:15:39 +0000 Subject: [PATCH] Allowing for setting the video protection methods in auto_test_custom_call. Review URL: http://webrtc-codereview.appspot.com/96001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@264 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../source/vie_autotest_custom_call.cc | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/src/video_engine/main/test/AutoTest/source/vie_autotest_custom_call.cc b/src/video_engine/main/test/AutoTest/source/vie_autotest_custom_call.cc index 2370604596..fa5008965b 100644 --- a/src/video_engine/main/test/AutoTest/source/vie_autotest_custom_call.cc +++ b/src/video_engine/main/test/AutoTest/source/vie_autotest_custom_call.cc @@ -18,6 +18,9 @@ #include +#define VCM_RED_PAYLOAD_TYPE 96 +#define VCM_ULPFEC_PAYLOAD_TYPE 97 + int ViEAutoTest::ViECustomCall() { @@ -114,6 +117,7 @@ int ViEAutoTest::ViECustomCall() int audioRxPort = 0; webrtc::CodecInst audioCodec; int audioChannel = -1; + int protectionMethod = 0; while(1) { @@ -136,6 +140,16 @@ int ViEAutoTest::ViECustomCall() memset((void*)&videoCodec, 0, sizeof(videoCodec)); GetVideoCodec(ptrViECodec, videoCodec); + // Choose video protection mode + std::cout << "Enter Video Protection Method:" << std::endl; + std::cout << "0. None" << std::endl; + std::cout << "1. FEC" << std::endl; + std::cout << "2. NACK" << std::endl; + std::cout << "3. NACK+FEC" << std::endl; + std::string method; + std::getline(std::cin, method); + protectionMethod = atoi(method.c_str()); + // audio devices memset(audioCaptureDeviceName, 0, KMaxUniqueIdLength); memset(audioPlaybackDeviceName, 0, KMaxUniqueIdLength); @@ -291,6 +305,54 @@ int ViEAutoTest::ViECustomCall() "ERROR: %s at line %d", __FUNCTION__, __LINE__); + // Set video protection for FEC and/or NACK + switch (protectionMethod) + { + case 0: // None + error = ptrViERtpRtcp->SetFECStatus(videoChannel, false, + VCM_RED_PAYLOAD_TYPE, + VCM_ULPFEC_PAYLOAD_TYPE); + numberOfErrors += ViETest::TestError(error == 0, + "ERROR: %s at line %d", + __FUNCTION__, __LINE__); + + error = ptrViERtpRtcp->SetNACKStatus(videoChannel, false); + numberOfErrors += ViETest::TestError(error == 0, + "ERROR: %s at line %d", + __FUNCTION__, __LINE__); + break; + + case 1: // FEC only + error = ptrViERtpRtcp->SetFECStatus(videoChannel, true, + VCM_RED_PAYLOAD_TYPE, + VCM_ULPFEC_PAYLOAD_TYPE); + numberOfErrors += ViETest::TestError(error == 0, + "ERROR: %s at line %d", + __FUNCTION__, __LINE__); + + error = ptrViERtpRtcp->SetNACKStatus(videoChannel, false); + numberOfErrors += ViETest::TestError(error == 0, + "ERROR: %s at line %d", + __FUNCTION__, __LINE__); + break; + + case 2: // NACK only + error = ptrViERtpRtcp->SetNACKStatus(videoChannel, true); + numberOfErrors += ViETest::TestError(error == 0, + "ERROR: %s at line %d", + __FUNCTION__, __LINE__); + break; + + case 3: // Hybrid NACK and FEC + error = ptrViERtpRtcp->SetHybridNACKFECStatus(videoChannel, true, + VCM_RED_PAYLOAD_TYPE, + VCM_ULPFEC_PAYLOAD_TYPE); + numberOfErrors += ViETest::TestError(error == 0, + "ERROR: %s at line %d", + __FUNCTION__, __LINE__); + break; + } + error = ptrViERtpRtcp->SetTMMBRStatus(videoChannel, true); numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d", @@ -329,6 +391,34 @@ int ViEAutoTest::ViECustomCall() "ERROR: %s at line %d", __FUNCTION__, __LINE__); + // Set receive codecs for FEC and hybrid NACK/FEC + if (protectionMethod == 1 || protectionMethod == 3) + { + // RED + error = ptrViECodec->GetCodec(ptrViECodec->NumberOfCodecs() - 2, + 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__); + + // ULPFEC + error = ptrViECodec->GetCodec(ptrViECodec->NumberOfCodecs() - 1, + 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__); + } + // **** start the engines // VE first error = ptrVEBase->StartReceive(audioChannel);