henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | 1afca73 | 2016-02-07 20:46:45 -0800 | [diff] [blame] | 2 | * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | 1afca73 | 2016-02-07 20:46:45 -0800 | [diff] [blame] | 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
kjellander@webrtc.org | 5ad1297 | 2016-02-12 06:39:40 +0100 | [diff] [blame] | 11 | #ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |
| 12 | #define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 13 | |
| 14 | #include <list> |
| 15 | #include <map> |
| 16 | #include <vector> |
| 17 | |
buildbot@webrtc.org | a09a999 | 2014-08-13 17:26:08 +0000 | [diff] [blame] | 18 | #include "webrtc/base/basictypes.h" |
Fredrik Solenberg | d3ddc1b | 2015-05-07 17:07:34 +0200 | [diff] [blame] | 19 | #include "webrtc/base/checks.h" |
buildbot@webrtc.org | a09a999 | 2014-08-13 17:26:08 +0000 | [diff] [blame] | 20 | #include "webrtc/base/gunit.h" |
| 21 | #include "webrtc/base/stringutils.h" |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 22 | #include "webrtc/config.h" |
kjellander | a96e2d7 | 2016-02-04 23:52:28 -0800 | [diff] [blame] | 23 | #include "webrtc/media/base/codec.h" |
| 24 | #include "webrtc/media/base/rtputils.h" |
kjellander@webrtc.org | 5ad1297 | 2016-02-12 06:39:40 +0100 | [diff] [blame] | 25 | #include "webrtc/media/engine/fakewebrtccommon.h" |
| 26 | #include "webrtc/media/engine/webrtcvoe.h" |
solenberg | 26c8c91 | 2015-11-27 04:00:25 -0800 | [diff] [blame] | 27 | #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 28 | #include "webrtc/modules/audio_processing/include/audio_processing.h" |
buildbot@webrtc.org | f875f15 | 2014-04-14 16:06:21 +0000 | [diff] [blame] | 29 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 30 | namespace cricket { |
| 31 | |
buildbot@webrtc.org | 5d639b3 | 2014-09-10 07:57:12 +0000 | [diff] [blame] | 32 | static const int kOpusBandwidthNb = 4000; |
| 33 | static const int kOpusBandwidthMb = 6000; |
| 34 | static const int kOpusBandwidthWb = 8000; |
| 35 | static const int kOpusBandwidthSwb = 12000; |
| 36 | static const int kOpusBandwidthFb = 20000; |
| 37 | |
Fredrik Solenberg | d3ddc1b | 2015-05-07 17:07:34 +0200 | [diff] [blame] | 38 | #define WEBRTC_CHECK_CHANNEL(channel) \ |
| 39 | if (channels_.find(channel) == channels_.end()) return -1; |
| 40 | |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 41 | class FakeAudioProcessing : public webrtc::AudioProcessing { |
| 42 | public: |
| 43 | FakeAudioProcessing() : experimental_ns_enabled_(false) {} |
| 44 | |
| 45 | WEBRTC_STUB(Initialize, ()) |
| 46 | WEBRTC_STUB(Initialize, ( |
| 47 | int input_sample_rate_hz, |
| 48 | int output_sample_rate_hz, |
| 49 | int reverse_sample_rate_hz, |
| 50 | webrtc::AudioProcessing::ChannelLayout input_layout, |
| 51 | webrtc::AudioProcessing::ChannelLayout output_layout, |
| 52 | webrtc::AudioProcessing::ChannelLayout reverse_layout)); |
Michael Graczyk | 86c6d33 | 2015-07-23 11:41:39 -0700 | [diff] [blame] | 53 | WEBRTC_STUB(Initialize, ( |
| 54 | const webrtc::ProcessingConfig& processing_config)); |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 55 | |
| 56 | WEBRTC_VOID_FUNC(SetExtraOptions, (const webrtc::Config& config)) { |
| 57 | experimental_ns_enabled_ = config.Get<webrtc::ExperimentalNs>().enabled; |
| 58 | } |
| 59 | |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 60 | WEBRTC_STUB_CONST(proc_sample_rate_hz, ()); |
| 61 | WEBRTC_STUB_CONST(proc_split_sample_rate_hz, ()); |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 62 | size_t num_input_channels() const override { return 0; } |
| 63 | size_t num_proc_channels() const override { return 0; } |
| 64 | size_t num_output_channels() const override { return 0; } |
| 65 | size_t num_reverse_channels() const override { return 0; } |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 66 | WEBRTC_VOID_STUB(set_output_will_be_muted, (bool muted)); |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 67 | WEBRTC_STUB(ProcessStream, (webrtc::AudioFrame* frame)); |
| 68 | WEBRTC_STUB(ProcessStream, ( |
| 69 | const float* const* src, |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 70 | size_t samples_per_channel, |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 71 | int input_sample_rate_hz, |
| 72 | webrtc::AudioProcessing::ChannelLayout input_layout, |
| 73 | int output_sample_rate_hz, |
| 74 | webrtc::AudioProcessing::ChannelLayout output_layout, |
| 75 | float* const* dest)); |
Michael Graczyk | 86c6d33 | 2015-07-23 11:41:39 -0700 | [diff] [blame] | 76 | WEBRTC_STUB(ProcessStream, |
| 77 | (const float* const* src, |
| 78 | const webrtc::StreamConfig& input_config, |
| 79 | const webrtc::StreamConfig& output_config, |
| 80 | float* const* dest)); |
ekmeyerson | 60d9b33 | 2015-08-14 10:35:55 -0700 | [diff] [blame] | 81 | WEBRTC_STUB(ProcessReverseStream, (webrtc::AudioFrame * frame)); |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 82 | WEBRTC_STUB(AnalyzeReverseStream, ( |
| 83 | const float* const* data, |
Peter Kasting | dce40cf | 2015-08-24 14:52:23 -0700 | [diff] [blame] | 84 | size_t samples_per_channel, |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 85 | int sample_rate_hz, |
| 86 | webrtc::AudioProcessing::ChannelLayout layout)); |
ekmeyerson | 60d9b33 | 2015-08-14 10:35:55 -0700 | [diff] [blame] | 87 | WEBRTC_STUB(ProcessReverseStream, |
| 88 | (const float* const* src, |
| 89 | const webrtc::StreamConfig& reverse_input_config, |
| 90 | const webrtc::StreamConfig& reverse_output_config, |
| 91 | float* const* dest)); |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 92 | WEBRTC_STUB(set_stream_delay_ms, (int delay)); |
| 93 | WEBRTC_STUB_CONST(stream_delay_ms, ()); |
| 94 | WEBRTC_BOOL_STUB_CONST(was_stream_delay_set, ()); |
| 95 | WEBRTC_VOID_STUB(set_stream_key_pressed, (bool key_pressed)); |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 96 | WEBRTC_VOID_STUB(set_delay_offset_ms, (int offset)); |
| 97 | WEBRTC_STUB_CONST(delay_offset_ms, ()); |
ivoc | d66b44d | 2016-01-15 03:06:36 -0800 | [diff] [blame] | 98 | WEBRTC_STUB(StartDebugRecording, |
| 99 | (const char filename[kMaxFilenameSize], int64_t max_size_bytes)); |
| 100 | WEBRTC_STUB(StartDebugRecording, (FILE * handle, int64_t max_size_bytes)); |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 101 | WEBRTC_STUB(StopDebugRecording, ()); |
Bjorn Volcker | 4e7aa43 | 2015-07-07 11:50:05 +0200 | [diff] [blame] | 102 | WEBRTC_VOID_STUB(UpdateHistogramsOnCallEnd, ()); |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 103 | webrtc::EchoCancellation* echo_cancellation() const override { return NULL; } |
| 104 | webrtc::EchoControlMobile* echo_control_mobile() const override { |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 105 | return NULL; |
| 106 | } |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 107 | webrtc::GainControl* gain_control() const override { return NULL; } |
| 108 | webrtc::HighPassFilter* high_pass_filter() const override { return NULL; } |
| 109 | webrtc::LevelEstimator* level_estimator() const override { return NULL; } |
| 110 | webrtc::NoiseSuppression* noise_suppression() const override { return NULL; } |
| 111 | webrtc::VoiceDetection* voice_detection() const override { return NULL; } |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 112 | |
| 113 | bool experimental_ns_enabled() { |
| 114 | return experimental_ns_enabled_; |
| 115 | } |
| 116 | |
| 117 | private: |
| 118 | bool experimental_ns_enabled_; |
| 119 | }; |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 120 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 121 | class FakeWebRtcVoiceEngine |
| 122 | : public webrtc::VoEAudioProcessing, |
Fredrik Solenberg | b572768 | 2015-12-04 15:22:19 +0100 | [diff] [blame] | 123 | public webrtc::VoEBase, public webrtc::VoECodec, |
solenberg | 4a0f7b5 | 2016-06-16 13:07:33 -0700 | [diff] [blame] | 124 | public webrtc::VoEHardware, |
Fredrik Solenberg | 4f4ec0a | 2015-10-22 10:49:27 +0200 | [diff] [blame] | 125 | public webrtc::VoEVolumeControl { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 126 | public: |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 127 | struct Channel { |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 128 | Channel() { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 129 | memset(&send_codec, 0, sizeof(send_codec)); |
| 130 | } |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 131 | bool playout = false; |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 132 | bool vad = false; |
| 133 | bool codec_fec = false; |
| 134 | int max_encoding_bandwidth = 0; |
| 135 | bool opus_dtx = false; |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 136 | int cn8_type = 13; |
| 137 | int cn16_type = 105; |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 138 | int associate_send_channel = -1; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 139 | std::vector<webrtc::CodecInst> recv_codecs; |
| 140 | webrtc::CodecInst send_codec; |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 141 | int neteq_capacity = -1; |
| 142 | bool neteq_fast_accelerate = false; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 143 | }; |
| 144 | |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 145 | FakeWebRtcVoiceEngine() { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 146 | memset(&agc_config_, 0, sizeof(agc_config_)); |
| 147 | } |
solenberg | ff97631 | 2016-03-30 23:28:51 -0700 | [diff] [blame] | 148 | ~FakeWebRtcVoiceEngine() override { |
solenberg | 26c8c91 | 2015-11-27 04:00:25 -0800 | [diff] [blame] | 149 | RTC_CHECK(channels_.empty()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 150 | } |
| 151 | |
solenberg | 85a0496 | 2015-10-27 03:35:21 -0700 | [diff] [blame] | 152 | bool ec_metrics_enabled() const { return ec_metrics_enabled_; } |
| 153 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 154 | bool IsInited() const { return inited_; } |
| 155 | int GetLastChannel() const { return last_channel_; } |
wu@webrtc.org | 9caf276 | 2013-12-11 18:25:07 +0000 | [diff] [blame] | 156 | int GetNumChannels() const { return static_cast<int>(channels_.size()); } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 157 | bool GetPlayout(int channel) { |
| 158 | return channels_[channel]->playout; |
| 159 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 160 | bool GetVAD(int channel) { |
| 161 | return channels_[channel]->vad; |
| 162 | } |
Minyue Li | 7100dcd | 2015-03-27 05:05:59 +0100 | [diff] [blame] | 163 | bool GetOpusDtx(int channel) { |
| 164 | return channels_[channel]->opus_dtx; |
| 165 | } |
buildbot@webrtc.org | ae740dd | 2014-06-17 10:56:41 +0000 | [diff] [blame] | 166 | bool GetCodecFEC(int channel) { |
| 167 | return channels_[channel]->codec_fec; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 168 | } |
buildbot@webrtc.org | 5d639b3 | 2014-09-10 07:57:12 +0000 | [diff] [blame] | 169 | int GetMaxEncodingBandwidth(int channel) { |
| 170 | return channels_[channel]->max_encoding_bandwidth; |
| 171 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 172 | int GetSendCNPayloadType(int channel, bool wideband) { |
| 173 | return (wideband) ? |
| 174 | channels_[channel]->cn16_type : |
| 175 | channels_[channel]->cn8_type; |
| 176 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 177 | void set_playout_fail_channel(int channel) { |
| 178 | playout_fail_channel_ = channel; |
| 179 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 180 | void set_fail_create_channel(bool fail_create_channel) { |
| 181 | fail_create_channel_ = fail_create_channel; |
| 182 | } |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 183 | int AddChannel(const webrtc::Config& config) { |
wu@webrtc.org | 364f204 | 2013-11-20 21:49:41 +0000 | [diff] [blame] | 184 | if (fail_create_channel_) { |
| 185 | return -1; |
| 186 | } |
buildbot@webrtc.org | af6640f | 2014-04-28 21:31:51 +0000 | [diff] [blame] | 187 | Channel* ch = new Channel(); |
solenberg | 26c8c91 | 2015-11-27 04:00:25 -0800 | [diff] [blame] | 188 | auto db = webrtc::acm2::RentACodec::Database(); |
| 189 | ch->recv_codecs.assign(db.begin(), db.end()); |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 190 | if (config.Get<webrtc::NetEqCapacityConfig>().enabled) { |
| 191 | ch->neteq_capacity = config.Get<webrtc::NetEqCapacityConfig>().capacity; |
| 192 | } |
Henrik Lundin | 5263b3c | 2015-06-01 10:29:41 +0200 | [diff] [blame] | 193 | ch->neteq_fast_accelerate = |
| 194 | config.Get<webrtc::NetEqFastAccelerate>().enabled; |
wu@webrtc.org | 364f204 | 2013-11-20 21:49:41 +0000 | [diff] [blame] | 195 | channels_[++last_channel_] = ch; |
| 196 | return last_channel_; |
| 197 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 198 | |
wu@webrtc.org | 05e7b44 | 2014-04-01 17:44:24 +0000 | [diff] [blame] | 199 | int GetNumSetSendCodecs() const { return num_set_send_codecs_; } |
| 200 | |
Minyue | 2013aec | 2015-05-13 14:14:42 +0200 | [diff] [blame] | 201 | int GetAssociateSendChannel(int channel) { |
| 202 | return channels_[channel]->associate_send_channel; |
| 203 | } |
| 204 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 205 | WEBRTC_STUB(Release, ()); |
| 206 | |
| 207 | // webrtc::VoEBase |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 208 | WEBRTC_STUB(RegisterVoiceEngineObserver, ( |
| 209 | webrtc::VoiceEngineObserver& observer)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 210 | WEBRTC_STUB(DeRegisterVoiceEngineObserver, ()); |
ossu | 5f7cfa5 | 2016-05-30 08:11:28 -0700 | [diff] [blame] | 211 | WEBRTC_FUNC(Init, |
| 212 | (webrtc::AudioDeviceModule* adm, |
| 213 | webrtc::AudioProcessing* audioproc, |
| 214 | const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& |
| 215 | decoder_factory)) { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 216 | inited_ = true; |
| 217 | return 0; |
| 218 | } |
| 219 | WEBRTC_FUNC(Terminate, ()) { |
| 220 | inited_ = false; |
| 221 | return 0; |
| 222 | } |
kjellander@webrtc.org | 14665ff | 2015-03-04 12:58:35 +0000 | [diff] [blame] | 223 | webrtc::AudioProcessing* audio_processing() override { |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 224 | return &audio_processing_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 225 | } |
solenberg | ff97631 | 2016-03-30 23:28:51 -0700 | [diff] [blame] | 226 | webrtc::AudioDeviceModule* audio_device_module() override { |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 227 | return nullptr; |
solenberg | ff97631 | 2016-03-30 23:28:51 -0700 | [diff] [blame] | 228 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 229 | WEBRTC_FUNC(CreateChannel, ()) { |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 230 | webrtc::Config empty_config; |
| 231 | return AddChannel(empty_config); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 232 | } |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 233 | WEBRTC_FUNC(CreateChannel, (const webrtc::Config& config)) { |
| 234 | return AddChannel(config); |
wu@webrtc.org | 364f204 | 2013-11-20 21:49:41 +0000 | [diff] [blame] | 235 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 236 | WEBRTC_FUNC(DeleteChannel, (int channel)) { |
| 237 | WEBRTC_CHECK_CHANNEL(channel); |
Minyue | 2013aec | 2015-05-13 14:14:42 +0200 | [diff] [blame] | 238 | for (const auto& ch : channels_) { |
| 239 | if (ch.second->associate_send_channel == channel) { |
| 240 | ch.second->associate_send_channel = -1; |
| 241 | } |
| 242 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 243 | delete channels_[channel]; |
| 244 | channels_.erase(channel); |
| 245 | return 0; |
| 246 | } |
| 247 | WEBRTC_STUB(StartReceive, (int channel)); |
| 248 | WEBRTC_FUNC(StartPlayout, (int channel)) { |
| 249 | if (playout_fail_channel_ != channel) { |
| 250 | WEBRTC_CHECK_CHANNEL(channel); |
| 251 | channels_[channel]->playout = true; |
| 252 | return 0; |
| 253 | } else { |
| 254 | // When playout_fail_channel_ == channel, fail the StartPlayout on this |
| 255 | // channel. |
| 256 | return -1; |
| 257 | } |
| 258 | } |
Taylor Brandstetter | 1a018dc | 2016-03-08 12:37:39 -0800 | [diff] [blame] | 259 | WEBRTC_STUB(StartSend, (int channel)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 260 | WEBRTC_STUB(StopReceive, (int channel)); |
| 261 | WEBRTC_FUNC(StopPlayout, (int channel)) { |
| 262 | WEBRTC_CHECK_CHANNEL(channel); |
| 263 | channels_[channel]->playout = false; |
| 264 | return 0; |
| 265 | } |
Taylor Brandstetter | 1a018dc | 2016-03-08 12:37:39 -0800 | [diff] [blame] | 266 | WEBRTC_STUB(StopSend, (int channel)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 267 | WEBRTC_STUB(GetVersion, (char version[1024])); |
| 268 | WEBRTC_STUB(LastError, ()); |
Minyue | 2013aec | 2015-05-13 14:14:42 +0200 | [diff] [blame] | 269 | WEBRTC_FUNC(AssociateSendChannel, (int channel, |
| 270 | int accociate_send_channel)) { |
| 271 | WEBRTC_CHECK_CHANNEL(channel); |
| 272 | channels_[channel]->associate_send_channel = accociate_send_channel; |
| 273 | return 0; |
| 274 | } |
ivoc | 9e03c3b | 2016-06-30 00:59:43 -0700 | [diff] [blame^] | 275 | webrtc::RtcEventLog* GetEventLog() override { return nullptr; } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 276 | |
| 277 | // webrtc::VoECodec |
solenberg | 26c8c91 | 2015-11-27 04:00:25 -0800 | [diff] [blame] | 278 | WEBRTC_STUB(NumOfCodecs, ()); |
| 279 | WEBRTC_STUB(GetCodec, (int index, webrtc::CodecInst& codec)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 280 | WEBRTC_FUNC(SetSendCodec, (int channel, const webrtc::CodecInst& codec)) { |
| 281 | WEBRTC_CHECK_CHANNEL(channel); |
henrike@webrtc.org | 704bf9e | 2014-02-27 17:52:04 +0000 | [diff] [blame] | 282 | // To match the behavior of the real implementation. |
| 283 | if (_stricmp(codec.plname, "telephone-event") == 0 || |
| 284 | _stricmp(codec.plname, "audio/telephone-event") == 0 || |
| 285 | _stricmp(codec.plname, "CN") == 0 || |
kwiberg | 6806136 | 2016-06-14 08:04:47 -0700 | [diff] [blame] | 286 | _stricmp(codec.plname, "red") == 0) { |
henrike@webrtc.org | 704bf9e | 2014-02-27 17:52:04 +0000 | [diff] [blame] | 287 | return -1; |
| 288 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 289 | channels_[channel]->send_codec = codec; |
wu@webrtc.org | 05e7b44 | 2014-04-01 17:44:24 +0000 | [diff] [blame] | 290 | ++num_set_send_codecs_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 291 | return 0; |
| 292 | } |
| 293 | WEBRTC_FUNC(GetSendCodec, (int channel, webrtc::CodecInst& codec)) { |
| 294 | WEBRTC_CHECK_CHANNEL(channel); |
| 295 | codec = channels_[channel]->send_codec; |
| 296 | return 0; |
| 297 | } |
Ivo Creusen | adf89b7 | 2015-04-29 16:03:33 +0200 | [diff] [blame] | 298 | WEBRTC_STUB(SetBitRate, (int channel, int bitrate_bps)); |
Fredrik Solenberg | 4f4ec0a | 2015-10-22 10:49:27 +0200 | [diff] [blame] | 299 | WEBRTC_STUB(GetRecCodec, (int channel, webrtc::CodecInst& codec)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 300 | WEBRTC_FUNC(SetRecPayloadType, (int channel, |
| 301 | const webrtc::CodecInst& codec)) { |
| 302 | WEBRTC_CHECK_CHANNEL(channel); |
| 303 | Channel* ch = channels_[channel]; |
| 304 | if (ch->playout) |
| 305 | return -1; // Channel is in use. |
| 306 | // Check if something else already has this slot. |
| 307 | if (codec.pltype != -1) { |
| 308 | for (std::vector<webrtc::CodecInst>::iterator it = |
| 309 | ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) { |
| 310 | if (it->pltype == codec.pltype && |
| 311 | _stricmp(it->plname, codec.plname) != 0) { |
| 312 | return -1; |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | // Otherwise try to find this codec and update its payload type. |
solenberg | 26c8c91 | 2015-11-27 04:00:25 -0800 | [diff] [blame] | 317 | int result = -1; // not found |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 318 | for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin(); |
| 319 | it != ch->recv_codecs.end(); ++it) { |
| 320 | if (strcmp(it->plname, codec.plname) == 0 && |
solenberg | 26c8c91 | 2015-11-27 04:00:25 -0800 | [diff] [blame] | 321 | it->plfreq == codec.plfreq && |
| 322 | it->channels == codec.channels) { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 323 | it->pltype = codec.pltype; |
solenberg | 26c8c91 | 2015-11-27 04:00:25 -0800 | [diff] [blame] | 324 | result = 0; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 325 | } |
| 326 | } |
solenberg | 26c8c91 | 2015-11-27 04:00:25 -0800 | [diff] [blame] | 327 | return result; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 328 | } |
| 329 | WEBRTC_FUNC(SetSendCNPayloadType, (int channel, int type, |
| 330 | webrtc::PayloadFrequencies frequency)) { |
| 331 | WEBRTC_CHECK_CHANNEL(channel); |
| 332 | if (frequency == webrtc::kFreq8000Hz) { |
| 333 | channels_[channel]->cn8_type = type; |
| 334 | } else if (frequency == webrtc::kFreq16000Hz) { |
| 335 | channels_[channel]->cn16_type = type; |
| 336 | } |
| 337 | return 0; |
| 338 | } |
| 339 | WEBRTC_FUNC(GetRecPayloadType, (int channel, webrtc::CodecInst& codec)) { |
| 340 | WEBRTC_CHECK_CHANNEL(channel); |
| 341 | Channel* ch = channels_[channel]; |
| 342 | for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin(); |
| 343 | it != ch->recv_codecs.end(); ++it) { |
| 344 | if (strcmp(it->plname, codec.plname) == 0 && |
| 345 | it->plfreq == codec.plfreq && |
| 346 | it->channels == codec.channels && |
| 347 | it->pltype != -1) { |
| 348 | codec.pltype = it->pltype; |
| 349 | return 0; |
| 350 | } |
| 351 | } |
| 352 | return -1; // not found |
| 353 | } |
| 354 | WEBRTC_FUNC(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode, |
| 355 | bool disableDTX)) { |
| 356 | WEBRTC_CHECK_CHANNEL(channel); |
| 357 | if (channels_[channel]->send_codec.channels == 2) { |
| 358 | // Replicating VoE behavior; VAD cannot be enabled for stereo. |
| 359 | return -1; |
| 360 | } |
| 361 | channels_[channel]->vad = enable; |
| 362 | return 0; |
| 363 | } |
| 364 | WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled, |
| 365 | webrtc::VadModes& mode, bool& disabledDTX)); |
buildbot@webrtc.org | 5d639b3 | 2014-09-10 07:57:12 +0000 | [diff] [blame] | 366 | |
buildbot@webrtc.org | ae740dd | 2014-06-17 10:56:41 +0000 | [diff] [blame] | 367 | WEBRTC_FUNC(SetFECStatus, (int channel, bool enable)) { |
| 368 | WEBRTC_CHECK_CHANNEL(channel); |
buildbot@webrtc.org | 5d639b3 | 2014-09-10 07:57:12 +0000 | [diff] [blame] | 369 | if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) { |
buildbot@webrtc.org | 3ffa1f9 | 2014-07-02 19:51:26 +0000 | [diff] [blame] | 370 | // Return -1 if current send codec is not Opus. |
| 371 | // TODO(minyue): Excludes other codecs if they support inband FEC. |
| 372 | return -1; |
| 373 | } |
buildbot@webrtc.org | ae740dd | 2014-06-17 10:56:41 +0000 | [diff] [blame] | 374 | channels_[channel]->codec_fec = enable; |
| 375 | return 0; |
| 376 | } |
| 377 | WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable)) { |
| 378 | WEBRTC_CHECK_CHANNEL(channel); |
| 379 | enable = channels_[channel]->codec_fec; |
| 380 | return 0; |
| 381 | } |
buildbot@webrtc.org | 5d639b3 | 2014-09-10 07:57:12 +0000 | [diff] [blame] | 382 | |
| 383 | WEBRTC_FUNC(SetOpusMaxPlaybackRate, (int channel, int frequency_hz)) { |
| 384 | WEBRTC_CHECK_CHANNEL(channel); |
| 385 | if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) { |
| 386 | // Return -1 if current send codec is not Opus. |
| 387 | return -1; |
| 388 | } |
| 389 | if (frequency_hz <= 8000) |
| 390 | channels_[channel]->max_encoding_bandwidth = kOpusBandwidthNb; |
| 391 | else if (frequency_hz <= 12000) |
| 392 | channels_[channel]->max_encoding_bandwidth = kOpusBandwidthMb; |
| 393 | else if (frequency_hz <= 16000) |
| 394 | channels_[channel]->max_encoding_bandwidth = kOpusBandwidthWb; |
| 395 | else if (frequency_hz <= 24000) |
| 396 | channels_[channel]->max_encoding_bandwidth = kOpusBandwidthSwb; |
| 397 | else |
| 398 | channels_[channel]->max_encoding_bandwidth = kOpusBandwidthFb; |
| 399 | return 0; |
| 400 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 401 | |
minyue@webrtc.org | 9b2e114 | 2015-03-13 09:38:07 +0000 | [diff] [blame] | 402 | WEBRTC_FUNC(SetOpusDtx, (int channel, bool enable_dtx)) { |
| 403 | WEBRTC_CHECK_CHANNEL(channel); |
| 404 | if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) { |
| 405 | // Return -1 if current send codec is not Opus. |
| 406 | return -1; |
| 407 | } |
| 408 | channels_[channel]->opus_dtx = enable_dtx; |
| 409 | return 0; |
| 410 | } |
| 411 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 412 | // webrtc::VoEHardware |
solenberg | 246b817 | 2015-12-08 09:50:23 -0800 | [diff] [blame] | 413 | WEBRTC_STUB(GetNumOfRecordingDevices, (int& num)); |
| 414 | WEBRTC_STUB(GetNumOfPlayoutDevices, (int& num)); |
| 415 | WEBRTC_STUB(GetRecordingDeviceName, (int i, char* name, char* guid)); |
| 416 | WEBRTC_STUB(GetPlayoutDeviceName, (int i, char* name, char* guid)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 417 | WEBRTC_STUB(SetRecordingDevice, (int, webrtc::StereoChannel)); |
| 418 | WEBRTC_STUB(SetPlayoutDevice, (int)); |
| 419 | WEBRTC_STUB(SetAudioDeviceLayer, (webrtc::AudioLayers)); |
| 420 | WEBRTC_STUB(GetAudioDeviceLayer, (webrtc::AudioLayers&)); |
solenberg | 5b5129a | 2016-04-08 05:35:48 -0700 | [diff] [blame] | 421 | WEBRTC_STUB(SetRecordingSampleRate, (unsigned int samples_per_sec)); |
| 422 | WEBRTC_STUB_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)); |
| 423 | WEBRTC_STUB(SetPlayoutSampleRate, (unsigned int samples_per_sec)); |
| 424 | WEBRTC_STUB_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 425 | WEBRTC_STUB(EnableBuiltInAEC, (bool enable)); |
nisse | ef8b61e | 2016-04-29 06:09:15 -0700 | [diff] [blame] | 426 | bool BuiltInAECIsAvailable() const override { return false; } |
henrika | c14f5ff | 2015-09-23 14:08:33 +0200 | [diff] [blame] | 427 | WEBRTC_STUB(EnableBuiltInAGC, (bool enable)); |
nisse | ef8b61e | 2016-04-29 06:09:15 -0700 | [diff] [blame] | 428 | bool BuiltInAGCIsAvailable() const override { return false; } |
henrika | c14f5ff | 2015-09-23 14:08:33 +0200 | [diff] [blame] | 429 | WEBRTC_STUB(EnableBuiltInNS, (bool enable)); |
nisse | ef8b61e | 2016-04-29 06:09:15 -0700 | [diff] [blame] | 430 | bool BuiltInNSIsAvailable() const override { return false; } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 431 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 432 | // webrtc::VoEVolumeControl |
| 433 | WEBRTC_STUB(SetSpeakerVolume, (unsigned int)); |
| 434 | WEBRTC_STUB(GetSpeakerVolume, (unsigned int&)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 435 | WEBRTC_STUB(SetMicVolume, (unsigned int)); |
| 436 | WEBRTC_STUB(GetMicVolume, (unsigned int&)); |
| 437 | WEBRTC_STUB(SetInputMute, (int, bool)); |
| 438 | WEBRTC_STUB(GetInputMute, (int, bool&)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 439 | WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&)); |
| 440 | WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&)); |
| 441 | WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&)); |
| 442 | WEBRTC_STUB(GetSpeechOutputLevelFullRange, (int, unsigned int&)); |
solenberg | 217fb66 | 2016-06-17 08:30:54 -0700 | [diff] [blame] | 443 | WEBRTC_STUB(SetChannelOutputVolumeScaling, (int channel, float scale)); |
| 444 | WEBRTC_STUB(GetChannelOutputVolumeScaling, (int channel, float& scale)); |
solenberg | 4bac9c5 | 2015-10-09 02:32:53 -0700 | [diff] [blame] | 445 | WEBRTC_STUB(SetOutputVolumePan, (int channel, float left, float right)); |
| 446 | WEBRTC_STUB(GetOutputVolumePan, (int channel, float& left, float& right)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 447 | |
| 448 | // webrtc::VoEAudioProcessing |
| 449 | WEBRTC_FUNC(SetNsStatus, (bool enable, webrtc::NsModes mode)) { |
| 450 | ns_enabled_ = enable; |
| 451 | ns_mode_ = mode; |
| 452 | return 0; |
| 453 | } |
| 454 | WEBRTC_FUNC(GetNsStatus, (bool& enabled, webrtc::NsModes& mode)) { |
| 455 | enabled = ns_enabled_; |
| 456 | mode = ns_mode_; |
| 457 | return 0; |
| 458 | } |
| 459 | |
| 460 | WEBRTC_FUNC(SetAgcStatus, (bool enable, webrtc::AgcModes mode)) { |
| 461 | agc_enabled_ = enable; |
| 462 | agc_mode_ = mode; |
| 463 | return 0; |
| 464 | } |
| 465 | WEBRTC_FUNC(GetAgcStatus, (bool& enabled, webrtc::AgcModes& mode)) { |
| 466 | enabled = agc_enabled_; |
| 467 | mode = agc_mode_; |
| 468 | return 0; |
| 469 | } |
| 470 | |
| 471 | WEBRTC_FUNC(SetAgcConfig, (webrtc::AgcConfig config)) { |
| 472 | agc_config_ = config; |
| 473 | return 0; |
| 474 | } |
| 475 | WEBRTC_FUNC(GetAgcConfig, (webrtc::AgcConfig& config)) { |
| 476 | config = agc_config_; |
| 477 | return 0; |
| 478 | } |
| 479 | WEBRTC_FUNC(SetEcStatus, (bool enable, webrtc::EcModes mode)) { |
| 480 | ec_enabled_ = enable; |
| 481 | ec_mode_ = mode; |
| 482 | return 0; |
| 483 | } |
| 484 | WEBRTC_FUNC(GetEcStatus, (bool& enabled, webrtc::EcModes& mode)) { |
| 485 | enabled = ec_enabled_; |
| 486 | mode = ec_mode_; |
| 487 | return 0; |
| 488 | } |
| 489 | WEBRTC_STUB(EnableDriftCompensation, (bool enable)) |
| 490 | WEBRTC_BOOL_STUB(DriftCompensationEnabled, ()) |
| 491 | WEBRTC_VOID_STUB(SetDelayOffsetMs, (int offset)) |
| 492 | WEBRTC_STUB(DelayOffsetMs, ()); |
| 493 | WEBRTC_FUNC(SetAecmMode, (webrtc::AecmModes mode, bool enableCNG)) { |
| 494 | aecm_mode_ = mode; |
| 495 | cng_enabled_ = enableCNG; |
| 496 | return 0; |
| 497 | } |
| 498 | WEBRTC_FUNC(GetAecmMode, (webrtc::AecmModes& mode, bool& enabledCNG)) { |
| 499 | mode = aecm_mode_; |
| 500 | enabledCNG = cng_enabled_; |
| 501 | return 0; |
| 502 | } |
| 503 | WEBRTC_STUB(SetRxNsStatus, (int channel, bool enable, webrtc::NsModes mode)); |
| 504 | WEBRTC_STUB(GetRxNsStatus, (int channel, bool& enabled, |
| 505 | webrtc::NsModes& mode)); |
solenberg | 0b67546 | 2015-10-09 01:37:09 -0700 | [diff] [blame] | 506 | WEBRTC_STUB(SetRxAgcStatus, (int channel, bool enable, |
| 507 | webrtc::AgcModes mode)); |
| 508 | WEBRTC_STUB(GetRxAgcStatus, (int channel, bool& enabled, |
| 509 | webrtc::AgcModes& mode)); |
| 510 | WEBRTC_STUB(SetRxAgcConfig, (int channel, webrtc::AgcConfig config)); |
| 511 | WEBRTC_STUB(GetRxAgcConfig, (int channel, webrtc::AgcConfig& config)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 512 | |
| 513 | WEBRTC_STUB(RegisterRxVadObserver, (int, webrtc::VoERxVadCallback&)); |
| 514 | WEBRTC_STUB(DeRegisterRxVadObserver, (int channel)); |
| 515 | WEBRTC_STUB(VoiceActivityIndicator, (int channel)); |
| 516 | WEBRTC_FUNC(SetEcMetricsStatus, (bool enable)) { |
| 517 | ec_metrics_enabled_ = enable; |
| 518 | return 0; |
| 519 | } |
solenberg | 85a0496 | 2015-10-27 03:35:21 -0700 | [diff] [blame] | 520 | WEBRTC_STUB(GetEcMetricsStatus, (bool& enabled)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 521 | WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP)); |
bjornv@webrtc.org | cc64a9c | 2015-02-05 12:52:44 +0000 | [diff] [blame] | 522 | WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std, |
| 523 | float& fraction_poor_delays)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 524 | |
| 525 | WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8)); |
wu@webrtc.org | 9caf276 | 2013-12-11 18:25:07 +0000 | [diff] [blame] | 526 | WEBRTC_STUB(StartDebugRecording, (FILE* handle)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 527 | WEBRTC_STUB(StopDebugRecording, ()); |
| 528 | |
| 529 | WEBRTC_FUNC(SetTypingDetectionStatus, (bool enable)) { |
| 530 | typing_detection_enabled_ = enable; |
| 531 | return 0; |
| 532 | } |
| 533 | WEBRTC_FUNC(GetTypingDetectionStatus, (bool& enabled)) { |
| 534 | enabled = typing_detection_enabled_; |
| 535 | return 0; |
| 536 | } |
| 537 | |
| 538 | WEBRTC_STUB(TimeSinceLastTyping, (int& seconds)); |
| 539 | WEBRTC_STUB(SetTypingDetectionParameters, (int timeWindow, |
| 540 | int costPerTyping, |
| 541 | int reportingThreshold, |
| 542 | int penaltyDecay, |
| 543 | int typeEventDelay)); |
nisse | ef8b61e | 2016-04-29 06:09:15 -0700 | [diff] [blame] | 544 | int EnableHighPassFilter(bool enable) override { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 545 | highpass_filter_enabled_ = enable; |
| 546 | return 0; |
| 547 | } |
nisse | ef8b61e | 2016-04-29 06:09:15 -0700 | [diff] [blame] | 548 | bool IsHighPassFilterEnabled() override { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 549 | return highpass_filter_enabled_; |
| 550 | } |
nisse | ef8b61e | 2016-04-29 06:09:15 -0700 | [diff] [blame] | 551 | bool IsStereoChannelSwappingEnabled() override { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 552 | return stereo_swapping_enabled_; |
| 553 | } |
nisse | ef8b61e | 2016-04-29 06:09:15 -0700 | [diff] [blame] | 554 | void EnableStereoChannelSwapping(bool enable) override { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 555 | stereo_swapping_enabled_ = enable; |
| 556 | } |
Henrik Lundin | 64dad83 | 2015-05-11 12:44:23 +0200 | [diff] [blame] | 557 | int GetNetEqCapacity() const { |
| 558 | auto ch = channels_.find(last_channel_); |
| 559 | ASSERT(ch != channels_.end()); |
| 560 | return ch->second->neteq_capacity; |
| 561 | } |
Henrik Lundin | 5263b3c | 2015-06-01 10:29:41 +0200 | [diff] [blame] | 562 | bool GetNetEqFastAccelerate() const { |
| 563 | auto ch = channels_.find(last_channel_); |
| 564 | ASSERT(ch != channels_.end()); |
| 565 | return ch->second->neteq_fast_accelerate; |
| 566 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 567 | |
| 568 | private: |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 569 | bool inited_ = false; |
| 570 | int last_channel_ = -1; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 571 | std::map<int, Channel*> channels_; |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 572 | bool fail_create_channel_ = false; |
| 573 | int num_set_send_codecs_ = 0; // how many times we call SetSendCodec(). |
| 574 | bool ec_enabled_ = false; |
| 575 | bool ec_metrics_enabled_ = false; |
| 576 | bool cng_enabled_ = false; |
| 577 | bool ns_enabled_ = false; |
| 578 | bool agc_enabled_ = false; |
| 579 | bool highpass_filter_enabled_ = false; |
| 580 | bool stereo_swapping_enabled_ = false; |
| 581 | bool typing_detection_enabled_ = false; |
| 582 | webrtc::EcModes ec_mode_ = webrtc::kEcDefault; |
| 583 | webrtc::AecmModes aecm_mode_ = webrtc::kAecmSpeakerphone; |
| 584 | webrtc::NsModes ns_mode_ = webrtc::kNsDefault; |
| 585 | webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 586 | webrtc::AgcConfig agc_config_; |
solenberg | bc37fc8 | 2016-04-04 09:54:44 -0700 | [diff] [blame] | 587 | int playout_fail_channel_ = -1; |
buildbot@webrtc.org | a8d8ad2 | 2014-07-16 14:23:08 +0000 | [diff] [blame] | 588 | FakeAudioProcessing audio_processing_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 589 | }; |
| 590 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 591 | } // namespace cricket |
| 592 | |
kjellander@webrtc.org | 5ad1297 | 2016-02-12 06:39:40 +0100 | [diff] [blame] | 593 | #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |