Removing error triggered for disabling FEC on non-opus

A failure was triggered when one sets FEC status on a codec that does not support FEC. While it is definitely logical when one wants to enable it, it makes no good sense if one tries to disable it.

BUG=
R=tina.legrand@webrtc.org, xians@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7298 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
minyue@webrtc.org 2014-09-25 14:36:30 +00:00
parent 5f3965783b
commit 60fbd65482
3 changed files with 20 additions and 3 deletions

View File

@ -196,6 +196,12 @@ bool ACMGenericCodec::HasFrameToEncode() const {
return true;
}
int ACMGenericCodec::SetFEC(bool enable_fec) {
if (!HasInternalFEC() && enable_fec)
return -1;
return 0;
}
int16_t ACMGenericCodec::Encode(uint8_t* bitstream,
int16_t* bitstream_len_byte,
uint32_t* timestamp,

View File

@ -580,10 +580,10 @@ class ACMGenericCodec {
// disabled.
//
// Return value:
// -1 if failed, or the codec does not support FEC
// -1 if failed,
// 0 if succeeded.
//
virtual int SetFEC(bool /* enable_fec */) { return -1; }
virtual int SetFEC(bool enable_fec);
///////////////////////////////////////////////////////////////////////////
// int SetPacketLossRate()

View File

@ -245,7 +245,7 @@ void TestRedFec::Perform() {
EXPECT_EQ(0, _acmA->SetCodecFEC(true));
_outFileB.Close();
// Codecs does not support internal FEC.
// Codecs does not support internal FEC, cannot enable FEC.
RegisterSendCodec('A', nameG722, 16000);
EXPECT_FALSE(_acmA->REDStatus());
EXPECT_EQ(-1, _acmA->SetCodecFEC(true));
@ -255,6 +255,17 @@ void TestRedFec::Perform() {
EXPECT_FALSE(_acmA->REDStatus());
EXPECT_EQ(-1, _acmA->SetCodecFEC(true));
EXPECT_FALSE(_acmA->CodecFEC());
// Codecs does not support internal FEC, disable FEC does not trigger failure.
RegisterSendCodec('A', nameG722, 16000);
EXPECT_FALSE(_acmA->REDStatus());
EXPECT_EQ(0, _acmA->SetCodecFEC(false));
EXPECT_FALSE(_acmA->CodecFEC());
RegisterSendCodec('A', nameISAC, 16000);
EXPECT_FALSE(_acmA->REDStatus());
EXPECT_EQ(0, _acmA->SetCodecFEC(false));
EXPECT_FALSE(_acmA->CodecFEC());
}
int32_t TestRedFec::SetVAD(bool enableDTX, bool enableVAD, ACMVADMode vadMode) {