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_VIDEO_CODEC_MAX_FRAMERATE 30
#define DEFAULT_VIDEO_PROTECTION_METHOD 0
#define DEFAULT_TEMPORAL_LAYER 0
enum StatisticsType {
kSendStatistic,
@ -110,6 +111,8 @@ void PrintVideoStreamInformation(webrtc::ViECodec* ptrViECodec,
void PrintVideoCodec(webrtc::VideoCodec videoCodec);
// The following are video functions.
// TODO(amyfong): change to pointers as input arguments
// instead of references
bool SetVideoPorts(int* txPort, int* rxPort);
bool SetVideoCodecType(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec);
@ -123,6 +126,7 @@ bool SetVideoCodecMaxBitrate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec);
bool SetVideoCodecMaxFramerate(webrtc::ViECodec* ptrViECodec,
webrtc::VideoCodec& videoCodec);
bool SetVideoCodecTemporalLayer(webrtc::VideoCodec& videoCodec);
int GetVideoProtection();
bool SetVideoProtection(webrtc::ViECodec* ptrViECodec,
webrtc::ViERTP_RTCP* ptrViERtpRtcp,
@ -244,7 +248,6 @@ int ViEAutoTest::ViECustomCall()
bool isImageScaleEnabled = false;
int protectionMethod = DEFAULT_VIDEO_PROTECTION_METHOD;
while (!startCall) {
// Get the IP address to use from call.
memset(ipAddress, 0, kMaxIPLength);
@ -267,6 +270,7 @@ int ViEAutoTest::ViECustomCall()
SetVideoCodecBitrate(ptrViECodec, videoSendCodec);
SetVideoCodecMaxBitrate(ptrViECodec, videoSendCodec);
SetVideoCodecMaxFramerate(ptrViECodec, videoSendCodec);
SetVideoCodecTemporalLayer(videoSendCodec);
// Get the video protection method for the call.
protectionMethod = GetVideoProtection();
@ -574,6 +578,7 @@ int ViEAutoTest::ViECustomCall()
SetVideoCodecBitrate(ptrViECodec, videoSendCodec);
SetVideoCodecMaxBitrate(ptrViECodec, videoSendCodec);
SetVideoCodecMaxFramerate(ptrViECodec, videoSendCodec);
SetVideoCodecTemporalLayer(videoSendCodec);
PrintCallInformation(ipAddress, deviceName,
uniqueId, videoSendCodec,
videoTxPort, videoRxPort,
@ -1669,6 +1674,25 @@ bool SetVideoCodecMaxFramerate(webrtc::ViECodec* ptrViECodec,
}
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
// that SetVideoProtection method uses
// 0 = None
@ -1987,4 +2011,9 @@ void PrintVideoCodec(webrtc::VideoCodec videoCodec) {
<< std::endl;
std::cout << "\t\tmaxFramerate: " << (int)videoCodec.maxFramerate
<< std::endl;
if (videoCodec.codecType == webrtc::kVideoCodecVP8) {
std::cout << "\t\tVP8 Temporal Layer: "
<< (int)videoCodec.codecSpecific.VP8.numberOfTemporalLayers
<< std::endl;
}
}