ViE Custom Call added SetImageScaleStatus toggle option and other changes.

1. added SetImageScaleStatus for testing purposes
2. added getting the codec information from the incoming/outgoing stream of a videochannel to print call information
3. fixed problem with toggling the one of the observers
4. did more clean up of the code style (mostly spacing)
5. renamed the GetVideo* functions properly to SetVideo* to reflect what the function does

Currently only tested on mac.  Need to test on win7 & linux before final commit.
Review URL: http://webrtc-codereview.appspot.com/267017

git-svn-id: http://webrtc.googlecode.com/svn/trunk@969 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
amyfong@webrtc.org 2011-11-17 21:29:39 +00:00
parent cd7b57ef9e
commit 917fa6b923

View File

@ -25,7 +25,7 @@
#define DEFAULT_VIDEO_CODEC "vp8" #define DEFAULT_VIDEO_CODEC "vp8"
#define DEFAULT_VIDEO_CODEC_WIDTH 640 #define DEFAULT_VIDEO_CODEC_WIDTH 640
#define DEFAULT_VIDEO_CODEC_HEIGHT 480 #define DEFAULT_VIDEO_CODEC_HEIGHT 480
#define DEFAULT_VIDEO_CODEC_BITRATE 100 #define DEFAULT_VIDEO_CODEC_BITRATE 300
#define DEFAULT_VIDEO_CODEC_MAX_BITRATE 1000 #define DEFAULT_VIDEO_CODEC_MAX_BITRATE 1000
#define DEFAULT_AUDIO_PORT 11113 #define DEFAULT_AUDIO_PORT 11113
#define DEFAULT_AUDIO_CODEC "ISAC" #define DEFAULT_AUDIO_CODEC "ISAC"
@ -79,7 +79,7 @@ class ViEAutotestDecoderObserver: public webrtc::ViEDecoderObserver {
} }
}; };
// general settings functions // The following are general helper functions.
bool GetVideoDevice(webrtc::ViEBase* ptrViEBase, bool GetVideoDevice(webrtc::ViEBase* ptrViEBase,
webrtc::ViECapture* ptrViECapture, webrtc::ViECapture* ptrViECapture,
char* captureDeviceName, char* captureDeviceUniqueId); char* captureDeviceName, char* captureDeviceUniqueId);
@ -87,7 +87,7 @@ bool GetIPAddress(char* IP);
#ifndef WEBRTC_ANDROID #ifndef WEBRTC_ANDROID
bool ValidateIP(std::string iStr); bool ValidateIP(std::string iStr);
#endif #endif
// Print Call information and statistics // The following are Print to stdout functions.
void PrintCallInformation(char* IP, char* videoCaptureDeviceName, void PrintCallInformation(char* IP, char* videoCaptureDeviceName,
char* videoCaptureUniqueId, char* videoCaptureUniqueId,
webrtc::VideoCodec videoCodec, int videoTxPort, webrtc::VideoCodec videoCodec, int videoTxPort,
@ -104,27 +104,29 @@ void PrintBandwidthUsage(webrtc::ViERTP_RTCP* ptrViERtpRtcp,
void PrintCodecStatistics(webrtc::ViECodec* ptrViECodec, int videoChannel, void PrintCodecStatistics(webrtc::ViECodec* ptrViECodec, int videoChannel,
StatisticsType statType); StatisticsType statType);
void PrintGetDiscardedPackets(webrtc::ViECodec* ptrViECodec, int videoChannel); void PrintGetDiscardedPackets(webrtc::ViECodec* ptrViECodec, int videoChannel);
void PrintVideoStreamInformation(webrtc::ViECodec* ptrViECodec,
int videoChannel);
// video settings functions // The following are video set functions.
bool GetVideoPorts(int* txPort, int* rxPort); bool SetVideoPorts(int* txPort, int* rxPort);
bool GetVideoCodecType(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecType(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec); webrtc::VideoCodec& videoCodec);
bool GetVideoCodecResolution(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecResolution(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec); webrtc::VideoCodec& videoCodec);
bool GetVideoCodecSize(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecSize(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec); webrtc::VideoCodec& videoCodec);
bool GetVideoCodecBitrate(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecBitrate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec); webrtc::VideoCodec& videoCodec);
bool GetVideoCodecMaxBitrate(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecMaxBitrate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec); webrtc::VideoCodec& videoCodec);
bool GetVideoCodecMaxFramerate(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecMaxFramerate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec); webrtc::VideoCodec& videoCodec);
bool SetVideoProtection(webrtc::ViECodec* ptrViECodec, bool SetVideoProtection(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec, webrtc::VideoCodec& videoCodec,
webrtc::ViERTP_RTCP* ptrViERtpRtcp, webrtc::ViERTP_RTCP* ptrViERtpRtcp,
int videoChannel); int videoChannel);
// audio settings functions // The following are audio helper functions.
bool GetAudioDevices(webrtc::VoEBase* ptrVEBase, bool GetAudioDevices(webrtc::VoEBase* ptrVEBase,
webrtc::VoEHardware* ptrVEHardware, webrtc::VoEHardware* ptrVEHardware,
char* recordingDeviceName, int& recordingDeviceIndex, char* recordingDeviceName, int& recordingDeviceIndex,
@ -146,7 +148,7 @@ int ViEAutoTest::ViECustomCall()
int numberOfErrors = 0; int numberOfErrors = 0;
std::string str; std::string str;
// VoE // Create the VoE and get the VoE interfaces.
webrtc::VoiceEngine* ptrVE = webrtc::VoiceEngine::Create(); webrtc::VoiceEngine* ptrVE = webrtc::VoiceEngine::Create();
numberOfErrors += ViETest::TestError(ptrVE != NULL, "ERROR: %s at line %d", numberOfErrors += ViETest::TestError(ptrVE != NULL, "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
@ -177,7 +179,7 @@ int ViEAutoTest::ViECustomCall()
"ERROR: %s at line %d", __FUNCTION__, "ERROR: %s at line %d", __FUNCTION__,
__LINE__); __LINE__);
// ViE // Create the ViE and get the ViE Interfaces.
webrtc::VideoEngine* ptrViE = webrtc::VideoEngine::Create(); webrtc::VideoEngine* ptrViE = webrtc::VideoEngine::Create();
numberOfErrors += ViETest::TestError(ptrViE != NULL, numberOfErrors += ViETest::TestError(ptrViE != NULL,
"ERROR: %s at line %d", __FUNCTION__, "ERROR: %s at line %d", __FUNCTION__,
@ -242,32 +244,32 @@ int ViEAutoTest::ViECustomCall()
// toggle between registered or deregistered // toggle between registered or deregistered
bool isEncoderObserverRegistered = false; bool isEncoderObserverRegistered = false;
bool isDecoderObserverRegistered = false; bool isDecoderObserverRegistered = false;
bool isImageScaleEnabled = false;
while(1) while (!startCall) {
{ // Get the IP address to use from call.
// IP
memset(ipAddress, 0, kMaxIPLength); memset(ipAddress, 0, kMaxIPLength);
GetIPAddress(ipAddress); GetIPAddress(ipAddress);
// video devices // Get the video device to use for call.
memset(deviceName, 0, KMaxUniqueIdLength); memset(deviceName, 0, KMaxUniqueIdLength);
memset(uniqueId, 0, KMaxUniqueIdLength); memset(uniqueId, 0, KMaxUniqueIdLength);
GetVideoDevice(ptrViEBase, ptrViECapture, deviceName, uniqueId); GetVideoDevice(ptrViEBase, ptrViECapture, deviceName, uniqueId);
// video ports // Get and set the video ports for the call.
videoTxPort = 0; videoTxPort = 0;
videoRxPort = 0; videoRxPort = 0;
GetVideoPorts(&videoTxPort, &videoRxPort); SetVideoPorts(&videoTxPort, &videoRxPort);
// video codecs // Get and set the video codec paramters for the call.
memset((void*)&videoCodec, 0, sizeof(videoCodec)); memset((void*)&videoCodec, 0, sizeof(videoCodec));
GetVideoCodecType(ptrViECodec, videoCodec); SetVideoCodecType(ptrViECodec, videoCodec);
GetVideoCodecSize(ptrViECodec, videoCodec); SetVideoCodecSize(ptrViECodec, videoCodec);
GetVideoCodecBitrate(ptrViECodec, videoCodec); SetVideoCodecBitrate(ptrViECodec, videoCodec);
GetVideoCodecMaxBitrate(ptrViECodec, videoCodec); SetVideoCodecMaxBitrate(ptrViECodec, videoCodec);
GetVideoCodecMaxFramerate(ptrViECodec, videoCodec); SetVideoCodecMaxFramerate(ptrViECodec, videoCodec);
// Choose video protection mode // Choose video protection method for the call.
std::cout << "Available 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;
@ -279,23 +281,23 @@ int ViEAutoTest::ViECustomCall()
std::getline(std::cin, method); std::getline(std::cin, method);
protectionMethod = atoi(method.c_str()); protectionMethod = atoi(method.c_str());
// audio devices // Get the audio device for the call.
memset(audioCaptureDeviceName, 0, KMaxUniqueIdLength); memset(audioCaptureDeviceName, 0, KMaxUniqueIdLength);
memset(audioPlaybackDeviceName, 0, KMaxUniqueIdLength); memset(audioPlaybackDeviceName, 0, KMaxUniqueIdLength);
GetAudioDevices(ptrVEBase, ptrVEHardware, audioCaptureDeviceName, GetAudioDevices(ptrVEBase, ptrVEHardware, audioCaptureDeviceName,
audioCaptureDeviceIndex, audioPlaybackDeviceName, audioCaptureDeviceIndex, audioPlaybackDeviceName,
audioPlaybackDeviceIndex); audioPlaybackDeviceIndex);
// audio port // Get the audio port for the call.
audioTxPort = 0; audioTxPort = 0;
audioRxPort = 0; audioRxPort = 0;
GetAudioPorts(&audioTxPort, &audioRxPort); GetAudioPorts(&audioTxPort, &audioRxPort);
// audio codec // Get the audio codec for the call.
memset((void*)&audioCodec, 0, sizeof(audioCodec)); memset((void*)&audioCodec, 0, sizeof(audioCodec));
GetAudioCodec(ptrVECodec, audioCodec); GetAudioCodec(ptrVECodec, audioCodec);
// start the call now // Now ready to start the call. Check user wants to continue.
PrintCallInformation(ipAddress, deviceName, uniqueId, videoCodec, PrintCallInformation(ipAddress, deviceName, uniqueId, videoCodec,
videoTxPort, videoRxPort, audioCaptureDeviceName, videoTxPort, videoRxPort, audioCaptureDeviceName,
audioPlaybackDeviceName, audioCodec, audioTxPort, audioPlaybackDeviceName, audioCodec, audioTxPort,
@ -304,7 +306,6 @@ int ViEAutoTest::ViECustomCall()
std::cout << std::endl; std::cout << std::endl;
std::cout << "1. Start the call" << std::endl; std::cout << "1. Start the call" << std::endl;
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 << "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): ";
@ -312,35 +313,28 @@ int ViEAutoTest::ViECustomCall()
int selection = 0; int selection = 0;
selection = atoi(str.c_str()); selection = atoi(str.c_str());
if(selection == 0 || selection == 1) switch (selection) {
{ case 0:
startCall = true; startCall = true;
break; break;
} case 1:
else if(selection == 2) startCall = true;
{ break;
continue; case 2:
}
else if(selection == 3)
{
startCall = false; startCall = false;
break; break;
} default:
else // Invalid selection gets error mesage.
{ std::cout << "ERROR: Code=" << error
// invalid selection << " Invalid selection" << std::endl;
std::cout << "ERROR: Code=" << error <<
" Invalid selection" << std::endl;
continue; continue;
} }
} }
//*************************************************************** //***************************************************************
// Begin create/initialize WebRTC Video Engine for testing // Begin create/initialize WebRTC Video Engine for testing.
//*************************************************************** //***************************************************************
if(startCall == true) if (startCall == true) {
{ // Configure audio channel first.
// Configure Audio first
audioChannel = ptrVEBase->CreateChannel(); audioChannel = ptrVEBase->CreateChannel();
error = ptrVEBase->SetSendDestination(audioChannel, audioTxPort, error = ptrVEBase->SetSendDestination(audioChannel, audioTxPort,
ipAddress); ipAddress);
@ -377,7 +371,7 @@ 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 // Now configure the video channel.
error = ptrViE->SetTraceFilter(webrtc::kTraceAll); error = ptrViE->SetTraceFilter(webrtc::kTraceAll);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
@ -441,8 +435,8 @@ int ViEAutoTest::ViECustomCall()
// Set all video protection to false initially // Set all video protection to false initially
// shouldn't be nessecary as ViE protection modes are all off // shouldn't be nessecary as ViE protection modes are all off
// initially. // initially.
// TODO(amyfong): remove the set to false and use i // TODO(amyfong): Remove the set to false and use
// SetVideoProtection instead // SetVideoProtection instead.
error = ptrViERtpRtcp->SetHybridNACKFECStatus(videoChannel, false, error = ptrViERtpRtcp->SetHybridNACKFECStatus(videoChannel, false,
VCM_RED_PAYLOAD_TYPE, VCM_RED_PAYLOAD_TYPE,
VCM_ULPFEC_PAYLOAD_TYPE); VCM_ULPFEC_PAYLOAD_TYPE);
@ -459,14 +453,13 @@ 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__);
// Set video protection for FEC, NACK or Hybrid // Set video protection for FEC, NACK or Hybrid.
// TODO(amyfong): Use SetVideoProtection instead, need to // TODO(amyfong): Use SetVideoProtection instead, need to
// move the set protection method after the first SetReceiveCodec // move the set protection method after the first SetReceiveCodec
// also should change and use videoSendCodec & videoReceiveCodec // also should change and use videoSendCodec & videoReceiveCodec
// instead of just videoCodec. Helps check what exactly the call // instead of just videoCodec. Helps check what exactly the call
// setup is onces the call is up and running // setup is onces the call is up and running.
switch (protectionMethod) switch (protectionMethod) {
{
case 0: // None case 0: // None
// No protection selected, all protection already at false // No protection selected, all protection already at false
break; break;
@ -510,7 +503,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__);
error = ptrViENetwork->SetSendDestination(videoChannel, ipAddress, error = ptrViENetwork->SetSendDestination(videoChannel, ipAddress,
videoTxPort); videoTxPort);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
@ -532,15 +524,14 @@ int ViEAutoTest::ViECustomCall()
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
// Set receive codecs for FEC and hybrid NACK/FEC // Set receive codecs for FEC and hybrid NACK/FEC.
// TODO(amyfong): Use SetVideoProtection instead, need to // TODO(amyfong): Use SetVideoProtection instead, need to
// move the set protection method after the first SetReceiveCodec // move the set protection method after the first SetReceiveCodec
// also should change and use videoSendCodec & videoReceiveCodec // also should change and use videoSendCodec & videoReceiveCodec
// instead of just videoCodec. Helps check what exactly the call // instead of just videoCodec. Helps check what exactly the call
// setup is onces the call is up and running // setup is onces the call is up and running.
if (protectionMethod == 1 || protectionMethod == 3) if (protectionMethod == 1 || protectionMethod == 3) {
{
// RED // RED
error = ptrViECodec->GetCodec(ptrViECodec->NumberOfCodecs() - 2, error = ptrViECodec->GetCodec(ptrViECodec->NumberOfCodecs() - 2,
videoCodec); videoCodec);
@ -566,8 +557,8 @@ int ViEAutoTest::ViECustomCall()
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
} }
// **** start the engines // **** Start the engines.
// VE first // Start VE first
error = ptrVEBase->StartReceive(audioChannel); error = ptrVEBase->StartReceive(audioChannel);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
@ -607,7 +598,7 @@ int ViEAutoTest::ViECustomCall()
int fileId; int fileId;
// Codec Observers // Codec Observers
// TODO (amyfong): Change the observers to pointers, use NULL checks // TODO (amyfong): Change the observers to pointers, use NULL checks
// to toggle between registered or deregistered // to toggle between registered or deregistered.
ViEAutotestEncoderObserver codecEncoderObserver; ViEAutotestEncoderObserver codecEncoderObserver;
ViEAutotestDecoderObserver codecDecoderObserver; ViEAutotestDecoderObserver codecDecoderObserver;
@ -616,12 +607,12 @@ int ViEAutoTest::ViECustomCall()
// 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 // Modify call or stop call.
std::cout << "Custom call in progress, would you like do?" << std::endl; std::cout << "Custom call in progress, would you like do?" << std::endl;
std::cout << " 0. Stop the call" << std::endl; std::cout << " 0. Stop the call" << std::endl;
@ -633,11 +624,10 @@ int ViEAutoTest::ViECustomCall()
int selection = 0; int selection = 0;
selection = atoi(str.c_str()); selection = atoi(str.c_str());
// keep on modifying the call until user selects finish modify call // Keep on modifying the call until user selects finish modify call.
bool modify_call = false; bool modify_call = false;
while (selection == 1) { while (selection == 1) {
std::cout << "Modify Custom Call" << std::endl; std::cout << "Modify Custom Call" << std::endl;
std::cout << " 0. Finished modifying custom call" << std::endl; std::cout << " 0. Finished modifying custom call" << std::endl;
std::cout << " 1. Change Video Codec" << std::endl; std::cout << " 1. Change Video Codec" << std::endl;
@ -655,6 +645,9 @@ int ViEAutoTest::ViECustomCall()
std::cout << " 10. Toggle Decoder Observer" << std::endl; std::cout << " 10. Toggle Decoder Observer" << std::endl;
std::cout << " 11. Print Call Information" << std::endl; std::cout << " 11. Print Call Information" << std::endl;
std::cout << " 12. Print Call Statistics" << std::endl; std::cout << " 12. Print Call Statistics" << std::endl;
std::cout << " 13. Toggle Image Scaling "
<< "(Warning high CPU usage when enabled)"
<< std::endl;
std::cout << "What do you want to do? "; std::cout << "What do you want to do? ";
std::cout << "Press enter for default " std::cout << "Press enter for default "
<< "(Finished modifying custom call): "; << "(Finished modifying custom call): ";
@ -672,11 +665,11 @@ int ViEAutoTest::ViECustomCall()
break; break;
case 1: case 1:
// Change video Codec // Change video Codec
GetVideoCodecType(ptrViECodec, videoCodec); SetVideoCodecType(ptrViECodec, videoCodec);
GetVideoCodecSize(ptrViECodec, videoCodec); SetVideoCodecSize(ptrViECodec, videoCodec);
GetVideoCodecBitrate(ptrViECodec, videoCodec); SetVideoCodecBitrate(ptrViECodec, videoCodec);
GetVideoCodecMaxBitrate(ptrViECodec, videoCodec); SetVideoCodecMaxBitrate(ptrViECodec, videoCodec);
GetVideoCodecMaxFramerate(ptrViECodec, videoCodec); SetVideoCodecMaxFramerate(ptrViECodec, videoCodec);
PrintCallInformation(ipAddress, deviceName, PrintCallInformation(ipAddress, deviceName,
uniqueId, videoCodec, uniqueId, videoCodec,
videoTxPort, videoRxPort, videoTxPort, videoRxPort,
@ -695,7 +688,7 @@ int ViEAutoTest::ViECustomCall()
break; break;
case 2: case 2:
// Change Video codec size by common resolution // Change Video codec size by common resolution
GetVideoCodecResolution(ptrViECodec, videoCodec); SetVideoCodecResolution(ptrViECodec, videoCodec);
PrintCallInformation(ipAddress, deviceName, PrintCallInformation(ipAddress, deviceName,
uniqueId, videoCodec, uniqueId, videoCodec,
videoTxPort, videoRxPort, videoTxPort, videoRxPort,
@ -715,7 +708,7 @@ int ViEAutoTest::ViECustomCall()
break; break;
case 3: case 3:
// Change Video codec by size height and width // Change Video codec by size height and width
GetVideoCodecSize(ptrViECodec, videoCodec); SetVideoCodecSize(ptrViECodec, videoCodec);
PrintCallInformation(ipAddress, deviceName, PrintCallInformation(ipAddress, deviceName,
uniqueId, videoCodec, uniqueId, videoCodec,
videoTxPort, videoRxPort, videoTxPort, videoRxPort,
@ -763,8 +756,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__);
error = ptrViECapture->ConnectCaptureDevice( error = ptrViECapture->ConnectCaptureDevice(captureId,
captureId, videoChannel); videoChannel);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
@ -893,7 +886,6 @@ int ViEAutoTest::ViECustomCall()
audioPlaybackDeviceName, audioPlaybackDeviceName,
audioCodec, audioTxPort, audioCodec, audioTxPort,
audioRxPort); audioRxPort);
modify_call = true; modify_call = true;
break; break;
case 9: case 9:
@ -911,7 +903,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__);
isEncoderObserverRegistered = false;
} }
isEncoderObserverRegistered = !isEncoderObserverRegistered; isEncoderObserverRegistered = !isEncoderObserverRegistered;
modify_call = true; modify_call = true;
@ -944,6 +935,8 @@ int ViEAutoTest::ViECustomCall()
audioPlaybackDeviceName, audioPlaybackDeviceName,
audioCodec, audioTxPort, audioCodec, audioTxPort,
audioRxPort); audioRxPort);
PrintVideoStreamInformation(ptrViECodec,
videoChannel);
modify_call = true; modify_call = true;
break; break;
case 12: case 12:
@ -961,6 +954,16 @@ int ViEAutoTest::ViECustomCall()
PrintGetDiscardedPackets(ptrViECodec, videoChannel); PrintGetDiscardedPackets(ptrViECodec, videoChannel);
modify_call = true; modify_call = true;
break; break;
case 13:
isImageScaleEnabled = !isImageScaleEnabled;
ptrViECodec->SetImageScaleStatus(videoChannel, isImageScaleEnabled);
if (isImageScaleEnabled) {
std::cout << "Image Scale is now enabled" << std::endl;
} else {
std::cout << "Image Scale is now disabled" << std::endl;
}
modify_call = true;
break;
default: default:
// invalid selection, shows options menu again // invalid selection, shows options menu again
std::cout << "Invalid selection. Select Again." << std::endl; std::cout << "Invalid selection. Select Again." << std::endl;
@ -976,9 +979,9 @@ int ViEAutoTest::ViECustomCall()
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 Voice and Video Engine.
//*************************************************************** //***************************************************************
// audio engine first // Tear down the VE first.
error = ptrVEBase->StopReceive(audioChannel); error = ptrVEBase->StopReceive(audioChannel);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
@ -993,7 +996,7 @@ 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 tear down the ViE engine.
error = ptrViEBase->DisconnectAudioChannel(videoChannel); error = ptrViEBase->DisconnectAudioChannel(videoChannel);
error = ptrViEBase->StopReceive(videoChannel); error = ptrViEBase->StopReceive(videoChannel);
@ -1108,8 +1111,7 @@ bool GetVideoDevice(webrtc::ViEBase* ptrViEBase,
char deviceName[KMaxDeviceNameLength]; char deviceName[KMaxDeviceNameLength];
char uniqueId[KMaxUniqueIdLength]; char uniqueId[KMaxUniqueIdLength];
while(1) while (1) {
{
memset(deviceName, 0, KMaxDeviceNameLength); memset(deviceName, 0, KMaxDeviceNameLength);
memset(uniqueId, 0, KMaxUniqueIdLength); memset(uniqueId, 0, KMaxUniqueIdLength);
@ -1117,8 +1119,8 @@ bool GetVideoDevice(webrtc::ViEBase* ptrViEBase,
std::cout << "Available video 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++) {
memset(deviceName, 0, KMaxDeviceNameLength); memset(deviceName, 0, KMaxDeviceNameLength);
memset(uniqueId, 0, KMaxUniqueIdLength); memset(uniqueId, 0, KMaxUniqueIdLength);
@ -1133,7 +1135,7 @@ bool GetVideoDevice(webrtc::ViEBase* ptrViEBase,
<< "/" << uniqueId << "/" << 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.
error = ptrViECapture->GetCaptureDevice(0, deviceName, error = ptrViECapture->GetCaptureDevice(0, deviceName,
KMaxDeviceNameLength, KMaxDeviceNameLength,
uniqueId, uniqueId,
@ -1147,9 +1149,8 @@ bool GetVideoDevice(webrtc::ViEBase* ptrViEBase,
std::getline(std::cin, str); std::getline(std::cin, str);
captureDeviceIndex = atoi(str.c_str()); captureDeviceIndex = atoi(str.c_str());
if(captureDeviceIndex == 0) if (captureDeviceIndex == 0) {
{ // Use the default (or first) camera.
// use default (or first) camera
error = ptrViECapture->GetCaptureDevice(0, deviceName, error = ptrViECapture->GetCaptureDevice(0, deviceName,
KMaxDeviceNameLength, KMaxDeviceNameLength,
uniqueId, uniqueId,
@ -1160,16 +1161,12 @@ bool GetVideoDevice(webrtc::ViEBase* ptrViEBase,
strcpy(captureDeviceUniqueId, uniqueId); strcpy(captureDeviceUniqueId, uniqueId);
strcpy(captureDeviceName, deviceName); strcpy(captureDeviceName, deviceName);
return true; return true;
} } else if (captureDeviceIndex < 0
else if(captureDeviceIndex < 0
|| (captureDeviceIndex > || (captureDeviceIndex >
(int)ptrViECapture->NumberOfCaptureDevices())) (int)ptrViECapture->NumberOfCaptureDevices())) {
{
// invalid selection // invalid selection
continue; continue;
} } else {
else
{
error = ptrViECapture->GetCaptureDevice(captureDeviceIndex - 1, error = ptrViECapture->GetCaptureDevice(captureDeviceIndex - 1,
deviceName, deviceName,
KMaxDeviceNameLength, KMaxDeviceNameLength,
@ -1190,8 +1187,7 @@ bool GetAudioDevices(webrtc::VoEBase* ptrVEBase,
char* recordingDeviceName, char* recordingDeviceName,
int& recordingDeviceIndex, int& recordingDeviceIndex,
char* playbackDeviceName, char* playbackDeviceName,
int& playbackDeviceIndex) int& playbackDeviceIndex) {
{
int error = 0; int error = 0;
int numberOfErrors = 0; int numberOfErrors = 0;
std::string str; std::string str;
@ -1206,16 +1202,14 @@ bool GetAudioDevices(webrtc::VoEBase* ptrVEBase,
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d", numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
while(1) while (1) {
{
recordingDeviceIndex = -1; recordingDeviceIndex = -1;
std::cout << std::endl; std::cout << std::endl;
std::cout << "Available audio capture devices:" << std::endl; std::cout << "Available audio capture devices:" << std::endl;
int captureIdx = 0; int captureIdx = 0;
for (captureIdx = 0; captureIdx < numberOfRecordingDevices; for (captureIdx = 0; captureIdx < numberOfRecordingDevices;
captureIdx++) captureIdx++) {
{
memset(recordingDeviceName, 0, KMaxDeviceNameLength); memset(recordingDeviceName, 0, KMaxDeviceNameLength);
memset(recordingDeviceUniqueName, 0, KMaxDeviceNameLength); memset(recordingDeviceUniqueName, 0, KMaxDeviceNameLength);
error = ptrVEHardware->GetRecordingDeviceName( error = ptrVEHardware->GetRecordingDeviceName(
@ -1232,9 +1226,8 @@ bool GetAudioDevices(webrtc::VoEBase* ptrVEBase,
std::getline(std::cin, str); std::getline(std::cin, str);
int captureDeviceIndex = atoi(str.c_str()); int captureDeviceIndex = atoi(str.c_str());
if(captureDeviceIndex == 0) if (captureDeviceIndex == 0) {
{ // Use the default (or first) recording device.
// use default (or first) camera
recordingDeviceIndex = 0; recordingDeviceIndex = 0;
error = ptrVEHardware->GetRecordingDeviceName( error = ptrVEHardware->GetRecordingDeviceName(
recordingDeviceIndex, recordingDeviceName, recordingDeviceIndex, recordingDeviceName,
@ -1243,15 +1236,11 @@ bool GetAudioDevices(webrtc::VoEBase* ptrVEBase,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
break; break;
} } else if (captureDeviceIndex < 0
else if(captureDeviceIndex < 0 || captureDeviceIndex > numberOfRecordingDevices) {
|| captureDeviceIndex > numberOfRecordingDevices)
{
// invalid selection // invalid selection
continue; continue;
} } else {
else
{
recordingDeviceIndex = captureDeviceIndex - 1; recordingDeviceIndex = captureDeviceIndex - 1;
error = ptrVEHardware->GetRecordingDeviceName( error = ptrVEHardware->GetRecordingDeviceName(
recordingDeviceIndex, recordingDeviceName, recordingDeviceIndex, recordingDeviceName,
@ -1268,16 +1257,14 @@ bool GetAudioDevices(webrtc::VoEBase* ptrVEBase,
numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d", numberOfErrors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
while(1) while (1) {
{
playbackDeviceIndex = -1; playbackDeviceIndex = -1;
std::cout << std::endl; std::cout << std::endl;
std::cout << "Available audio playout devices:" << std::endl; std::cout << "Available audio playout devices:" << std::endl;
int captureIdx = 0; int captureIdx = 0;
for (captureIdx = 0; captureIdx < numberOfPlaybackDevices; for (captureIdx = 0; captureIdx < numberOfPlaybackDevices;
captureIdx++) captureIdx++) {
{
memset(playbackDeviceName, 0, KMaxDeviceNameLength); memset(playbackDeviceName, 0, KMaxDeviceNameLength);
memset(playbackDeviceUniqueName, 0, KMaxDeviceNameLength); memset(playbackDeviceUniqueName, 0, KMaxDeviceNameLength);
error = ptrVEHardware->GetPlayoutDeviceName( error = ptrVEHardware->GetPlayoutDeviceName(
@ -1295,9 +1282,8 @@ bool GetAudioDevices(webrtc::VoEBase* ptrVEBase,
std::getline(std::cin, str); std::getline(std::cin, str);
int captureDeviceIndex = atoi(str.c_str()); int captureDeviceIndex = atoi(str.c_str());
if(captureDeviceIndex == 0) if (captureDeviceIndex == 0) {
{ // Use the default (or first) playout device.
// use default (or first) camera
playbackDeviceIndex = 0; playbackDeviceIndex = 0;
error = ptrVEHardware->GetPlayoutDeviceName( error = ptrVEHardware->GetPlayoutDeviceName(
playbackDeviceIndex, playbackDeviceName, playbackDeviceIndex, playbackDeviceName,
@ -1306,15 +1292,11 @@ bool GetAudioDevices(webrtc::VoEBase* ptrVEBase,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
return true; return true;
} } else if (captureDeviceIndex < 0
else if(captureDeviceIndex < 0 || captureDeviceIndex > numberOfPlaybackDevices) {
|| captureDeviceIndex > numberOfPlaybackDevices)
{
// invalid selection // invalid selection
continue; continue;
} } else {
else
{
playbackDeviceIndex = captureDeviceIndex - 1; playbackDeviceIndex = captureDeviceIndex - 1;
error = ptrVEHardware->GetPlayoutDeviceName( error = ptrVEHardware->GetPlayoutDeviceName(
playbackDeviceIndex, playbackDeviceName, playbackDeviceIndex, playbackDeviceName,
@ -1327,31 +1309,27 @@ bool GetAudioDevices(webrtc::VoEBase* ptrVEBase,
} }
} }
// general settings functions // General helper functions.
bool GetIPAddress(char* iIP) { bool GetIPAddress(char* iIP) {
char oIP[16] = DEFAULT_SEND_IP; char oIP[16] = DEFAULT_SEND_IP;
std::string str; std::string str;
while(1) while (1) {
{
std::cout << std::endl; std::cout << std::endl;
std::cout << "Enter destination IP. Press enter for default (" std::cout << "Enter destination IP. Press enter for default ("
<< oIP << "): "; << oIP << "): ";
std::getline(std::cin, str); std::getline(std::cin, str);
if(str.compare("") == 0) if (str.compare("") == 0) {
{
// use default value; // use default value;
strcpy(iIP, oIP); strcpy(iIP, oIP);
return true; return true;
} }
if (ValidateIP(str) == false) {
if(ValidateIP(str) == false)
{
std::cout << "Invalid entry. Try again." << std::endl; std::cout << "Invalid entry. Try again." << std::endl;
continue; continue;
} }
// done. Copy std::string to c_string and return // done. Copy std::string to c_string and return
strcpy(iIP, str.c_str()); strcpy(iIP, str.c_str());
return true; return true;
@ -1361,15 +1339,15 @@ bool GetIPAddress(char* iIP) {
} }
bool ValidateIP(std::string iStr) { bool ValidateIP(std::string iStr) {
if(0 == iStr.compare("")) if (0 == iStr.compare("")) {
{
return false; return false;
} }
return true; return true;
} }
// video settings functions // Video settings functions.
bool GetVideoPorts(int* txPort, int* rxPort) {
bool SetVideoPorts(int* txPort, int* rxPort) {
std::string str; std::string str;
int port = 0; int port = 0;
@ -1377,56 +1355,42 @@ bool GetVideoPorts(int* txPort, int* rxPort) {
*txPort = DEFAULT_VIDEO_PORT; *txPort = DEFAULT_VIDEO_PORT;
*rxPort = DEFAULT_VIDEO_PORT; *rxPort = DEFAULT_VIDEO_PORT;
while(1) while (1) {
{
std::cout << "Enter video send port. Press enter for default (" std::cout << "Enter video send port. Press enter for default ("
<< *txPort << "): "; << *txPort << "): ";
std::getline(std::cin, str); std::getline(std::cin, str);
port = atoi(str.c_str()); port = atoi(str.c_str());
if(port == 0) if (port == 0) {
{
// default value // default value
break; break;
} } else {
else
{
// user selection // user selection
if(port <= 0 || port > 63556) if (port <= 0 || port > 63556) {
{
// invalid selection // invalid selection
continue; continue;
} } else {
else
{
*txPort = port; *txPort = port;
break; // move on to rxport break; // move on to rxport
} }
} }
} }
while(1) while (1) {
{
std::cout << "Enter video receive port. Press enter for default (" std::cout << "Enter video receive port. Press enter for default ("
<< *rxPort << "): "; << *rxPort << "): ";
std::getline(std::cin, str); std::getline(std::cin, str);
port = atoi(str.c_str()); port = atoi(str.c_str());
if(port == 0) if (port == 0) {
{
// default value // default value
return true; return true;
} } else {
else
{
// user selection // user selection
if(port <= 0 || port > 63556) if (port <= 0 || port > 63556) {
{
// invalid selection // invalid selection
continue; continue;
} } else {
else
{
*rxPort = port; *rxPort = port;
return true; return true;
} }
@ -1436,7 +1400,8 @@ bool GetVideoPorts(int* txPort, int* rxPort) {
return false; return false;
} }
// audio settings functions // Audio settings functions.
bool GetAudioPorts(int* txPort, int* rxPort) { bool GetAudioPorts(int* txPort, int* rxPort) {
int port = 0; int port = 0;
std::string str; std::string str;
@ -1445,56 +1410,42 @@ bool GetAudioPorts(int* txPort, int* rxPort) {
*txPort = DEFAULT_AUDIO_PORT; *txPort = DEFAULT_AUDIO_PORT;
*rxPort = DEFAULT_AUDIO_PORT; *rxPort = DEFAULT_AUDIO_PORT;
while(1) while (1) {
{
std::cout << "Enter audio send port. Press enter for default (" std::cout << "Enter audio send port. Press enter for default ("
<< *txPort << "): "; << *txPort << "): ";
std::getline(std::cin, str); std::getline(std::cin, str);
port = atoi(str.c_str()); port = atoi(str.c_str());
if(port == 0) if (port == 0) {
{
// default value // default value
break; break;
} } else {
else
{
// user selection // user selection
if(port <= 0 || port > 63556) if (port <= 0 || port > 63556) {
{
// invalid selection // invalid selection
continue; continue;
} } else {
else
{
*txPort = port; *txPort = port;
break; // move on to rxport break; // move on to rxport
} }
} }
} }
while(1) while (1) {
{
std::cout << "Enter audio receive port. Press enter for default (" std::cout << "Enter audio receive port. Press enter for default ("
<< *rxPort << "): "; << *rxPort << "): ";
std::getline(std::cin, str); std::getline(std::cin, str);
port = atoi(str.c_str()); port = atoi(str.c_str());
if(port == 0) if (port == 0) {
{
// default value // default value
return true; return true;
} } else {
else
{
// user selection // user selection
if(port <= 0 || port > 63556) if (port <= 0 || port > 63556) {
{
// invalid selection // invalid selection
continue; continue;
} } else {
else
{
*rxPort = port; *rxPort = port;
return true; return true;
} }
@ -1512,22 +1463,19 @@ bool GetAudioCodec(webrtc::VoECodec* ptrVeCodec,
std::string str; std::string str;
memset(&audioCodec, 0, sizeof(webrtc::CodecInst)); memset(&audioCodec, 0, sizeof(webrtc::CodecInst));
while(1) while (1) {
{
std::cout << std::endl; std::cout << std::endl;
std::cout << "Available audio codecs:" << std::endl; std::cout << "Available audio codecs:" << std::endl;
int codecIdx = 0; int codecIdx = 0;
int defaultCodecIdx = 0; int defaultCodecIdx = 0;
for (codecIdx = 0; codecIdx < ptrVeCodec->NumOfCodecs(); codecIdx++) for (codecIdx = 0; codecIdx < ptrVeCodec->NumOfCodecs(); codecIdx++) {
{
error = ptrVeCodec->GetCodec(codecIdx, audioCodec); error = ptrVeCodec->GetCodec(codecIdx, audioCodec);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
// test for default codec index // test for default codec index
if(strcmp(audioCodec.plname, DEFAULT_AUDIO_CODEC) == 0) if (strcmp(audioCodec.plname, DEFAULT_AUDIO_CODEC) == 0) {
{
defaultCodecIdx = codecIdx; defaultCodecIdx = codecIdx;
} }
std::cout << " " << codecIdx+1 << ". " << audioCodec.plname std::cout << " " << codecIdx+1 << ". " << audioCodec.plname
@ -1539,25 +1487,21 @@ bool GetAudioCodec(webrtc::VoECodec* ptrVeCodec,
std::getline(std::cin, str); std::getline(std::cin, str);
codecSelection = atoi(str.c_str()); codecSelection = atoi(str.c_str());
if(codecSelection == 0) if (codecSelection == 0) {
{
// use default // use default
error = ptrVeCodec->GetCodec(defaultCodecIdx, audioCodec); error = ptrVeCodec->GetCodec(defaultCodecIdx, audioCodec);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
return true; return true;
} } else {
else
{
// user selection // user selection
codecSelection = atoi(str.c_str())-1; codecSelection = atoi(str.c_str())-1;
error = ptrVeCodec->GetCodec(codecSelection, audioCodec); error = ptrVeCodec->GetCodec(codecSelection, audioCodec);
numberOfErrors += ViETest::TestError(error == 0, numberOfErrors += ViETest::TestError(error == 0,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
if(error != 0) if (error != 0) {
{
std::cout << "ERROR: Code = " << error << " Invalid selection" std::cout << "ERROR: Code = " << error << " Invalid selection"
<< std::endl; << std::endl;
continue; continue;
@ -1610,8 +1554,8 @@ void PrintCallInformation(char* IP, char* videoCaptureDeviceName,
std::cout << "************************************************" std::cout << "************************************************"
<< std::endl; << std::endl;
} }
// TODO(amyfong): Change the GetVideo* to SetVideo* where applicable
bool GetVideoCodecType(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecType(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec) { webrtc::VideoCodec& videoCodec) {
int error = 0; int error = 0;
int numberOfErrors = 0; int numberOfErrors = 0;
@ -1650,8 +1594,7 @@ bool GetVideoCodecType(webrtc::ViECodec* ptrViECodec,
"ERROR: %s at line %d", "ERROR: %s at line %d",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__);
exitLoop=true; exitLoop=true;
} } else {
else {
// user selection // user selection
codecSelection = atoi(str.c_str())-1; codecSelection = atoi(str.c_str())-1;
error = ptrViECodec->GetCodec(codecSelection, videoCodec); error = ptrViECodec->GetCodec(codecSelection, videoCodec);
@ -1673,7 +1616,7 @@ bool GetVideoCodecType(webrtc::ViECodec* ptrViECodec,
return true; return true;
} }
bool GetVideoCodecResolution(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecResolution(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec) { webrtc::VideoCodec& videoCodec) {
std::string str; std::string str;
int sizeOption = 5; int sizeOption = 5;
@ -1738,14 +1681,13 @@ bool GetVideoCodecResolution(webrtc::ViECodec* ptrViECodec,
videoCodec.height = 768; videoCodec.height = 768;
break; break;
} }
} } else {
else {
std::cout << "Can Only change codec size if it's VP8" << std::endl; std::cout << "Can Only change codec size if it's VP8" << std::endl;
} }
return true; return true;
} }
bool GetVideoCodecSize(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecSize(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec) { webrtc::VideoCodec& videoCodec) {
if (videoCodec.codecType == webrtc::kVideoCodecVP8) { if (videoCodec.codecType == webrtc::kVideoCodecVP8) {
std::string str; std::string str;
@ -1765,14 +1707,13 @@ bool GetVideoCodecSize(webrtc::ViECodec* ptrViECodec,
if (sizeSelection!=0) { if (sizeSelection!=0) {
videoCodec.height=sizeSelection; videoCodec.height=sizeSelection;
} }
} } else {
else {
std::cout << "Can Only change codec size if it's VP8" << std::endl; std::cout << "Can Only change codec size if it's VP8" << std::endl;
} }
return true; return true;
} }
bool GetVideoCodecBitrate(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecBitrate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec) { webrtc::VideoCodec& videoCodec) {
std::string str; std::string str;
std::cout << std::endl; std::cout << std::endl;
@ -1787,7 +1728,7 @@ bool GetVideoCodecBitrate(webrtc::ViECodec* ptrViECodec,
return true; return true;
} }
bool GetVideoCodecMaxBitrate(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecMaxBitrate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec) { webrtc::VideoCodec& videoCodec) {
std::string str; std::string str;
std::cout << std::endl; std::cout << std::endl;
@ -1802,7 +1743,7 @@ bool GetVideoCodecMaxBitrate(webrtc::ViECodec* ptrViECodec,
return true; return true;
} }
bool GetVideoCodecMaxFramerate(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecMaxFramerate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec) { webrtc::VideoCodec& videoCodec) {
std::string str; std::string str;
std::cout << std::endl; std::cout << std::endl;
@ -2068,3 +2009,43 @@ void PrintGetDiscardedPackets(webrtc::ViECodec* ptrViECodec, int videoChannel) {
std::cout << "\tNumber of discarded packets: " std::cout << "\tNumber of discarded packets: "
<< discardedPackets << std::endl; << discardedPackets << std::endl;
} }
void PrintVideoStreamInformation(webrtc::ViECodec* ptrViECodec,
int videoChannel) {
webrtc::VideoCodec outgoingCodec;
webrtc::VideoCodec incomingCodec;
memset((void*)&outgoingCodec, 0, sizeof(outgoingCodec));
memset((void*)&incomingCodec, 0, sizeof(incomingCodec));
ptrViECodec->GetSendCodec(videoChannel, outgoingCodec);
ptrViECodec->GetReceiveCodec(videoChannel, incomingCodec);
std::cout << "************************************************"
<< std::endl;
std::cout << "ChannelId: " << videoChannel << std::endl;
std::cout << "Outgoing Stream information:" <<std::endl;
std::cout << "\t\tplName: " << outgoingCodec.plName << std::endl;
std::cout << "\t\tplType: " << (int)outgoingCodec.plType << std::endl;
std::cout << "\t\twidth: " << outgoingCodec.width << std::endl;
std::cout << "\t\theight: " << outgoingCodec.height << std::endl;
std::cout << "\t\tstartBitrate: " << outgoingCodec.startBitrate
<< std::endl;
std::cout << "\t\tmaxBitrate: " << outgoingCodec.maxBitrate
<< std::endl;
std::cout << "\t\tmaxFramerate: " << (int)outgoingCodec.maxFramerate
<< std::endl;
std::cout << "Incoming Stream information:" <<std::endl;
std::cout << "\t\tplName: " << incomingCodec.plName << std::endl;
std::cout << "\t\tplType: " << (int)incomingCodec.plType << std::endl;
std::cout << "\t\twidth: " << incomingCodec.width << std::endl;
std::cout << "\t\theight: " << incomingCodec.height << std::endl;
std::cout << "\t\tstartBitrate: " << incomingCodec.startBitrate
<< std::endl;
std::cout << "\t\tmaxBitrate: " << incomingCodec.maxBitrate
<< std::endl;
std::cout << "\t\tmaxFramerate: " << (int)incomingCodec.maxFramerate
<< std::endl;
std::cout << "************************************************"
<< std::endl;
}