| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 #define WEBRTC_BOOL_STUB(method, args) \ | 53 #define WEBRTC_BOOL_STUB(method, args) \ |
| 54 bool method args override { return true; } | 54 bool method args override { return true; } |
| 55 | 55 |
| 56 #define WEBRTC_VOID_STUB(method, args) \ | 56 #define WEBRTC_VOID_STUB(method, args) \ |
| 57 void method args override {} | 57 void method args override {} |
| 58 | 58 |
| 59 #define WEBRTC_FUNC(method, args) int method args override | 59 #define WEBRTC_FUNC(method, args) int method args override |
| 60 | 60 |
| 61 class FakeWebRtcVoiceEngine | 61 class FakeWebRtcVoiceEngine |
| 62 : public webrtc::VoEBase, public webrtc::VoECodec, | 62 : public webrtc::VoEBase, public webrtc::VoECodec { |
| 63 public webrtc::VoEHardware { | |
| 64 public: | 63 public: |
| 65 struct Channel { | 64 struct Channel { |
| 66 std::vector<webrtc::CodecInst> recv_codecs; | 65 std::vector<webrtc::CodecInst> recv_codecs; |
| 67 size_t neteq_capacity = 0; | 66 size_t neteq_capacity = 0; |
| 68 bool neteq_fast_accelerate = false; | 67 bool neteq_fast_accelerate = false; |
| 69 }; | 68 }; |
| 70 | 69 |
| 71 explicit FakeWebRtcVoiceEngine(webrtc::AudioProcessing* apm, | 70 explicit FakeWebRtcVoiceEngine(webrtc::AudioProcessing* apm, |
| 72 webrtc::voe::TransmitMixer* transmit_mixer) | 71 webrtc::voe::TransmitMixer* transmit_mixer) |
| 73 : apm_(apm), transmit_mixer_(transmit_mixer) { | 72 : apm_(apm), transmit_mixer_(transmit_mixer) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 195 } |
| 197 WEBRTC_STUB(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode, | 196 WEBRTC_STUB(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode, |
| 198 bool disableDTX)); | 197 bool disableDTX)); |
| 199 WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled, | 198 WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled, |
| 200 webrtc::VadModes& mode, bool& disabledDTX)); | 199 webrtc::VadModes& mode, bool& disabledDTX)); |
| 201 WEBRTC_STUB(SetFECStatus, (int channel, bool enable)); | 200 WEBRTC_STUB(SetFECStatus, (int channel, bool enable)); |
| 202 WEBRTC_STUB(GetFECStatus, (int channel, bool& enable)); | 201 WEBRTC_STUB(GetFECStatus, (int channel, bool& enable)); |
| 203 WEBRTC_STUB(SetOpusMaxPlaybackRate, (int channel, int frequency_hz)); | 202 WEBRTC_STUB(SetOpusMaxPlaybackRate, (int channel, int frequency_hz)); |
| 204 WEBRTC_STUB(SetOpusDtx, (int channel, bool enable_dtx)); | 203 WEBRTC_STUB(SetOpusDtx, (int channel, bool enable_dtx)); |
| 205 | 204 |
| 206 // webrtc::VoEHardware | |
| 207 WEBRTC_STUB(GetNumOfRecordingDevices, (int& num)); | |
| 208 WEBRTC_STUB(GetNumOfPlayoutDevices, (int& num)); | |
| 209 WEBRTC_STUB(GetRecordingDeviceName, (int i, char* name, char* guid)); | |
| 210 WEBRTC_STUB(GetPlayoutDeviceName, (int i, char* name, char* guid)); | |
| 211 WEBRTC_STUB(SetRecordingDevice, (int, webrtc::StereoChannel)); | |
| 212 WEBRTC_STUB(SetPlayoutDevice, (int)); | |
| 213 WEBRTC_STUB(SetAudioDeviceLayer, (webrtc::AudioLayers)); | |
| 214 WEBRTC_STUB(GetAudioDeviceLayer, (webrtc::AudioLayers&)); | |
| 215 WEBRTC_STUB(SetRecordingSampleRate, (unsigned int samples_per_sec)); | |
| 216 WEBRTC_STUB_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)); | |
| 217 WEBRTC_STUB(SetPlayoutSampleRate, (unsigned int samples_per_sec)); | |
| 218 WEBRTC_STUB_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)); | |
| 219 WEBRTC_STUB(EnableBuiltInAEC, (bool enable)); | |
| 220 bool BuiltInAECIsAvailable() const override { return false; } | |
| 221 WEBRTC_STUB(EnableBuiltInAGC, (bool enable)); | |
| 222 bool BuiltInAGCIsAvailable() const override { return false; } | |
| 223 WEBRTC_STUB(EnableBuiltInNS, (bool enable)); | |
| 224 bool BuiltInNSIsAvailable() const override { return false; } | |
| 225 | |
| 226 size_t GetNetEqCapacity() const { | 205 size_t GetNetEqCapacity() const { |
| 227 auto ch = channels_.find(last_channel_); | 206 auto ch = channels_.find(last_channel_); |
| 228 RTC_DCHECK(ch != channels_.end()); | 207 RTC_DCHECK(ch != channels_.end()); |
| 229 return ch->second->neteq_capacity; | 208 return ch->second->neteq_capacity; |
| 230 } | 209 } |
| 231 bool GetNetEqFastAccelerate() const { | 210 bool GetNetEqFastAccelerate() const { |
| 232 auto ch = channels_.find(last_channel_); | 211 auto ch = channels_.find(last_channel_); |
| 233 RTC_CHECK(ch != channels_.end()); | 212 RTC_CHECK(ch != channels_.end()); |
| 234 return ch->second->neteq_fast_accelerate; | 213 return ch->second->neteq_fast_accelerate; |
| 235 } | 214 } |
| 236 | 215 |
| 237 private: | 216 private: |
| 238 bool inited_ = false; | 217 bool inited_ = false; |
| 239 int last_channel_ = -1; | 218 int last_channel_ = -1; |
| 240 std::map<int, Channel*> channels_; | 219 std::map<int, Channel*> channels_; |
| 241 bool fail_create_channel_ = false; | 220 bool fail_create_channel_ = false; |
| 242 webrtc::AudioProcessing* apm_ = nullptr; | 221 webrtc::AudioProcessing* apm_ = nullptr; |
| 243 webrtc::voe::TransmitMixer* transmit_mixer_ = nullptr; | 222 webrtc::voe::TransmitMixer* transmit_mixer_ = nullptr; |
| 244 | 223 |
| 245 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FakeWebRtcVoiceEngine); | 224 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FakeWebRtcVoiceEngine); |
| 246 }; | 225 }; |
| 247 | 226 |
| 248 } // namespace cricket | 227 } // namespace cricket |
| 249 | 228 |
| 250 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ | 229 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |
| OLD | NEW |