Removed unused GetOutputVolume() and SetOutputVolume() from MediaEngineInterface.
BUG=webrtc:4690
Review-Url: https://codereview.webrtc.org/2059403002
Cr-Original-Commit-Position: refs/heads/master@{#13135}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 05b9803c8ef344ac3dc8fb59504b87a227a0d39d
diff --git a/media/base/fakemediaengine.h b/media/base/fakemediaengine.h
index b2ec124..3edda5e 100644
--- a/media/base/fakemediaengine.h
+++ b/media/base/fakemediaengine.h
@@ -739,8 +739,7 @@
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 @@
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 @@
private:
std::vector<FakeVoiceMediaChannel*> channels_;
std::vector<AudioCodec> codecs_;
- int output_volume_;
friend class FakeMediaEngine;
};
@@ -893,7 +882,6 @@
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_;
diff --git a/media/base/mediaengine.h b/media/base/mediaengine.h
index 9204fc1..0e2b7ef 100644
--- a/media/base/mediaengine.h
+++ b/media/base/mediaengine.h
@@ -72,12 +72,6 @@
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 @@
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();
}
diff --git a/media/engine/webrtcvoiceengine.cc b/media/engine/webrtcvoiceengine.cc
index 4d94d2d..9fbfd49 100644
--- a/media/engine/webrtcvoiceengine.cc
+++ b/media/engine/webrtcvoiceengine.cc
@@ -866,27 +866,6 @@
#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;
diff --git a/media/engine/webrtcvoiceengine.h b/media/engine/webrtcvoiceengine.h
index 71dd391..3b3f0f3 100644
--- a/media/engine/webrtcvoiceengine.h
+++ b/media/engine/webrtcvoiceengine.h
@@ -61,8 +61,6 @@
const MediaConfig& config,
const AudioOptions& options);
- bool GetOutputVolume(int* level);
- bool SetOutputVolume(int level);
int GetInputLevel();
const std::vector<AudioCodec>& send_codecs() const;
diff --git a/pc/channelmanager.cc b/pc/channelmanager.cc
index afac930..fba1040 100644
--- a/pc/channelmanager.cc
+++ b/pc/channelmanager.cc
@@ -32,8 +32,6 @@
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 @@
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 @@
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 @@
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>(
diff --git a/pc/channelmanager.h b/pc/channelmanager.h
index 16adf87..34188e6 100644
--- a/pc/channelmanager.h
+++ b/pc/channelmanager.h
@@ -121,8 +121,6 @@
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 @@
VideoChannels video_channels_;
DataChannels data_channels_;
- int audio_output_volume_;
bool enable_rtx_;
bool capturing_;
diff --git a/pc/channelmanager_unittest.cc b/pc/channelmanager_unittest.cc
index e5e7b4f..e4e243c 100644
--- a/pc/channelmanager_unittest.cc
+++ b/pc/channelmanager_unittest.cc
@@ -169,41 +169,6 @@
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);