Made external codec test compile and pass.

BUG=961
TEST=Uncomment #define WEBRTC_VIDEO_ENGINE_EXTERNAL_CODEC_API in engine_configurations.h. Should build and extended codec test pass.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2937 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mflodman@webrtc.org 2012-10-17 09:41:25 +00:00
parent 193600b7cf
commit 443df96c8e
3 changed files with 27 additions and 35 deletions

View File

@ -526,8 +526,8 @@ void ViEAutoTest::ViECodecExternalCodecTest() {
number_of_errors += ViETest::TestError(vie_external_codec != NULL,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
webrtc::VideoCodec codec_struct;
error = ViE.codec->GetSendCodec(channel.videoChannel, codecStruct);
webrtc::VideoCodec codec;
error = ViE.codec->GetSendCodec(channel.videoChannel, codec);
number_of_errors += ViETest::TestError(vie_external_codec != NULL,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -538,7 +538,7 @@ void ViEAutoTest::ViECodecExternalCodecTest() {
// Test to register on wrong channel.
error = vie_external_codec->RegisterExternalSendCodec(
channel.videoChannel + 5, codecStruct.plType, &ext_encoder);
channel.videoChannel + 5, codec.plType, &ext_encoder);
number_of_errors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -547,22 +547,22 @@ void ViEAutoTest::ViECodecExternalCodecTest() {
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
error = vie_external_codec->RegisterExternalSendCodec(
channel.videoChannel, codecStruct.plType, &ext_encoder);
channel.videoChannel, codec.plType, &ext_encoder);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Use new external encoder
error = ViE.codec->SetSendCodec(channel.videoChannel, codecStruct);
error = ViE.codec->SetSendCodec(channel.videoChannel, codec);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
TbI420Decoder ext_decoder;
error = vie_external_codec->RegisterExternalReceiveCodec(
channel.videoChannel, codecStruct.plType, &ext_decoder);
channel.videoChannel, codec.plType, &ext_decoder);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.codec->SetReceiveCodec(channel.videoChannel, codec_struct);
error = ViE.codec->SetReceiveCodec(channel.videoChannel, codec);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -571,7 +571,7 @@ void ViEAutoTest::ViECodecExternalCodecTest() {
// Test to deregister on wrong channel
error = vie_external_codec->DeRegisterExternalSendCodec(
channel.videoChannel + 5, codecStruct.plType);
channel.videoChannel + 5, codec.plType);
number_of_errors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -581,19 +581,19 @@ void ViEAutoTest::ViECodecExternalCodecTest() {
// Test to deregister wrong payload type.
error = vie_external_codec->DeRegisterExternalSendCodec(
channel.videoChannel, codecStruct.plType - 1);
channel.videoChannel, codec.plType - 1);
number_of_errors += ViETest::TestError(error == -1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Deregister external send codec
error = vie_external_codec->DeRegisterExternalSendCodec(
channel.videoChannel, codecStruct.plType);
channel.videoChannel, codec.plType);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = vie_external_codec->DeRegisterExternalReceiveCodec(
channel.videoChannel, codecStruct.plType);
channel.videoChannel, codec.plType);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -612,12 +612,12 @@ void ViEAutoTest::ViECodecExternalCodecTest() {
number_of_errors += ViETest::TestError(
encode_calls.RegisterEncodeCompleteCallback == 1,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
number_of_errors += ViETest::TestError(
encode_calls.SetChannelParameters > 1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
number_of_errors += ViETest::TestError(encode_calls.SetRates > 1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
number_of_errors += ViETest::TestError(encode_calls.SetPacketLoss > 1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
TbI420Decoder::FunctionCalls decode_calls =
ext_decoder.GetFunctionCalls();
@ -636,26 +636,26 @@ void ViEAutoTest::ViECodecExternalCodecTest() {
ViETest::Log("Changing payload type Using external I420 codec");
codec_struct.plType = codecStruct.plType - 1;
codec.plType = codec.plType - 1;
error = vie_external_codec->RegisterExternalReceiveCodec(
channel.videoChannel, codec_struct.plType, &ext_decoder);
channel.videoChannel, codec.plType, &ext_decoder);
number_of_errors += ViETest::TestError(error == 0,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = ViE.codec->SetReceiveCodec(channel.videoChannel,
codec_struct);
codec);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = vie_external_codec->RegisterExternalSendCodec(
channel.videoChannel, codec_struct.plType, &ext_encoder);
channel.videoChannel, codec.plType, &ext_encoder);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
// Use new external encoder
error = ViE.codec->SetSendCodec(channel.videoChannel,
codec_struct);
codec);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -666,11 +666,11 @@ void ViEAutoTest::ViECodecExternalCodecTest() {
/// **************************************************************
error = vie_external_codec->DeRegisterExternalSendCodec(
channel.videoChannel, codecStruct.plType);
channel.videoChannel, codec.plType);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
error = vie_external_codec->DeRegisterExternalReceiveCodec(
channel.videoChannel, codecStruct.plType);
channel.videoChannel, codec.plType);
number_of_errors += ViETest::TestError(error == 0, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
@ -688,13 +688,12 @@ void ViEAutoTest::ViECodecExternalCodecTest() {
number_of_errors += ViETest::TestError(
encode_calls.RegisterEncodeCompleteCallback == 2,
"ERROR: %s at line %d", __FUNCTION__, __LINE__);
number_of_errors += ViETest::TestError(
encode_calls.SetChannelParameters > 1, "ERROR: %s at line %d",
__FUNCTION__, __LINE__);
number_of_errors += ViETest::TestError(encode_calls.SetRates > 1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
number_of_errors += ViETest::TestError(encode_calls.SetPacketLoss > 1,
"ERROR: %s at line %d",
__FUNCTION__, __LINE__);
decode_calls = ext_decoder.GetFunctionCalls();
number_of_errors += ViETest::TestError(decode_calls.InitDecode == 2,
"ERROR: %s at line %d",

View File

@ -48,8 +48,6 @@ public:
virtual WebRtc_Word32 SetChannelParameters(WebRtc_UWord32 packetLoss,
int rtt);
virtual WebRtc_Word32 SetPacketLoss(WebRtc_UWord32 packetLoss);
virtual WebRtc_Word32 SetRates(WebRtc_UWord32 newBitRate,
WebRtc_UWord32 frameRate);
@ -65,8 +63,8 @@ public:
WebRtc_Word32 RegisterEncodeCompleteCallback;
WebRtc_Word32 Release;
WebRtc_Word32 Reset;
WebRtc_Word32 SetChannelParameters;
WebRtc_Word32 SetRates;
WebRtc_Word32 SetPacketLoss;
WebRtc_Word32 SetPeriodicKeyFrames;
WebRtc_Word32 CodecConfigParameters;

View File

@ -79,7 +79,8 @@ WebRtc_Word32 TbI420Encoder::Reset()
WebRtc_Word32 TbI420Encoder::SetChannelParameters(WebRtc_UWord32 packetLoss,
int rtt) {
return 0;
_functionCalls.SetChannelParameters++;
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 TbI420Encoder::InitEncode(const webrtc::VideoCodec* inst,
@ -171,12 +172,6 @@ WebRtc_Word32 TbI420Encoder::RegisterEncodeCompleteCallback(
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 TbI420Encoder::SetPacketLoss(WebRtc_UWord32 packetLoss)
{
_functionCalls.SetPacketLoss++;
return WEBRTC_VIDEO_CODEC_OK;
}
WebRtc_Word32 TbI420Encoder::SetRates(WebRtc_UWord32 newBitRate,
WebRtc_UWord32 frameRate)
{