From 35dee8132185f981ff6285f1c9797414de62d9bd Mon Sep 17 00:00:00 2001 From: solenberg Date: Mon, 18 Sep 2017 01:57:01 -0700 Subject: [PATCH] Clean out unused methods from VoiceEngine and VoEBase. BUG=webrtc:4690 Review-Url: https://codereview.webrtc.org/3018523002 Cr-Commit-Position: refs/heads/master@{#19880} --- media/BUILD.gn | 1 - media/engine/fakewebrtcvoiceengine.h | 6 --- media/engine/webrtccommon.h | 58 ------------------------ media/engine/webrtcvoe.h | 3 -- media/engine/webrtcvoiceengine.cc | 18 ++++---- media/engine/webrtcvoiceengine.h | 3 -- test/mock_voice_engine.h | 6 --- voice_engine/include/voe_base.h | 33 -------------- voice_engine/mock/mock_voe_observer.h | 29 ------------ voice_engine/statistics.cc | 12 ----- voice_engine/statistics.h | 1 - voice_engine/voe_base_impl.cc | 61 ------------------------- voice_engine/voe_base_impl.h | 7 --- voice_engine/voe_base_unittest.cc | 65 +++++++++------------------ voice_engine/voice_engine_defines.h | 5 --- voice_engine/voice_engine_fixture.cc | 2 - voice_engine/voice_engine_fixture.h | 2 - voice_engine/voice_engine_impl.cc | 43 ------------------ 18 files changed, 30 insertions(+), 325 deletions(-) delete mode 100644 media/engine/webrtccommon.h delete mode 100644 voice_engine/mock/mock_voe_observer.h diff --git a/media/BUILD.gn b/media/BUILD.gn index a11f56f819..e226087e28 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -160,7 +160,6 @@ rtc_static_library("rtc_audio_video") { "engine/videodecodersoftwarefallbackwrapper.h", "engine/videoencodersoftwarefallbackwrapper.cc", "engine/videoencodersoftwarefallbackwrapper.h", - "engine/webrtccommon.h", "engine/webrtcmediaengine.cc", "engine/webrtcmediaengine.h", "engine/webrtcvideocapturer.cc", diff --git a/media/engine/fakewebrtcvoiceengine.h b/media/engine/fakewebrtcvoiceengine.h index 479cf261a4..db13290b6f 100644 --- a/media/engine/fakewebrtcvoiceengine.h +++ b/media/engine/fakewebrtcvoiceengine.h @@ -98,16 +98,10 @@ class FakeWebRtcVoiceEngine : public webrtc::VoEBase { channels_.erase(channel); return 0; } - WEBRTC_STUB(StartReceive, (int channel)); WEBRTC_STUB(StartPlayout, (int channel)); WEBRTC_STUB(StartSend, (int channel)); - WEBRTC_STUB(StopReceive, (int channel)); WEBRTC_STUB(StopPlayout, (int channel)); WEBRTC_STUB(StopSend, (int channel)); - WEBRTC_STUB(GetVersion, (char version[1024])); - WEBRTC_STUB(LastError, ()); - WEBRTC_STUB(AssociateSendChannel, (int channel, - int accociate_send_channel)); size_t GetNetEqCapacity() const { auto ch = channels_.find(last_channel_); diff --git a/media/engine/webrtccommon.h b/media/engine/webrtccommon.h deleted file mode 100644 index 3b5b845273..0000000000 --- a/media/engine/webrtccommon.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2004 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. - */ - -#ifndef MEDIA_ENGINE_WEBRTCCOMMON_H_ -#define MEDIA_ENGINE_WEBRTCCOMMON_H_ - -#include "common_types.h" // NOLINT(build/include) - -namespace cricket { - -// Tracing helpers, for easy logging when WebRTC calls fail. -// Example: "LOG_RTCERR1(StartSend, channel);" produces the trace -// "StartSend(1) failed, err=XXXX" -// The method GetLastEngineError must be defined in the calling scope. -#define LOG_RTCERR0(func) \ - LOG_RTCERR0_EX(func, GetLastEngineError()) -#define LOG_RTCERR1(func, a1) \ - LOG_RTCERR1_EX(func, a1, GetLastEngineError()) -#define LOG_RTCERR2(func, a1, a2) \ - LOG_RTCERR2_EX(func, a1, a2, GetLastEngineError()) -#define LOG_RTCERR3(func, a1, a2, a3) \ - LOG_RTCERR3_EX(func, a1, a2, a3, GetLastEngineError()) -#define LOG_RTCERR4(func, a1, a2, a3, a4) \ - LOG_RTCERR4_EX(func, a1, a2, a3, a4, GetLastEngineError()) -#define LOG_RTCERR5(func, a1, a2, a3, a4, a5) \ - LOG_RTCERR5_EX(func, a1, a2, a3, a4, a5, GetLastEngineError()) -#define LOG_RTCERR6(func, a1, a2, a3, a4, a5, a6) \ - LOG_RTCERR6_EX(func, a1, a2, a3, a4, a5, a6, GetLastEngineError()) -#define LOG_RTCERR0_EX(func, err) LOG(LS_WARNING) \ - << "" << #func << "() failed, err=" << err -#define LOG_RTCERR1_EX(func, a1, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ") failed, err=" << err -#define LOG_RTCERR2_EX(func, a1, a2, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ", " << a2 << ") failed, err=" \ - << err -#define LOG_RTCERR3_EX(func, a1, a2, a3, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ", " << a2 << ", " << a3 \ - << ") failed, err=" << err -#define LOG_RTCERR4_EX(func, a1, a2, a3, a4, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ", " << a2 << ", " << a3 \ - << ", " << a4 << ") failed, err=" << err -#define LOG_RTCERR5_EX(func, a1, a2, a3, a4, a5, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ", " << a2 << ", " << a3 \ - << ", " << a4 << ", " << a5 << ") failed, err=" << err -#define LOG_RTCERR6_EX(func, a1, a2, a3, a4, a5, a6, err) LOG(LS_WARNING) \ - << "" << #func << "(" << a1 << ", " << a2 << ", " << a3 \ - << ", " << a4 << ", " << a5 << ", " << a6 << ") failed, err=" << err - -} // namespace cricket - -#endif // MEDIA_ENGINE_WEBRTCCOMMON_H_ diff --git a/media/engine/webrtcvoe.h b/media/engine/webrtcvoe.h index a5450da338..fd4f92969c 100644 --- a/media/engine/webrtcvoe.h +++ b/media/engine/webrtcvoe.h @@ -13,8 +13,6 @@ #include -#include "media/engine/webrtccommon.h" - #include "common_types.h" // NOLINT(build/include) #include "modules/audio_device/include/audio_device.h" #include "voice_engine/include/voe_base.h" @@ -83,7 +81,6 @@ class VoEWrapper { ~VoEWrapper() {} webrtc::VoiceEngine* engine() const { return engine_.get(); } webrtc::VoEBase* base() const { return base_.get(); } - int error() { return base_->LastError(); } private: scoped_voe_engine engine_; diff --git a/media/engine/webrtcvoiceengine.cc b/media/engine/webrtcvoiceengine.cc index 271ace1212..8fa5fe2654 100644 --- a/media/engine/webrtcvoiceengine.cc +++ b/media/engine/webrtcvoiceengine.cc @@ -290,7 +290,6 @@ void WebRtcVoiceEngine::Init() { // Temporarily turn logging level up for the Init() call. webrtc::Trace::SetTraceCallback(this); webrtc::Trace::set_level_filter(kElevatedTraceFilter); - LOG(LS_INFO) << webrtc::VoiceEngine::GetVersionString(); RTC_CHECK_EQ(0, voe_wrapper_->base()->Init(adm_.get(), apm(), decoder_factory_)); webrtc::Trace::set_level_filter(kDefaultTraceFilter); @@ -628,14 +627,18 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { LOG(LS_INFO) << "Recording sample rate is " << *options.recording_sample_rate; if (adm()->SetRecordingSampleRate(*options.recording_sample_rate)) { - LOG_RTCERR1(SetRecordingSampleRate, *options.recording_sample_rate); + LOG(LS_WARNING) << "SetRecordingSampleRate(" + << *options.recording_sample_rate << ") failed, err=" + << adm()->LastError(); } } if (options.playout_sample_rate) { LOG(LS_INFO) << "Playout sample rate is " << *options.playout_sample_rate; if (adm()->SetPlayoutSampleRate(*options.playout_sample_rate)) { - LOG_RTCERR1(SetPlayoutSampleRate, *options.playout_sample_rate); + LOG(LS_WARNING) << "SetPlayoutSampleRate(" + << *options.playout_sample_rate << ") failed, err=" + << adm()->LastError(); } } return true; @@ -673,11 +676,6 @@ RtpCapabilities WebRtcVoiceEngine::GetCapabilities() const { return capabilities; } -int WebRtcVoiceEngine::GetLastEngineError() { - RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); - return voe_wrapper_->error(); -} - void WebRtcVoiceEngine::Print(webrtc::TraceLevel level, const char* trace, int length) { // Note: This callback can happen on any thread! @@ -1832,7 +1830,7 @@ bool WebRtcVoiceMediaChannel::SetAudioSend(uint32_t ssrc, int WebRtcVoiceMediaChannel::CreateVoEChannel() { int id = engine()->CreateVoEChannel(); if (id == -1) { - LOG_RTCERR0(CreateVoEChannel); + LOG(LS_WARNING) << "CreateVoEChannel() failed."; return -1; } @@ -1841,7 +1839,7 @@ int WebRtcVoiceMediaChannel::CreateVoEChannel() { bool WebRtcVoiceMediaChannel::DeleteVoEChannel(int channel) { if (engine()->voe()->base()->DeleteChannel(channel) == -1) { - LOG_RTCERR1(DeleteChannel, channel); + LOG(LS_WARNING) << "DeleteChannel(" << channel << ") failed."; return false; } return true; diff --git a/media/engine/webrtcvoiceengine.h b/media/engine/webrtcvoiceengine.h index e27857696a..87b7a94727 100644 --- a/media/engine/webrtcvoiceengine.h +++ b/media/engine/webrtcvoiceengine.h @@ -22,7 +22,6 @@ #include "call/call.h" #include "media/base/rtputils.h" #include "media/engine/apm_helpers.h" -#include "media/engine/webrtccommon.h" #include "media/engine/webrtcvoe.h" #include "modules/audio_processing/include/audio_processing.h" #include "pc/channel.h" @@ -89,7 +88,6 @@ class WebRtcVoiceEngine final : public webrtc::TraceCallback { void UnregisterChannel(WebRtcVoiceMediaChannel* channel); VoEWrapper* voe() { return voe_wrapper_.get(); } - int GetLastEngineError(); // Starts AEC dump using an existing file. A maximum file size in bytes can be // specified. When the maximum file size is reached, logging is stopped and @@ -249,7 +247,6 @@ class WebRtcVoiceMediaChannel final : public VoiceMediaChannel, bool MuteStream(uint32_t ssrc, bool mute); WebRtcVoiceEngine* engine() { return engine_; } - int GetLastEngineError() { return engine()->GetLastEngineError(); } void ChangePlayout(bool playout); int CreateVoEChannel(); bool DeleteVoEChannel(int channel); diff --git a/test/mock_voice_engine.h b/test/mock_voice_engine.h index d644f24861..8f8fdac8fa 100644 --- a/test/mock_voice_engine.h +++ b/test/mock_voice_engine.h @@ -107,17 +107,11 @@ class MockVoiceEngine : public VoiceEngineImpl { MOCK_METHOD0(CreateChannel, int()); MOCK_METHOD1(CreateChannel, int(const ChannelConfig& config)); MOCK_METHOD1(DeleteChannel, int(int channel)); - MOCK_METHOD1(StartReceive, int(int channel)); - MOCK_METHOD1(StopReceive, int(int channel)); MOCK_METHOD1(StartPlayout, int(int channel)); MOCK_METHOD1(StopPlayout, int(int channel)); MOCK_METHOD1(StartSend, int(int channel)); MOCK_METHOD1(StopSend, int(int channel)); - MOCK_METHOD1(GetVersion, int(char version[1024])); - MOCK_METHOD0(LastError, int()); MOCK_METHOD0(audio_transport, AudioTransport*()); - MOCK_METHOD2(AssociateSendChannel, - int(int channel, int accociate_send_channel)); // VoECodec MOCK_METHOD0(NumOfCodecs, int()); diff --git a/voice_engine/include/voe_base.h b/voice_engine/include/voe_base.h index 681b5ab284..b2daca19cd 100644 --- a/voice_engine/include/voe_base.h +++ b/voice_engine/include/voe_base.h @@ -73,20 +73,6 @@ class WEBRTC_DLLEXPORT VoiceEngine { // references have been released. static bool Delete(VoiceEngine*& voiceEngine); - // Specifies the amount and type of trace information which will be - // created by the VoiceEngine. - static int SetTraceFilter(unsigned int filter); - - // Sets the name of the trace file and enables non-encrypted trace messages. - static int SetTraceFile(const char* fileNameUTF8, - bool addFileCounter = false); - - // Installs the TraceCallback implementation to ensure that the user - // receives callbacks for generated trace messages. - static int SetTraceCallback(TraceCallback* callback); - - static std::string GetVersionString(); - protected: VoiceEngine() {} ~VoiceEngine() {} @@ -158,13 +144,6 @@ class WEBRTC_DLLEXPORT VoEBase { // Returns -1 in case of an error, 0 otherwise. virtual int DeleteChannel(int channel) = 0; - // Prepares and initiates the VoiceEngine for reception of - // incoming RTP/RTCP packets on the specified |channel|. - virtual int StartReceive(int channel) = 0; - - // Stops receiving incoming RTP/RTCP packets on the specified |channel|. - virtual int StopReceive(int channel) { return 0; } - // Starts forwarding the packets to the mixer/soundcard for a // specified |channel|. virtual int StartPlayout(int channel) = 0; @@ -180,22 +159,10 @@ class WEBRTC_DLLEXPORT VoEBase { // Stops sending packets from a specified |channel|. virtual int StopSend(int channel) = 0; - // Gets the version information for VoiceEngine and its components. - virtual int GetVersion(char version[1024]) = 0; - - // Gets the last VoiceEngine error code. - virtual int LastError() = 0; - // TODO(xians): Make the interface pure virtual after libjingle // implements the interface in its FakeWebRtcVoiceEngine. virtual AudioTransport* audio_transport() { return NULL; } - // Associate a send channel to a receive channel. - // Used for obtaining RTT for a receive-only channel. - // One should be careful not to crate a circular association, e.g., - // 1 <- 2 <- 1. - virtual int AssociateSendChannel(int channel, int accociate_send_channel) = 0; - protected: VoEBase() {} virtual ~VoEBase() {} diff --git a/voice_engine/mock/mock_voe_observer.h b/voice_engine/mock/mock_voe_observer.h deleted file mode 100644 index 99c8c55fe1..0000000000 --- a/voice_engine/mock/mock_voe_observer.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2012 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. - */ - -#ifndef VOICE_ENGINE_MOCK_VOE_OBSERVER_H_ -#define VOICE_ENGINE_MOCK_VOE_OBSERVER_H_ - -#include "test/gmock.h" -#include "voice_engine/include/voe_base.h" - -namespace webrtc { - -class MockVoEObserver: public VoiceEngineObserver { - public: - MockVoEObserver() {} - virtual ~MockVoEObserver() {} - - MOCK_METHOD2(CallbackOnError, void(int channel, int error_code)); -}; - -} - -#endif // VOICE_ENGINE_MOCK_VOE_OBSERVER_H_ diff --git a/voice_engine/statistics.cc b/voice_engine/statistics.cc index 15cb438dfe..cfa7e91316 100644 --- a/voice_engine/statistics.cc +++ b/voice_engine/statistics.cc @@ -81,18 +81,6 @@ int32_t Statistics::SetLastError( return 0; } -int32_t Statistics::LastError() const -{ - int32_t ret; - { - rtc::CritScope cs(&lock_); - ret = _lastError; - } - WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, -1), - "LastError() => %d", ret); - return ret; -} - } // namespace voe } // namespace webrtc diff --git a/voice_engine/statistics.h b/voice_engine/statistics.h index c875ea4333..4f705266a2 100644 --- a/voice_engine/statistics.h +++ b/voice_engine/statistics.h @@ -36,7 +36,6 @@ class Statistics int32_t SetLastError(int32_t error, TraceLevel level, const char* msg) const; - int32_t LastError() const; private: rtc::CriticalSection lock_; diff --git a/voice_engine/voe_base_impl.cc b/voice_engine/voe_base_impl.cc index 50611df77e..8768b324b9 100644 --- a/voice_engine/voe_base_impl.cc +++ b/voice_engine/voe_base_impl.cc @@ -468,22 +468,6 @@ int VoEBaseImpl::DeleteChannel(int channel) { return 0; } -int VoEBaseImpl::StartReceive(int channel) { - rtc::CritScope cs(shared_->crit_sec()); - 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 == nullptr) { - shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "StartReceive() failed to locate channel"); - return -1; - } - return 0; -} - int VoEBaseImpl::StartPlayout(int channel) { rtc::CritScope cs(shared_->crit_sec()); if (!shared_->statistics().Initialized()) { @@ -569,22 +553,6 @@ int VoEBaseImpl::StopSend(int channel) { return StopSend(); } -int VoEBaseImpl::GetVersion(char version[1024]) { - if (version == nullptr) { - shared_->SetLastError(VE_INVALID_ARGUMENT, kTraceError); - return -1; - } - - std::string versionString = VoiceEngine::GetVersionString(); - RTC_DCHECK_GT(1024, versionString.size() + 1); - char* end = std::copy(versionString.cbegin(), versionString.cend(), version); - end[0] = '\n'; - end[1] = '\0'; - return 0; -} - -int VoEBaseImpl::LastError() { return (shared_->statistics().LastError()); } - int32_t VoEBaseImpl::StartPlayout() { if (!shared_->audio_device()->Playing()) { if (shared_->audio_device()->InitPlayout() != 0) { @@ -716,33 +684,4 @@ void VoEBaseImpl::GetPlayoutData(int sample_rate, size_t number_of_channels, *ntp_time_ms = audioFrame_.ntp_time_ms_; } -int VoEBaseImpl::AssociateSendChannel(int channel, - int accociate_send_channel) { - rtc::CritScope cs(shared_->crit_sec()); - - if (!shared_->statistics().Initialized()) { - shared_->SetLastError(VE_NOT_INITED, kTraceError); - return -1; - } - - voe::ChannelOwner ch = shared_->channel_manager().GetChannel(channel); - voe::Channel* channel_ptr = ch.channel(); - if (channel_ptr == NULL) { - shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "AssociateSendChannel() failed to locate channel"); - return -1; - } - - ch = shared_->channel_manager().GetChannel(accociate_send_channel); - voe::Channel* accociate_send_channel_ptr = ch.channel(); - if (accociate_send_channel_ptr == NULL) { - shared_->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, - "AssociateSendChannel() failed to locate accociate_send_channel"); - return -1; - } - - channel_ptr->set_associate_send_channel(ch); - return 0; -} - } // namespace webrtc diff --git a/voice_engine/voe_base_impl.h b/voice_engine/voe_base_impl.h index 36e3502e3b..608292ce08 100644 --- a/voice_engine/voe_base_impl.h +++ b/voice_engine/voe_base_impl.h @@ -44,20 +44,13 @@ class VoEBaseImpl : public VoEBase, int CreateChannel(const ChannelConfig& config) override; int DeleteChannel(int channel) override; - int StartReceive(int channel) override; int StartPlayout(int channel) override; int StartSend(int channel) override; int StopPlayout(int channel) override; int StopSend(int channel) override; - int GetVersion(char version[1024]) override; - - int LastError() override; - AudioTransport* audio_transport() override { return this; } - int AssociateSendChannel(int channel, int accociate_send_channel) override; - // AudioTransport int32_t RecordedDataIsAvailable(const void* audio_data, const size_t number_of_frames, diff --git a/voice_engine/voe_base_unittest.cc b/voice_engine/voe_base_unittest.cc index d6eb875fb3..33758789a8 100644 --- a/voice_engine/voe_base_unittest.cc +++ b/voice_engine/voe_base_unittest.cc @@ -10,20 +10,35 @@ #include "voice_engine/include/voe_base.h" -#include "modules/audio_processing/include/audio_processing.h" +#include "modules/audio_device/include/fake_audio_device.h" +#include "modules/audio_processing/include/mock_audio_processing.h" #include "test/gtest.h" -#include "voice_engine/channel_manager.h" -#include "voice_engine/shared_data.h" -#include "voice_engine/voice_engine_fixture.h" -#include "voice_engine/voice_engine_impl.h" namespace webrtc { -class VoEBaseTest : public VoiceEngineFixture {}; +class VoEBaseTest : public ::testing::Test { + protected: + VoEBaseTest() + : voe_(VoiceEngine::Create()), + base_(VoEBase::GetInterface(voe_)) { + EXPECT_NE(nullptr, base_); + apm_ = new rtc::RefCountedObject(); + } + + ~VoEBaseTest() { + EXPECT_EQ(0, base_->Terminate()); + EXPECT_EQ(1, base_->Release()); + EXPECT_TRUE(VoiceEngine::Delete(voe_)); + } + + VoiceEngine* voe_; + VoEBase* base_; + FakeAudioDeviceModule adm_; + rtc::scoped_refptr apm_; +}; TEST_F(VoEBaseTest, InitWithExternalAudioDevice) { EXPECT_EQ(0, base_->Init(&adm_, apm_.get())); - EXPECT_EQ(0, base_->LastError()); } TEST_F(VoEBaseTest, CreateChannelBeforeInitShouldFail) { @@ -38,40 +53,4 @@ TEST_F(VoEBaseTest, CreateChannelAfterInit) { EXPECT_EQ(0, base_->DeleteChannel(channelID)); } -TEST_F(VoEBaseTest, AssociateSendChannel) { - EXPECT_EQ(0, base_->Init(&adm_, apm_.get())); - - const int channel_1 = base_->CreateChannel(); - - // Associating with a channel that does not exist should fail. - EXPECT_EQ(-1, base_->AssociateSendChannel(channel_1, channel_1 + 1)); - - const int channel_2 = base_->CreateChannel(); - - // Let the two channels associate with each other. This is not a normal use - // case. Actually, circular association should be avoided in practice. This - // is just to test that no crash is caused. - EXPECT_EQ(0, base_->AssociateSendChannel(channel_1, channel_2)); - EXPECT_EQ(0, base_->AssociateSendChannel(channel_2, channel_1)); - - voe::SharedData* shared_data = static_cast( - static_cast(voe_)); - voe::ChannelOwner reference = shared_data->channel_manager() - .GetChannel(channel_1); - EXPECT_EQ(0, base_->DeleteChannel(channel_1)); - // Make sure that the only use of the channel-to-delete is |reference| - // at this point. - EXPECT_EQ(1, reference.use_count()); - - reference = shared_data->channel_manager().GetChannel(channel_2); - EXPECT_EQ(0, base_->DeleteChannel(channel_2)); - EXPECT_EQ(1, reference.use_count()); -} - -TEST_F(VoEBaseTest, GetVersion) { - char v1[1024] = {75}; - base_->GetVersion(v1); - std::string v2 = VoiceEngine::GetVersionString() + "\n"; - EXPECT_EQ(v2, v1); -} } // namespace webrtc diff --git a/voice_engine/voice_engine_defines.h b/voice_engine/voice_engine_defines.h index d68648fd62..c16dd56468 100644 --- a/voice_engine/voice_engine_defines.h +++ b/voice_engine/voice_engine_defines.h @@ -64,11 +64,6 @@ enum { kVoiceEngineMaxRtpExtensionId = 14 }; } // namespace webrtc -#define NOT_SUPPORTED(stat) \ - LOG_F(LS_ERROR) << "not supported"; \ - stat.SetLastError(VE_FUNC_NOT_SUPPORTED); \ - return -1; - namespace webrtc { inline int VoEId(int veId, int chId) { diff --git a/voice_engine/voice_engine_fixture.cc b/voice_engine/voice_engine_fixture.cc index eb605c9c5b..c167b40135 100644 --- a/voice_engine/voice_engine_fixture.cc +++ b/voice_engine/voice_engine_fixture.cc @@ -19,13 +19,11 @@ VoiceEngineFixture::VoiceEngineFixture() network_(VoENetwork::GetInterface(voe_)) { EXPECT_NE(nullptr, base_); EXPECT_NE(nullptr, network_); - EXPECT_EQ(0, base_->RegisterVoiceEngineObserver(observer_)); apm_ = new rtc::RefCountedObject(); } VoiceEngineFixture::~VoiceEngineFixture() { EXPECT_EQ(2, network_->Release()); - EXPECT_EQ(0, base_->DeRegisterVoiceEngineObserver()); EXPECT_EQ(0, base_->Terminate()); EXPECT_EQ(1, base_->Release()); EXPECT_TRUE(VoiceEngine::Delete(voe_)); diff --git a/voice_engine/voice_engine_fixture.h b/voice_engine/voice_engine_fixture.h index c4fc5d0d25..4d52aa7da2 100644 --- a/voice_engine/voice_engine_fixture.h +++ b/voice_engine/voice_engine_fixture.h @@ -14,7 +14,6 @@ #include "test/mock_transport.h" #include "voice_engine/include/voe_base.h" #include "voice_engine/include/voe_network.h" -#include "voice_engine/mock/mock_voe_observer.h" namespace webrtc { @@ -26,7 +25,6 @@ class VoiceEngineFixture : public ::testing::Test { VoiceEngine* voe_; VoEBase* base_; VoENetwork* network_; - MockVoEObserver observer_; FakeAudioDeviceModule adm_; MockTransport transport_; rtc::scoped_refptr apm_; diff --git a/voice_engine/voice_engine_impl.cc b/voice_engine/voice_engine_impl.cc index 9ecdf3bf8b..000907ea8d 100644 --- a/voice_engine/voice_engine_impl.cc +++ b/voice_engine/voice_engine_impl.cc @@ -74,40 +74,6 @@ VoiceEngine* VoiceEngine::Create() { return GetVoiceEngine(); } -int VoiceEngine::SetTraceFilter(unsigned int filter) { - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, - VoEId(gVoiceEngineInstanceCounter, -1), - "SetTraceFilter(filter=0x%x)", filter); - - // Remember old filter - uint32_t oldFilter = Trace::level_filter(); - Trace::set_level_filter(filter); - - // If previous log was ignored, log again after changing filter - if (kTraceNone == oldFilter) { - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, -1, "SetTraceFilter(filter=0x%x)", - filter); - } - - return 0; -} - -int VoiceEngine::SetTraceFile(const char* fileNameUTF8, bool addFileCounter) { - int ret = Trace::SetTraceFile(fileNameUTF8, addFileCounter); - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, - VoEId(gVoiceEngineInstanceCounter, -1), - "SetTraceFile(fileNameUTF8=%s, addFileCounter=%d)", fileNameUTF8, - addFileCounter); - return (ret); -} - -int VoiceEngine::SetTraceCallback(TraceCallback* callback) { - WEBRTC_TRACE(kTraceApiCall, kTraceVoice, - VoEId(gVoiceEngineInstanceCounter, -1), - "SetTraceCallback(callback=0x%x)", callback); - return (Trace::SetTraceCallback(callback)); -} - bool VoiceEngine::Delete(VoiceEngine*& voiceEngine) { if (voiceEngine == NULL) return false; @@ -127,13 +93,4 @@ bool VoiceEngine::Delete(VoiceEngine*& voiceEngine) { return true; } - -std::string VoiceEngine::GetVersionString() { - std::string version = "VoiceEngine 4.1.0"; -#ifdef WEBRTC_EXTERNAL_TRANSPORT - version += " (External transport build)"; -#endif - return version; -} - } // namespace webrtc