From 88b70747451a41a1d0f8dc607c959ce8548d83cb Mon Sep 17 00:00:00 2001 From: solenberg Date: Mon, 24 Oct 2016 13:46:01 -0700 Subject: [PATCH] Remove unused function implementations from FakeWebRtcVoiceEngine. BUG=webrtc:4690 Review-Url: https://codereview.webrtc.org/2440353003 Cr-Commit-Position: refs/heads/master@{#14752} --- webrtc/media/engine/fakewebrtcvoiceengine.h | 123 ++------------------ 1 file changed, 10 insertions(+), 113 deletions(-) diff --git a/webrtc/media/engine/fakewebrtcvoiceengine.h b/webrtc/media/engine/fakewebrtcvoiceengine.h index e0e71fb800..1568729cd8 100644 --- a/webrtc/media/engine/fakewebrtcvoiceengine.h +++ b/webrtc/media/engine/fakewebrtcvoiceengine.h @@ -145,18 +145,8 @@ class FakeWebRtcVoiceEngine public webrtc::VoEVolumeControl { public: struct Channel { - Channel() { - memset(&send_codec, 0, sizeof(send_codec)); - } - bool vad = false; - bool codec_fec = false; - int max_encoding_bandwidth = 0; - bool opus_dtx = false; - int cn8_type = 13; - int cn16_type = 105; int associate_send_channel = -1; std::vector recv_codecs; - webrtc::CodecInst send_codec; size_t neteq_capacity = 0; bool neteq_fast_accelerate = false; }; @@ -173,29 +163,10 @@ class FakeWebRtcVoiceEngine bool IsInited() const { return inited_; } int GetLastChannel() const { return last_channel_; } int GetNumChannels() const { return static_cast(channels_.size()); } - bool GetVAD(int channel) { - return channels_[channel]->vad; - } - bool GetOpusDtx(int channel) { - return channels_[channel]->opus_dtx; - } - bool GetCodecFEC(int channel) { - return channels_[channel]->codec_fec; - } - int GetMaxEncodingBandwidth(int channel) { - return channels_[channel]->max_encoding_bandwidth; - } - int GetSendCNPayloadType(int channel, bool wideband) { - return (wideband) ? - channels_[channel]->cn16_type : - channels_[channel]->cn8_type; - } void set_fail_create_channel(bool fail_create_channel) { fail_create_channel_ = fail_create_channel; } - int GetNumSetSendCodecs() const { return num_set_send_codecs_; } - int GetAssociateSendChannel(int channel) { return channels_[channel]->associate_send_channel; } @@ -269,24 +240,8 @@ class FakeWebRtcVoiceEngine // webrtc::VoECodec WEBRTC_STUB(NumOfCodecs, ()); WEBRTC_STUB(GetCodec, (int index, webrtc::CodecInst& codec)); - WEBRTC_FUNC(SetSendCodec, (int channel, const webrtc::CodecInst& codec)) { - WEBRTC_CHECK_CHANNEL(channel); - // To match the behavior of the real implementation. - if (_stricmp(codec.plname, "telephone-event") == 0 || - _stricmp(codec.plname, "audio/telephone-event") == 0 || - _stricmp(codec.plname, "CN") == 0 || - _stricmp(codec.plname, "red") == 0) { - return -1; - } - channels_[channel]->send_codec = codec; - ++num_set_send_codecs_; - return 0; - } - WEBRTC_FUNC(GetSendCodec, (int channel, webrtc::CodecInst& codec)) { - WEBRTC_CHECK_CHANNEL(channel); - codec = channels_[channel]->send_codec; - return 0; - } + 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, @@ -316,16 +271,8 @@ class FakeWebRtcVoiceEngine } return result; } - WEBRTC_FUNC(SetSendCNPayloadType, (int channel, int type, - webrtc::PayloadFrequencies frequency)) { - WEBRTC_CHECK_CHANNEL(channel); - if (frequency == webrtc::kFreq8000Hz) { - channels_[channel]->cn8_type = type; - } else if (frequency == webrtc::kFreq16000Hz) { - channels_[channel]->cn16_type = type; - } - return 0; - } + 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]; @@ -341,63 +288,14 @@ class FakeWebRtcVoiceEngine } return -1; // not found } - WEBRTC_FUNC(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode, - bool disableDTX)) { - WEBRTC_CHECK_CHANNEL(channel); - if (channels_[channel]->send_codec.channels == 2) { - // Replicating VoE behavior; VAD cannot be enabled for stereo. - return -1; - } - channels_[channel]->vad = enable; - return 0; - } + 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_FUNC(SetFECStatus, (int channel, bool enable)) { - WEBRTC_CHECK_CHANNEL(channel); - if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) { - // Return -1 if current send codec is not Opus. - // TODO(minyue): Excludes other codecs if they support inband FEC. - return -1; - } - channels_[channel]->codec_fec = enable; - return 0; - } - WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable)) { - WEBRTC_CHECK_CHANNEL(channel); - enable = channels_[channel]->codec_fec; - return 0; - } - - WEBRTC_FUNC(SetOpusMaxPlaybackRate, (int channel, int frequency_hz)) { - WEBRTC_CHECK_CHANNEL(channel); - if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) { - // Return -1 if current send codec is not Opus. - return -1; - } - if (frequency_hz <= 8000) - channels_[channel]->max_encoding_bandwidth = kOpusBandwidthNb; - else if (frequency_hz <= 12000) - channels_[channel]->max_encoding_bandwidth = kOpusBandwidthMb; - else if (frequency_hz <= 16000) - channels_[channel]->max_encoding_bandwidth = kOpusBandwidthWb; - else if (frequency_hz <= 24000) - channels_[channel]->max_encoding_bandwidth = kOpusBandwidthSwb; - else - channels_[channel]->max_encoding_bandwidth = kOpusBandwidthFb; - return 0; - } - - WEBRTC_FUNC(SetOpusDtx, (int channel, bool enable_dtx)) { - WEBRTC_CHECK_CHANNEL(channel); - if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) { - // Return -1 if current send codec is not Opus. - return -1; - } - channels_[channel]->opus_dtx = enable_dtx; - return 0; - } + 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)); // webrtc::VoEHardware WEBRTC_STUB(GetNumOfRecordingDevices, (int& num)); @@ -548,7 +446,6 @@ class FakeWebRtcVoiceEngine int last_channel_ = -1; std::map channels_; bool fail_create_channel_ = false; - int num_set_send_codecs_ = 0; // how many times we call SetSendCodec(). bool ec_enabled_ = false; bool ec_metrics_enabled_ = false; bool cng_enabled_ = false;