Added vp8 codec temporal layer changing option to ViE AutoTest custom call.

Review URL: http://webrtc-codereview.appspot.com/330018

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1292 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
amyfong@webrtc.org 2011-12-22 18:24:28 +00:00
parent d32c44738a
commit ee2924cc56

View File

@ -33,6 +33,7 @@
#define DEFAULT_OUTGOING_FILE_NAME "OutgoingFile.avi" #define DEFAULT_OUTGOING_FILE_NAME "OutgoingFile.avi"
#define DEFAULT_VIDEO_CODEC_MAX_FRAMERATE 30 #define DEFAULT_VIDEO_CODEC_MAX_FRAMERATE 30
#define DEFAULT_VIDEO_PROTECTION_METHOD 0 #define DEFAULT_VIDEO_PROTECTION_METHOD 0
#define DEFAULT_TEMPORAL_LAYER 0
enum StatisticsType { enum StatisticsType {
kSendStatistic, kSendStatistic,
@ -110,6 +111,8 @@ void PrintVideoStreamInformation(webrtc::ViECodec* ptrViECodec,
void PrintVideoCodec(webrtc::VideoCodec videoCodec); void PrintVideoCodec(webrtc::VideoCodec videoCodec);
// The following are video functions. // The following are video functions.
// TODO(amyfong): change to pointers as input arguments
// instead of references
bool SetVideoPorts(int* txPort, int* rxPort); bool SetVideoPorts(int* txPort, int* rxPort);
bool SetVideoCodecType(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecType(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec); webrtc::VideoCodec& videoCodec);
@ -123,6 +126,7 @@ bool SetVideoCodecMaxBitrate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec); webrtc::VideoCodec& videoCodec);
bool SetVideoCodecMaxFramerate(webrtc::ViECodec* ptrViECodec, bool SetVideoCodecMaxFramerate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec); webrtc::VideoCodec& videoCodec);
bool SetVideoCodecTemporalLayer(webrtc::VideoCodec& videoCodec);
int GetVideoProtection(); int GetVideoProtection();
bool SetVideoProtection(webrtc::ViECodec* ptrViECodec, bool SetVideoProtection(webrtc::ViECodec* ptrViECodec,
webrtc::ViERTP_RTCP* ptrViERtpRtcp, webrtc::ViERTP_RTCP* ptrViERtpRtcp,
@ -244,7 +248,6 @@ int ViEAutoTest::ViECustomCall()
bool isImageScaleEnabled = false; bool isImageScaleEnabled = false;
int protectionMethod = DEFAULT_VIDEO_PROTECTION_METHOD; int protectionMethod = DEFAULT_VIDEO_PROTECTION_METHOD;
while (!startCall) { while (!startCall) {
// Get the IP address to use from call. // Get the IP address to use from call.
memset(ipAddress, 0, kMaxIPLength); memset(ipAddress, 0, kMaxIPLength);
@ -267,6 +270,7 @@ int ViEAutoTest::ViECustomCall()
SetVideoCodecBitrate(ptrViECodec, videoSendCodec); SetVideoCodecBitrate(ptrViECodec, videoSendCodec);
SetVideoCodecMaxBitrate(ptrViECodec, videoSendCodec); SetVideoCodecMaxBitrate(ptrViECodec, videoSendCodec);
SetVideoCodecMaxFramerate(ptrViECodec, videoSendCodec); SetVideoCodecMaxFramerate(ptrViECodec, videoSendCodec);
SetVideoCodecTemporalLayer(videoSendCodec);
// Get the video protection method for the call. // Get the video protection method for the call.
protectionMethod = GetVideoProtection(); protectionMethod = GetVideoProtection();
@ -574,6 +578,7 @@ int ViEAutoTest::ViECustomCall()
SetVideoCodecBitrate(ptrViECodec, videoSendCodec); SetVideoCodecBitrate(ptrViECodec, videoSendCodec);
SetVideoCodecMaxBitrate(ptrViECodec, videoSendCodec); SetVideoCodecMaxBitrate(ptrViECodec, videoSendCodec);
SetVideoCodecMaxFramerate(ptrViECodec, videoSendCodec); SetVideoCodecMaxFramerate(ptrViECodec, videoSendCodec);
SetVideoCodecTemporalLayer(videoSendCodec);
PrintCallInformation(ipAddress, deviceName, PrintCallInformation(ipAddress, deviceName,
uniqueId, videoSendCodec, uniqueId, videoSendCodec,
videoTxPort, videoRxPort, videoTxPort, videoRxPort,
@ -1669,6 +1674,25 @@ bool SetVideoCodecMaxFramerate(webrtc::ViECodec* ptrViECodec,
} }
return true; return true;
} }
bool SetVideoCodecTemporalLayer(webrtc::VideoCodec& videoCodec) {
if (videoCodec.codecType == webrtc::kVideoCodecVP8) {
std::string str;
std::cout << std::endl;
std::cout << "Choose number of temporal layers (1 to 4). "
<< "Press enter for default ("
<< DEFAULT_TEMPORAL_LAYER << "): ";
std::getline(std::cin, str);
char numTemporalLayers = atoi(str.c_str());
videoCodec.codecSpecific.VP8.numberOfTemporalLayers
= DEFAULT_TEMPORAL_LAYER;
if(numTemporalLayers != 0) {
videoCodec.codecSpecific.VP8.numberOfTemporalLayers
= numTemporalLayers;
}
}
return true;
}
// GetVideoProtection only prints the prompt to get a number // GetVideoProtection only prints the prompt to get a number
// that SetVideoProtection method uses // that SetVideoProtection method uses
// 0 = None // 0 = None
@ -1987,4 +2011,9 @@ void PrintVideoCodec(webrtc::VideoCodec videoCodec) {
<< std::endl; << std::endl;
std::cout << "\t\tmaxFramerate: " << (int)videoCodec.maxFramerate std::cout << "\t\tmaxFramerate: " << (int)videoCodec.maxFramerate
<< std::endl; << std::endl;
if (videoCodec.codecType == webrtc::kVideoCodecVP8) {
std::cout << "\t\tVP8 Temporal Layer: "
<< (int)videoCodec.codecSpecific.VP8.numberOfTemporalLayers
<< std::endl;
}
} }