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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 63 public webrtc::VoEHardware { |
64 public webrtc::VoEVolumeControl { | |
65 public: | 64 public: |
66 struct Channel { | 65 struct Channel { |
67 std::vector<webrtc::CodecInst> recv_codecs; | 66 std::vector<webrtc::CodecInst> recv_codecs; |
68 size_t neteq_capacity = 0; | 67 size_t neteq_capacity = 0; |
69 bool neteq_fast_accelerate = false; | 68 bool neteq_fast_accelerate = false; |
70 }; | 69 }; |
71 | 70 |
72 explicit FakeWebRtcVoiceEngine(webrtc::AudioProcessing* apm, | 71 explicit FakeWebRtcVoiceEngine(webrtc::AudioProcessing* apm, |
73 webrtc::voe::TransmitMixer* transmit_mixer) | 72 webrtc::voe::TransmitMixer* transmit_mixer) |
74 : apm_(apm), transmit_mixer_(transmit_mixer) { | 73 : apm_(apm), transmit_mixer_(transmit_mixer) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 WEBRTC_STUB_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)); | 216 WEBRTC_STUB_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)); |
218 WEBRTC_STUB(SetPlayoutSampleRate, (unsigned int samples_per_sec)); | 217 WEBRTC_STUB(SetPlayoutSampleRate, (unsigned int samples_per_sec)); |
219 WEBRTC_STUB_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)); | 218 WEBRTC_STUB_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)); |
220 WEBRTC_STUB(EnableBuiltInAEC, (bool enable)); | 219 WEBRTC_STUB(EnableBuiltInAEC, (bool enable)); |
221 bool BuiltInAECIsAvailable() const override { return false; } | 220 bool BuiltInAECIsAvailable() const override { return false; } |
222 WEBRTC_STUB(EnableBuiltInAGC, (bool enable)); | 221 WEBRTC_STUB(EnableBuiltInAGC, (bool enable)); |
223 bool BuiltInAGCIsAvailable() const override { return false; } | 222 bool BuiltInAGCIsAvailable() const override { return false; } |
224 WEBRTC_STUB(EnableBuiltInNS, (bool enable)); | 223 WEBRTC_STUB(EnableBuiltInNS, (bool enable)); |
225 bool BuiltInNSIsAvailable() const override { return false; } | 224 bool BuiltInNSIsAvailable() const override { return false; } |
226 | 225 |
227 // webrtc::VoEVolumeControl | |
228 WEBRTC_STUB(SetSpeakerVolume, (unsigned int)); | |
229 WEBRTC_STUB(GetSpeakerVolume, (unsigned int&)); | |
230 WEBRTC_STUB(SetMicVolume, (unsigned int)); | |
231 WEBRTC_STUB(GetMicVolume, (unsigned int&)); | |
232 WEBRTC_STUB(SetInputMute, (int, bool)); | |
233 WEBRTC_STUB(GetInputMute, (int, bool&)); | |
234 WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&)); | |
235 WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&)); | |
236 WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&)); | |
237 WEBRTC_STUB(GetSpeechOutputLevelFullRange, (int, unsigned int&)); | |
238 WEBRTC_STUB(SetChannelOutputVolumeScaling, (int channel, float scale)); | |
239 WEBRTC_STUB(GetChannelOutputVolumeScaling, (int channel, float& scale)); | |
240 WEBRTC_STUB(SetOutputVolumePan, (int channel, float left, float right)); | |
241 WEBRTC_STUB(GetOutputVolumePan, (int channel, float& left, float& right)); | |
242 | |
243 size_t GetNetEqCapacity() const { | 226 size_t GetNetEqCapacity() const { |
244 auto ch = channels_.find(last_channel_); | 227 auto ch = channels_.find(last_channel_); |
245 RTC_DCHECK(ch != channels_.end()); | 228 RTC_DCHECK(ch != channels_.end()); |
246 return ch->second->neteq_capacity; | 229 return ch->second->neteq_capacity; |
247 } | 230 } |
248 bool GetNetEqFastAccelerate() const { | 231 bool GetNetEqFastAccelerate() const { |
249 auto ch = channels_.find(last_channel_); | 232 auto ch = channels_.find(last_channel_); |
250 RTC_CHECK(ch != channels_.end()); | 233 RTC_CHECK(ch != channels_.end()); |
251 return ch->second->neteq_fast_accelerate; | 234 return ch->second->neteq_fast_accelerate; |
252 } | 235 } |
253 | 236 |
254 private: | 237 private: |
255 bool inited_ = false; | 238 bool inited_ = false; |
256 int last_channel_ = -1; | 239 int last_channel_ = -1; |
257 std::map<int, Channel*> channels_; | 240 std::map<int, Channel*> channels_; |
258 bool fail_create_channel_ = false; | 241 bool fail_create_channel_ = false; |
259 webrtc::AudioProcessing* apm_ = nullptr; | 242 webrtc::AudioProcessing* apm_ = nullptr; |
260 webrtc::voe::TransmitMixer* transmit_mixer_ = nullptr; | 243 webrtc::voe::TransmitMixer* transmit_mixer_ = nullptr; |
261 | 244 |
262 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FakeWebRtcVoiceEngine); | 245 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(FakeWebRtcVoiceEngine); |
263 }; | 246 }; |
264 | 247 |
265 } // namespace cricket | 248 } // namespace cricket |
266 | 249 |
267 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ | 250 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |
OLD | NEW |