Removes parts of the VoEBase sub API as part of a clean-up operation where the goal is to remove unused APIs.

BUG=3206
R=henrik.lundin@webrtc.org, juberti@webrtc.org, niklas.enbom@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5928 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrika@webrtc.org 2014-04-17 10:45:01 +00:00
parent 0f7375504a
commit 66803489f9
11 changed files with 17 additions and 330 deletions

View File

@ -466,6 +466,7 @@ enum AudioLayers
kAudioLinuxPulse = 4
};
// TODO(henrika): to be removed.
enum NetEqModes // NetEQ playout configurations
{
// Optimized trade-off between low delay and jitter robustness for two-way
@ -482,6 +483,7 @@ enum NetEqModes // NetEQ playout configurations
kNetEqOff = 3,
};
// TODO(henrika): to be removed.
enum OnHoldModes // On Hold direction
{
kHoldSendAndPlay = 0, // Put both sending and playing in on-hold state.
@ -489,6 +491,7 @@ enum OnHoldModes // On Hold direction
kHoldPlayOnly // Put only playing in on-hold state.
};
// TODO(henrika): to be removed.
enum AmrMode
{
kRfc3267BwEfficient = 0,

View File

@ -663,12 +663,6 @@ int32_t Channel::GetAudioFrame(int32_t id, AudioFrame& audioFrame)
MixAudioWithFile(audioFrame, audioFrame.sample_rate_hz_);
}
// Place channel in on-hold state (~muted) if on-hold is activated
if (state.output_is_on_hold)
{
AudioFrameOperations::Mute(audioFrame);
}
// External media
if (_outputExternalMedia)
{
@ -886,7 +880,6 @@ Channel::Channel(int32_t channelId,
_rtcpObserverPtr(NULL),
_externalPlayout(false),
_externalMixing(false),
_inputIsOnHold(false),
_mixFileWithMicrophone(false),
_rtpObserver(false),
_rtcpObserver(false),
@ -1423,52 +1416,6 @@ Channel::GetNetEQPlayoutMode(NetEqModes& mode)
return 0;
}
int32_t
Channel::SetOnHoldStatus(bool enable, OnHoldModes mode)
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::SetOnHoldStatus()");
if (mode == kHoldSendAndPlay)
{
channel_state_.SetOutputIsOnHold(enable);
_inputIsOnHold = enable;
}
else if (mode == kHoldPlayOnly)
{
channel_state_.SetOutputIsOnHold(enable);
}
if (mode == kHoldSendOnly)
{
_inputIsOnHold = enable;
}
return 0;
}
int32_t
Channel::GetOnHoldStatus(bool& enabled, OnHoldModes& mode)
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::GetOnHoldStatus()");
bool output_is_on_hold = channel_state_.Get().output_is_on_hold;
enabled = (output_is_on_hold || _inputIsOnHold);
if (output_is_on_hold && _inputIsOnHold)
{
mode = kHoldSendAndPlay;
}
else if (output_is_on_hold && !_inputIsOnHold)
{
mode = kHoldPlayOnly;
}
else if (!output_is_on_hold && _inputIsOnHold)
{
mode = kHoldSendOnly;
}
WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::GetOnHoldStatus() => enabled=%d, mode=%d",
enabled, mode);
return 0;
}
int32_t
Channel::RegisterVoiceEngineObserver(VoiceEngineObserver& observer)
{

View File

@ -74,7 +74,6 @@ class ChannelState {
struct State {
State() : rx_apm_is_enabled(false),
input_external_media(false),
output_is_on_hold(false),
output_file_playing(false),
input_file_playing(false),
playing(false),
@ -83,7 +82,6 @@ class ChannelState {
bool rx_apm_is_enabled;
bool input_external_media;
bool output_is_on_hold;
bool output_file_playing;
bool input_file_playing;
bool playing;
@ -115,11 +113,6 @@ class ChannelState {
state_.input_external_media = enable;
}
void SetOutputIsOnHold(bool enable) {
CriticalSectionScoped lock(lock_.get());
state_.output_is_on_hold = enable;
}
void SetOutputFilePlaying(bool enable) {
CriticalSectionScoped lock(lock_.get());
state_.output_file_playing = enable;
@ -193,8 +186,6 @@ public:
int32_t SetNetEQPlayoutMode(NetEqModes mode);
int32_t GetNetEQPlayoutMode(NetEqModes& mode);
int32_t SetOnHoldStatus(bool enable, OnHoldModes mode);
int32_t GetOnHoldStatus(bool& enabled, OnHoldModes& mode);
int32_t RegisterVoiceEngineObserver(VoiceEngineObserver& observer);
int32_t DeRegisterVoiceEngineObserver();
@ -466,10 +457,6 @@ public:
{
return _externalMixing;
}
bool InputIsOnHold() const
{
return _inputIsOnHold;
}
RtpRtcp* RtpRtcpModulePtr() const
{
return _rtpRtcpModule.get();
@ -578,7 +565,6 @@ private:
// VoEBase
bool _externalPlayout;
bool _externalMixing;
bool _inputIsOnHold;
bool _mixFileWithMicrophone;
bool _rtpObserver;
bool _rtcpObserver;

View File

@ -172,24 +172,19 @@ public:
// Gets the last VoiceEngine error code.
virtual int LastError() = 0;
// Stops or resumes playout and transmission on a temporary basis.
virtual int SetOnHoldStatus(int channel, bool enable,
OnHoldModes mode = kHoldSendAndPlay) = 0;
// Gets the current playout and transmission status.
virtual int GetOnHoldStatus(int channel, bool& enabled,
OnHoldModes& mode) = 0;
// Sets the NetEQ playout mode for a specified |channel| number.
virtual int SetNetEQPlayoutMode(int channel, NetEqModes mode) = 0;
// Gets the NetEQ playout mode for a specified |channel| number.
virtual int GetNetEQPlayoutMode(int channel, NetEqModes& mode) = 0;
// TODO(xians): Make the interface pure virtual after libjingle
// implements the interface in its FakeWebRtcVoiceEngine.
virtual AudioTransport* audio_transport() { return NULL; }
// To be removed. Don't use.
virtual int SetOnHoldStatus(int channel, bool enable,
OnHoldModes mode = kHoldSendAndPlay) { return -1; }
virtual int GetOnHoldStatus(int channel, bool& enabled,
OnHoldModes& mode) { return -1; }
virtual int SetNetEQPlayoutMode(int channel, NetEqModes mode) { return -1; }
virtual int GetNetEQPlayoutMode(int channel,
NetEqModes& mode) { return -1; }
protected:
VoEBase() {}
virtual ~VoEBase() {}

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
// Note: This class includes sleeps and requires manual verification.
class ManualHoldTest : public AfterStreamingFixture {
};
TEST_F(ManualHoldTest, SetOnHoldStatusBlockAudio) {
TEST_LOG("Channel not on hold => should hear audio.\n");
Sleep(2000);
TEST_LOG("Put channel on hold => should *not* hear audio.\n");
EXPECT_EQ(0, voe_base_->SetOnHoldStatus(channel_, true));
Sleep(2000);
TEST_LOG("Remove on hold => should hear audio again.\n");
EXPECT_EQ(0, voe_base_->SetOnHoldStatus(channel_, false));
Sleep(2000);
TEST_LOG("Put sending on hold => should *not* hear audio.\n");
EXPECT_EQ(0, voe_base_->SetOnHoldStatus(channel_, true, webrtc::kHoldSendOnly));
Sleep(2000);
}
TEST_F(ManualHoldTest, SetOnHoldStatusBlocksLocalFileAudio) {
TEST_LOG("Start playing a file locally => "
"you should now hear this file being played out.\n");
voe_file_->StopPlayingFileAsMicrophone(channel_);
EXPECT_EQ(0, voe_file_->StartPlayingFileLocally(
channel_, resource_manager_.long_audio_file_path().c_str(), true));
Sleep(2000);
TEST_LOG("Put playing on hold => should *not* hear audio.\n");
EXPECT_EQ(0, voe_base_->SetOnHoldStatus(
channel_, true, webrtc::kHoldPlayOnly));
Sleep(2000);
}

View File

@ -1,86 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/voice_engine/test/auto_test/fixtures/after_streaming_fixture.h"
class NetEQTest : public AfterStreamingFixture {
protected:
void SetUp() {
additional_channel_[0] = voe_base_->CreateChannel();
additional_channel_[1] = voe_base_->CreateChannel();
}
void TearDown() {
voe_base_->DeleteChannel(additional_channel_[0]);
voe_base_->DeleteChannel(additional_channel_[1]);
}
int additional_channel_[2];
};
TEST_F(NetEQTest, GetNetEQPlayoutModeReturnsDefaultModeByDefault) {
webrtc::NetEqModes mode;
EXPECT_EQ(0, voe_base_->GetNetEQPlayoutMode(channel_, mode));
EXPECT_EQ(webrtc::kNetEqDefault, mode);
}
TEST_F(NetEQTest, SetNetEQPlayoutModeActuallySetsTheModeForTheChannel) {
webrtc::NetEqModes mode;
// 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_[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 others.
EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(
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, ManualSetEQPlayoutModeStillProducesOkAudio) {
EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(channel_, webrtc::kNetEqDefault));
TEST_LOG("NetEQ default playout mode enabled => should hear OK audio.\n");
Sleep(2000);
EXPECT_EQ(0, voe_base_->SetNetEQPlayoutMode(
channel_, webrtc::kNetEqStreaming));
TEST_LOG("NetEQ streaming playout mode enabled => should hear OK audio.\n");
Sleep(2000);
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);
}

View File

@ -242,7 +242,6 @@ void RunTest(std::string out_path) {
bool enable_rx_ns = false;
bool typing_detection = false;
bool muted = false;
bool on_hold = false;
bool opus_stereo = false;
bool experimental_ns_enabled = false;
@ -632,19 +631,6 @@ void RunTest(std::string out_path) {
printf("\n Microphone is now on mute! \n");
else
printf("\n Microphone is no longer on mute! \n");
} else if (option_selection == option_index++) {
// Toggle the call on hold
OnHoldModes mode;
res = base1->GetOnHoldStatus(chan, on_hold, mode);
VALIDATE;
on_hold = !on_hold;
mode = kHoldSendAndPlay;
res = base1->SetOnHoldStatus(chan, on_hold, mode);
VALIDATE;
if (on_hold)
printf("\n Call now on hold! \n");
else
printf("\n Call now not on hold! \n");
} else if (option_selection == option_index++) {
// Get the last error code and print to screen
int err_code = 0;

View File

@ -421,10 +421,7 @@ TransmitMixer::DemuxAndMix()
it.Increment())
{
Channel* channelPtr = it.GetChannel();
if (channelPtr->InputIsOnHold())
{
channelPtr->UpdateLocalTimeStamp();
} else if (channelPtr->Sending())
if (channelPtr->Sending())
{
// Demultiplex makes a copy of its input.
channelPtr->Demultiplex(_audioFrame);
@ -440,9 +437,7 @@ void TransmitMixer::DemuxAndMix(const int voe_channels[],
voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]);
voe::Channel* channel_ptr = ch.channel();
if (channel_ptr) {
if (channel_ptr->InputIsOnHold()) {
channel_ptr->UpdateLocalTimeStamp();
} else if (channel_ptr->Sending()) {
if (channel_ptr->Sending()) {
// Demultiplex makes a copy of its input.
channel_ptr->Demultiplex(_audioFrame);
channel_ptr->PrepareEncodeAndSend(_audioFrame.sample_rate_hz_);
@ -461,7 +456,7 @@ TransmitMixer::EncodeAndSend()
it.Increment())
{
Channel* channelPtr = it.GetChannel();
if (channelPtr->Sending() && !channelPtr->InputIsOnHold())
if (channelPtr->Sending())
{
channelPtr->EncodeAndSend();
}
@ -474,7 +469,7 @@ void TransmitMixer::EncodeAndSend(const int voe_channels[],
for (int i = 0; i < number_of_voe_channels; ++i) {
voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]);
voe::Channel* channel_ptr = ch.channel();
if (channel_ptr && channel_ptr->Sending() && !channel_ptr->InputIsOnHold())
if (channel_ptr && channel_ptr->Sending())
channel_ptr->EncodeAndSend();
}
}

View File

@ -223,9 +223,7 @@ void VoEBaseImpl::PushCaptureData(int voe_channel, const void* audio_data,
if (!channel_ptr)
return;
if (channel_ptr->InputIsOnHold()) {
channel_ptr->UpdateLocalTimeStamp();
} else if (channel_ptr->Sending()) {
if (channel_ptr->Sending()) {
channel_ptr->Demultiplex(static_cast<const int16_t*>(audio_data),
sample_rate, number_of_frames, number_of_channels);
channel_ptr->PrepareEncodeAndSend(sample_rate);
@ -871,88 +869,6 @@ int VoEBaseImpl::LastError()
return (_shared->statistics().LastError());
}
int VoEBaseImpl::SetNetEQPlayoutMode(int channel, NetEqModes mode)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"SetNetEQPlayoutMode(channel=%i, mode=%i)", channel, mode);
if (!_shared->statistics().Initialized())
{
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"SetNetEQPlayoutMode() failed to locate channel");
return -1;
}
return channelPtr->SetNetEQPlayoutMode(mode);
}
int VoEBaseImpl::GetNetEQPlayoutMode(int channel, NetEqModes& mode)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"GetNetEQPlayoutMode(channel=%i, mode=?)", channel);
if (!_shared->statistics().Initialized())
{
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetNetEQPlayoutMode() failed to locate channel");
return -1;
}
return channelPtr->GetNetEQPlayoutMode(mode);
}
int VoEBaseImpl::SetOnHoldStatus(int channel, bool enable, OnHoldModes mode)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"SetOnHoldStatus(channel=%d, enable=%d, mode=%d)", channel,
enable, mode);
if (!_shared->statistics().Initialized())
{
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"SetOnHoldStatus() failed to locate channel");
return -1;
}
return channelPtr->SetOnHoldStatus(enable, mode);
}
int VoEBaseImpl::GetOnHoldStatus(int channel, bool& enabled, OnHoldModes& mode)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
"GetOnHoldStatus(channel=%d, enabled=?, mode=?)", channel);
if (!_shared->statistics().Initialized())
{
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel);
voe::Channel* channelPtr = ch.channel();
if (channelPtr == NULL)
{
_shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError,
"GetOnHoldStatus() failed to locate channel");
return -1;
}
return channelPtr->GetOnHoldStatus(enabled, mode);
}
int32_t VoEBaseImpl::StartPlayout()
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),

View File

@ -55,16 +55,6 @@ public:
virtual int StopSend(int channel);
virtual int SetNetEQPlayoutMode(int channel, NetEqModes mode);
virtual int GetNetEQPlayoutMode(int channel, NetEqModes& mode);
virtual int SetOnHoldStatus(int channel,
bool enable,
OnHoldModes mode = kHoldSendAndPlay);
virtual int GetOnHoldStatus(int channel, bool& enabled, OnHoldModes& mode);
virtual int GetVersion(char version[1024]);
virtual int LastError();

View File

@ -171,10 +171,8 @@
'test/auto_test/standard/hardware_before_initializing_test.cc',
'test/auto_test/standard/hardware_before_streaming_test.cc',
'test/auto_test/standard/hardware_test.cc',
'test/auto_test/standard/manual_hold_test.cc',
'test/auto_test/standard/mixing_test.cc',
'test/auto_test/standard/neteq_stats_test.cc',
'test/auto_test/standard/neteq_test.cc',
'test/auto_test/standard/network_test.cc',
'test/auto_test/standard/rtp_rtcp_before_streaming_test.cc',
'test/auto_test/standard/rtp_rtcp_extensions.cc',