Removed unused GetOutputVolume() and SetOutputVolume() from MediaEngineInterface.

BUG=webrtc:4690

Review-Url: https://codereview.webrtc.org/2059403002
Cr-Commit-Position: refs/heads/master@{#13135}
This commit is contained in:
solenberg 2016-06-14 08:59:48 -07:00 committed by Commit bot
parent 8b06ec0b71
commit 05b9803c8e
7 changed files with 1 additions and 127 deletions

View File

@ -739,8 +739,7 @@ class FakeVoiceEngine : public FakeBaseEngine {
FakeVoiceEngine(
webrtc::AudioDeviceModule* adm,
const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
audio_decoder_factory)
: output_volume_(-1) {
audio_decoder_factory) {
// Add a fake audio codec. Note that the name must not be "" as there are
// sanity checks against that.
codecs_.push_back(AudioCodec(101, "fake_audio_codec", 0, 0, 1));
@ -773,15 +772,6 @@ class FakeVoiceEngine : public FakeBaseEngine {
const std::vector<AudioCodec>& recv_codecs() { return codecs_; }
void SetCodecs(const std::vector<AudioCodec>& codecs) { codecs_ = codecs; }
bool GetOutputVolume(int* level) {
*level = output_volume_;
return true;
}
bool SetOutputVolume(int level) {
output_volume_ = level;
return true;
}
int GetInputLevel() { return 0; }
bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes) {
@ -799,7 +789,6 @@ class FakeVoiceEngine : public FakeBaseEngine {
private:
std::vector<FakeVoiceMediaChannel*> channels_;
std::vector<AudioCodec> codecs_;
int output_volume_;
friend class FakeMediaEngine;
};
@ -893,7 +882,6 @@ class FakeMediaEngine :
return video_.GetChannel(index);
}
int output_volume() const { return voice_.output_volume_; }
bool capture() const { return video_.capture_; }
bool options_changed() const {
return video_.options_changed_;

View File

@ -72,12 +72,6 @@ class MediaEngineInterface {
const MediaConfig& config,
const VideoOptions& options) = 0;
// Device configuration
// Gets the current speaker volume, as a value between 0 and 255.
virtual bool GetOutputVolume(int* level) = 0;
// Sets the current speaker volume, as a value between 0 and 255.
virtual bool SetOutputVolume(int level) = 0;
// Gets the current microphone level, as a value between 0 and 10.
virtual int GetInputLevel() = 0;
@ -154,13 +148,6 @@ class CompositeMediaEngine : public MediaEngineInterface {
return video_.CreateChannel(call, config, options);
}
virtual bool GetOutputVolume(int* level) {
return voice_.GetOutputVolume(level);
}
virtual bool SetOutputVolume(int level) {
return voice_.SetOutputVolume(level);
}
virtual int GetInputLevel() {
return voice_.GetInputLevel();
}

View File

@ -866,27 +866,6 @@ void WebRtcVoiceEngine::SetDefaultDevices() {
#endif // !WEBRTC_IOS
}
bool WebRtcVoiceEngine::GetOutputVolume(int* level) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
unsigned int ulevel;
if (voe_wrapper_->volume()->GetSpeakerVolume(ulevel) == -1) {
LOG_RTCERR1(GetSpeakerVolume, level);
return false;
}
*level = ulevel;
return true;
}
bool WebRtcVoiceEngine::SetOutputVolume(int level) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
RTC_DCHECK(level >= 0 && level <= 255);
if (voe_wrapper_->volume()->SetSpeakerVolume(level) == -1) {
LOG_RTCERR1(SetSpeakerVolume, level);
return false;
}
return true;
}
int WebRtcVoiceEngine::GetInputLevel() {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
unsigned int ulevel;

View File

@ -61,8 +61,6 @@ class WebRtcVoiceEngine final : public webrtc::TraceCallback {
const MediaConfig& config,
const AudioOptions& options);
bool GetOutputVolume(int* level);
bool SetOutputVolume(int level);
int GetInputLevel();
const std::vector<AudioCodec>& send_codecs() const;

View File

@ -32,8 +32,6 @@ namespace cricket {
using rtc::Bind;
static const int kNotSetOutputVolume = -1;
static DataEngineInterface* ConstructDataEngine() {
#ifdef HAVE_SCTP
return new HybridDataEngine(new RtpDataEngine(), new SctpDataEngine());
@ -64,7 +62,6 @@ void ChannelManager::Construct(MediaEngineInterface* me,
main_thread_ = rtc::Thread::Current();
worker_thread_ = worker_thread;
network_thread_ = network_thread;
audio_output_volume_ = kNotSetOutputVolume;
capturing_ = false;
enable_rtx_ = false;
}
@ -156,18 +153,6 @@ bool ChannelManager::Init() {
initialized_ = worker_thread_->Invoke<bool>(
RTC_FROM_HERE, Bind(&ChannelManager::InitMediaEngine_w, this));
ASSERT(initialized_);
if (!initialized_) {
return false;
}
// If audio_output_volume_ has been set via SetOutputVolume(), set the
// audio output volume of the engine.
if (kNotSetOutputVolume != audio_output_volume_ &&
!SetOutputVolume(audio_output_volume_)) {
LOG(LS_WARNING) << "Failed to SetOutputVolume to "
<< audio_output_volume_;
}
return initialized_;
}
@ -391,31 +376,6 @@ void ChannelManager::DestroyDataChannel_w(DataChannel* data_channel) {
delete data_channel;
}
bool ChannelManager::GetOutputVolume(int* level) {
if (!initialized_) {
return false;
}
return worker_thread_->Invoke<bool>(
RTC_FROM_HERE,
Bind(&MediaEngineInterface::GetOutputVolume, media_engine_.get(), level));
}
bool ChannelManager::SetOutputVolume(int level) {
bool ret = level >= 0 && level <= 255;
if (initialized_) {
ret &= worker_thread_->Invoke<bool>(
RTC_FROM_HERE, Bind(&MediaEngineInterface::SetOutputVolume,
media_engine_.get(), level));
}
if (ret) {
audio_output_volume_ = level;
}
return ret;
}
bool ChannelManager::StartAecDump(rtc::PlatformFile file,
int64_t max_size_bytes) {
return worker_thread_->Invoke<bool>(

View File

@ -121,8 +121,6 @@ class ChannelManager {
return (!voice_channels_.empty() || !video_channels_.empty());
}
bool GetOutputVolume(int* level);
bool SetOutputVolume(int level);
// RTX will be enabled/disabled in engines that support it. The supporting
// engines will start offering an RTX codec. Must be called before Init().
bool SetVideoRtxEnabled(bool enable);
@ -192,7 +190,6 @@ class ChannelManager {
VideoChannels video_channels_;
DataChannels data_channels_;
int audio_output_volume_;
bool enable_rtx_;
bool capturing_;

View File

@ -169,41 +169,6 @@ TEST_F(ChannelManagerTest, NoTransportChannelTest) {
cm_->Terminate();
}
TEST_F(ChannelManagerTest, GetSetOutputVolumeBeforeInit) {
int level;
// Before init, SetOutputVolume() remembers the volume but does not change the
// volume of the engine. GetOutputVolume() should fail.
EXPECT_EQ(-1, fme_->output_volume());
EXPECT_FALSE(cm_->GetOutputVolume(&level));
EXPECT_FALSE(cm_->SetOutputVolume(-1)); // Invalid volume.
EXPECT_TRUE(cm_->SetOutputVolume(99));
EXPECT_EQ(-1, fme_->output_volume());
// Init() will apply the remembered volume.
EXPECT_TRUE(cm_->Init());
EXPECT_TRUE(cm_->GetOutputVolume(&level));
EXPECT_EQ(99, level);
EXPECT_EQ(level, fme_->output_volume());
EXPECT_TRUE(cm_->SetOutputVolume(60));
EXPECT_TRUE(cm_->GetOutputVolume(&level));
EXPECT_EQ(60, level);
EXPECT_EQ(level, fme_->output_volume());
}
TEST_F(ChannelManagerTest, GetSetOutputVolume) {
int level;
EXPECT_TRUE(cm_->Init());
EXPECT_TRUE(cm_->GetOutputVolume(&level));
EXPECT_EQ(level, fme_->output_volume());
EXPECT_FALSE(cm_->SetOutputVolume(-1)); // Invalid volume.
EXPECT_TRUE(cm_->SetOutputVolume(60));
EXPECT_EQ(60, fme_->output_volume());
EXPECT_TRUE(cm_->GetOutputVolume(&level));
EXPECT_EQ(60, level);
}
TEST_F(ChannelManagerTest, SetVideoRtxEnabled) {
std::vector<VideoCodec> codecs;
const VideoCodec rtx_codec(96, "rtx", 0, 0, 0);