Expose NetEq playout mode off through VoiceEngine.
BUG= Review URL: https://webrtc-codereview.appspot.com/971016 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3272 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -430,6 +430,9 @@ enum NetEqModes // NetEQ playout configurations
|
||||
// Optimzed for decodability of fax signals rather than for perceived audio
|
||||
// quality.
|
||||
kNetEqFax = 2,
|
||||
// Minimal buffer management. Inserts zeros for lost packets and during
|
||||
// buffer increases.
|
||||
kNetEqOff = 3,
|
||||
};
|
||||
|
||||
enum NetEqBgnModes // NetEQ Background Noise (BGN) configurations
|
||||
|
@@ -34,11 +34,14 @@ namespace webrtc {
|
||||
// conference participant, a webinar, or a streaming application,
|
||||
// this mode can be used to improve the jitter robustness at
|
||||
// the cost of increased delay.
|
||||
// -off : Turns off most of NetEQ's features. Stuffs zeros for lost
|
||||
// packets and during buffer increases.
|
||||
//
|
||||
enum AudioPlayoutMode {
|
||||
voice = 0,
|
||||
fax = 1,
|
||||
streaming = 2
|
||||
streaming = 2,
|
||||
off = 3,
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -324,6 +324,9 @@ WebRtc_Word32 ACMNetEQ::SetPlayoutMode(const AudioPlayoutMode mode) {
|
||||
case streaming:
|
||||
playoutMode = kPlayoutStreaming;
|
||||
break;
|
||||
case off:
|
||||
playoutMode = kPlayoutOff;
|
||||
break;
|
||||
}
|
||||
if (WebRtcNetEQ_SetPlayoutMode(_inst[idx], playoutMode) < 0) {
|
||||
LogError("SetPlayoutMode", idx);
|
||||
@@ -984,6 +987,9 @@ WebRtc_Word16 ACMNetEQ::AddSlave(const WebRtcNetEQDecoder* usedCodecs,
|
||||
case streaming:
|
||||
playoutMode = kPlayoutStreaming;
|
||||
break;
|
||||
case off:
|
||||
playoutMode = kPlayoutOff;
|
||||
break;
|
||||
}
|
||||
if (WebRtcNetEQ_SetPlayoutMode(_inst[slaveIdx], playoutMode) < 0) {
|
||||
LogError("SetPlayoutMode", 1);
|
||||
|
@@ -2226,7 +2226,8 @@ WebRtc_Word32 AudioCodingModuleImpl::DecoderEstimatedBandwidth() const {
|
||||
// Set playout mode for: voice, fax, or streaming.
|
||||
WebRtc_Word32 AudioCodingModuleImpl::SetPlayoutMode(
|
||||
const AudioPlayoutMode mode) {
|
||||
if ((mode != voice) && (mode != fax) && (mode != streaming)) {
|
||||
if ((mode != voice) && (mode != fax) && (mode != streaming) &&
|
||||
(mode != off)) {
|
||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
|
||||
"Invalid playout mode.");
|
||||
return -1;
|
||||
|
@@ -2096,6 +2096,9 @@ Channel::SetNetEQPlayoutMode(NetEqModes mode)
|
||||
case kNetEqFax:
|
||||
playoutMode = fax;
|
||||
break;
|
||||
case kNetEqOff:
|
||||
playoutMode = off;
|
||||
break;
|
||||
}
|
||||
if (_audioCodingModule.SetPlayoutMode(playoutMode) != 0)
|
||||
{
|
||||
@@ -2122,6 +2125,8 @@ Channel::GetNetEQPlayoutMode(NetEqModes& mode)
|
||||
case fax:
|
||||
mode = kNetEqFax;
|
||||
break;
|
||||
case off:
|
||||
mode = kNetEqOff;
|
||||
}
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice,
|
||||
VoEId(_instanceId,_channelId),
|
||||
|
@@ -13,14 +13,16 @@
|
||||
class NetEQTest : public AfterStreamingFixture {
|
||||
protected:
|
||||
void SetUp() {
|
||||
additional_channel_ = voe_base_->CreateChannel();
|
||||
additional_channel_[0] = voe_base_->CreateChannel();
|
||||
additional_channel_[1] = voe_base_->CreateChannel();
|
||||
}
|
||||
|
||||
void TearDown() {
|
||||
voe_base_->DeleteChannel(additional_channel_);
|
||||
voe_base_->DeleteChannel(additional_channel_[0]);
|
||||
voe_base_->DeleteChannel(additional_channel_[1]);
|
||||
}
|
||||
|
||||
int additional_channel_;
|
||||
int additional_channel_[2];
|
||||
};
|
||||
|
||||
TEST_F(NetEQTest, GetNetEQPlayoutModeReturnsDefaultModeByDefault) {
|
||||
@@ -31,22 +33,37 @@ TEST_F(NetEQTest, GetNetEQPlayoutModeReturnsDefaultModeByDefault) {
|
||||
|
||||
TEST_F(NetEQTest, SetNetEQPlayoutModeActuallySetsTheModeForTheChannel) {
|
||||
webrtc::NetEqModes mode;
|
||||
// Set for the first channel but leave the second.
|
||||
// Set for the first channel but leave the others.
|
||||
EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(channel_, webrtc::kNetEqFax));
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(channel_, mode));
|
||||
EXPECT_EQ(webrtc::kNetEqFax, mode);
|
||||
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(additional_channel_, mode));
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(additional_channel_[0], mode));
|
||||
EXPECT_EQ(webrtc::kNetEqDefault, mode);
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(additional_channel_[1], mode));
|
||||
EXPECT_EQ(webrtc::kNetEqDefault, mode);
|
||||
|
||||
// Set the second channel, leave the first.
|
||||
// Set the second channel, leave the others.
|
||||
EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(
|
||||
additional_channel_, webrtc::kNetEqStreaming));
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(additional_channel_, mode));
|
||||
additional_channel_[0], webrtc::kNetEqStreaming));
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(additional_channel_[0], mode));
|
||||
EXPECT_EQ(webrtc::kNetEqStreaming, mode);
|
||||
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(channel_, mode));
|
||||
EXPECT_EQ(webrtc::kNetEqFax, mode);
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(additional_channel_[1], mode));
|
||||
EXPECT_EQ(webrtc::kNetEqDefault, mode);
|
||||
|
||||
// Set the third channel, leave the others.
|
||||
EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(
|
||||
additional_channel_[1], webrtc::kNetEqOff));
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(additional_channel_[1], mode));
|
||||
EXPECT_EQ(webrtc::kNetEqOff, mode);
|
||||
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(channel_, mode));
|
||||
EXPECT_EQ(webrtc::kNetEqFax, mode);
|
||||
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(additional_channel_[0], mode));
|
||||
EXPECT_EQ(webrtc::kNetEqStreaming, mode);
|
||||
}
|
||||
|
||||
TEST_F(NetEQTest, GetNetEQBgnModeReturnsBgnOnByDefault) {
|
||||
@@ -79,4 +96,8 @@ TEST_F(NetEQTest, ManualSetEQPlayoutModeStillProducesOkAudio) {
|
||||
EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(channel_, webrtc::kNetEqFax));
|
||||
TEST_LOG("NetEQ fax playout mode enabled => should hear OK audio.\n");
|
||||
Sleep(2000);
|
||||
|
||||
EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(channel_, webrtc::kNetEqOff));
|
||||
TEST_LOG("NetEQ off playout mode enabled => should hear OK audio.\n");
|
||||
Sleep(2000);
|
||||
}
|
||||
|
Reference in New Issue
Block a user