diff --git a/webrtc/media/engine/fakewebrtcvoiceengine.h b/webrtc/media/engine/fakewebrtcvoiceengine.h index 180d06bcaf..13721ea554 100644 --- a/webrtc/media/engine/fakewebrtcvoiceengine.h +++ b/webrtc/media/engine/fakewebrtcvoiceengine.h @@ -11,20 +11,11 @@ #ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ #define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ -#include - -#include #include #include #include "webrtc/base/checks.h" -#include "webrtc/base/stringutils.h" -#include "webrtc/base/checks.h" -#include "webrtc/config.h" -#include "webrtc/media/base/codec.h" -#include "webrtc/media/base/rtputils.h" #include "webrtc/media/engine/webrtcvoe.h" -#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" #include "webrtc/modules/audio_processing/include/audio_processing.h" namespace webrtc { @@ -35,31 +26,15 @@ class TransmitMixer; namespace cricket { -static const int kOpusBandwidthNb = 4000; -static const int kOpusBandwidthMb = 6000; -static const int kOpusBandwidthWb = 8000; -static const int kOpusBandwidthSwb = 12000; -static const int kOpusBandwidthFb = 20000; - #define WEBRTC_CHECK_CHANNEL(channel) \ if (channels_.find(channel) == channels_.end()) return -1; #define WEBRTC_STUB(method, args) \ int method args override { return 0; } -#define WEBRTC_STUB_CONST(method, args) \ - int method args const override { return 0; } - -#define WEBRTC_BOOL_STUB(method, args) \ - bool method args override { return true; } - -#define WEBRTC_VOID_STUB(method, args) \ - void method args override {} - #define WEBRTC_FUNC(method, args) int method args override -class FakeWebRtcVoiceEngine - : public webrtc::VoEBase, public webrtc::VoECodec { +class FakeWebRtcVoiceEngine : public webrtc::VoEBase { public: struct Channel { std::vector recv_codecs; @@ -140,66 +115,6 @@ class FakeWebRtcVoiceEngine WEBRTC_STUB(AssociateSendChannel, (int channel, int accociate_send_channel)); - // webrtc::VoECodec - WEBRTC_STUB(NumOfCodecs, ()); - WEBRTC_STUB(GetCodec, (int index, webrtc::CodecInst& codec)); - WEBRTC_STUB(SetSendCodec, (int channel, const webrtc::CodecInst& codec)); - WEBRTC_STUB(GetSendCodec, (int channel, webrtc::CodecInst& codec)); - WEBRTC_STUB(SetBitRate, (int channel, int bitrate_bps)); - WEBRTC_STUB(GetRecCodec, (int channel, webrtc::CodecInst& codec)); - WEBRTC_FUNC(SetRecPayloadType, (int channel, - const webrtc::CodecInst& codec)) { - WEBRTC_CHECK_CHANNEL(channel); - Channel* ch = channels_[channel]; - // Check if something else already has this slot. - if (codec.pltype != -1) { - for (std::vector::iterator it = - ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) { - if (it->pltype == codec.pltype && - _stricmp(it->plname, codec.plname) != 0) { - return -1; - } - } - } - // Otherwise try to find this codec and update its payload type. - int result = -1; // not found - for (std::vector::iterator it = ch->recv_codecs.begin(); - it != ch->recv_codecs.end(); ++it) { - if (strcmp(it->plname, codec.plname) == 0 && - it->plfreq == codec.plfreq && - it->channels == codec.channels) { - it->pltype = codec.pltype; - result = 0; - } - } - return result; - } - WEBRTC_STUB(SetSendCNPayloadType, (int channel, int type, - webrtc::PayloadFrequencies frequency)); - WEBRTC_FUNC(GetRecPayloadType, (int channel, webrtc::CodecInst& codec)) { - WEBRTC_CHECK_CHANNEL(channel); - Channel* ch = channels_[channel]; - for (std::vector::iterator it = ch->recv_codecs.begin(); - it != ch->recv_codecs.end(); ++it) { - if (strcmp(it->plname, codec.plname) == 0 && - it->plfreq == codec.plfreq && - it->channels == codec.channels && - it->pltype != -1) { - codec.pltype = it->pltype; - return 0; - } - } - return -1; // not found - } - WEBRTC_STUB(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode, - bool disableDTX)); - WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled, - webrtc::VadModes& mode, bool& disabledDTX)); - WEBRTC_STUB(SetFECStatus, (int channel, bool enable)); - WEBRTC_STUB(GetFECStatus, (int channel, bool& enable)); - WEBRTC_STUB(SetOpusMaxPlaybackRate, (int channel, int frequency_hz)); - WEBRTC_STUB(SetOpusDtx, (int channel, bool enable_dtx)); - size_t GetNetEqCapacity() const { auto ch = channels_.find(last_channel_); RTC_DCHECK(ch != channels_.end()); diff --git a/webrtc/media/engine/webrtcvoe.h b/webrtc/media/engine/webrtcvoe.h index 9547e6a7fb..79f0ed60e9 100644 --- a/webrtc/media/engine/webrtcvoe.h +++ b/webrtc/media/engine/webrtcvoe.h @@ -75,25 +75,19 @@ class scoped_voe_ptr { class VoEWrapper { public: VoEWrapper() - : engine_(webrtc::VoiceEngine::Create()), - base_(engine_), codec_(engine_) { + : engine_(webrtc::VoiceEngine::Create()), base_(engine_) { } - VoEWrapper(webrtc::VoEBase* base, - webrtc::VoECodec* codec) - : engine_(NULL), - base_(base), - codec_(codec) { + VoEWrapper(webrtc::VoEBase* base) + : engine_(NULL), base_(base) { } ~VoEWrapper() {} webrtc::VoiceEngine* engine() const { return engine_.get(); } webrtc::VoEBase* base() const { return base_.get(); } - webrtc::VoECodec* codec() const { return codec_.get(); } int error() { return base_->LastError(); } private: scoped_voe_engine engine_; scoped_voe_ptr base_; - scoped_voe_ptr codec_; }; } // namespace cricket diff --git a/webrtc/media/engine/webrtcvoiceengine_unittest.cc b/webrtc/media/engine/webrtcvoiceengine_unittest.cc index b57f4ee568..44003ec115 100644 --- a/webrtc/media/engine/webrtcvoiceengine_unittest.cc +++ b/webrtc/media/engine/webrtcvoiceengine_unittest.cc @@ -64,8 +64,7 @@ constexpr int kRtpHistoryMs = 5000; class FakeVoEWrapper : public cricket::VoEWrapper { public: explicit FakeVoEWrapper(cricket::FakeWebRtcVoiceEngine* engine) - : cricket::VoEWrapper(engine, // base - engine) { // codec + : cricket::VoEWrapper(engine) { } };