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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return experimental_ns_enabled_; | 114 return experimental_ns_enabled_; |
115 } | 115 } |
116 | 116 |
117 private: | 117 private: |
118 bool experimental_ns_enabled_; | 118 bool experimental_ns_enabled_; |
119 }; | 119 }; |
120 | 120 |
121 class FakeWebRtcVoiceEngine | 121 class FakeWebRtcVoiceEngine |
122 : public webrtc::VoEAudioProcessing, | 122 : public webrtc::VoEAudioProcessing, |
123 public webrtc::VoEBase, public webrtc::VoECodec, | 123 public webrtc::VoEBase, public webrtc::VoECodec, |
124 public webrtc::VoEHardware, public webrtc::VoERTP_RTCP, | 124 public webrtc::VoEHardware, |
125 public webrtc::VoEVolumeControl { | 125 public webrtc::VoEVolumeControl { |
126 public: | 126 public: |
127 struct Channel { | 127 struct Channel { |
128 Channel() { | 128 Channel() { |
129 memset(&send_codec, 0, sizeof(send_codec)); | 129 memset(&send_codec, 0, sizeof(send_codec)); |
130 } | 130 } |
131 bool playout = false; | 131 bool playout = false; |
132 float volume_scale = 1.0f; | 132 float volume_scale = 1.0f; |
133 bool vad = false; | 133 bool vad = false; |
134 bool codec_fec = false; | 134 bool codec_fec = false; |
135 int max_encoding_bandwidth = 0; | 135 int max_encoding_bandwidth = 0; |
136 bool opus_dtx = false; | 136 bool opus_dtx = false; |
137 int cn8_type = 13; | 137 int cn8_type = 13; |
138 int cn16_type = 105; | 138 int cn16_type = 105; |
139 uint32_t send_ssrc = 0; | |
140 int associate_send_channel = -1; | 139 int associate_send_channel = -1; |
141 std::vector<webrtc::CodecInst> recv_codecs; | 140 std::vector<webrtc::CodecInst> recv_codecs; |
142 webrtc::CodecInst send_codec; | 141 webrtc::CodecInst send_codec; |
143 int neteq_capacity = -1; | 142 int neteq_capacity = -1; |
144 bool neteq_fast_accelerate = false; | 143 bool neteq_fast_accelerate = false; |
145 }; | 144 }; |
146 | 145 |
147 FakeWebRtcVoiceEngine() { | 146 FakeWebRtcVoiceEngine() { |
148 memset(&agc_config_, 0, sizeof(agc_config_)); | 147 memset(&agc_config_, 0, sizeof(agc_config_)); |
149 } | 148 } |
150 ~FakeWebRtcVoiceEngine() override { | 149 ~FakeWebRtcVoiceEngine() override { |
151 RTC_CHECK(channels_.empty()); | 150 RTC_CHECK(channels_.empty()); |
152 } | 151 } |
153 | 152 |
154 bool ec_metrics_enabled() const { return ec_metrics_enabled_; } | 153 bool ec_metrics_enabled() const { return ec_metrics_enabled_; } |
155 | 154 |
156 bool IsInited() const { return inited_; } | 155 bool IsInited() const { return inited_; } |
157 int GetLastChannel() const { return last_channel_; } | 156 int GetLastChannel() const { return last_channel_; } |
158 int GetNumChannels() const { return static_cast<int>(channels_.size()); } | 157 int GetNumChannels() const { return static_cast<int>(channels_.size()); } |
159 uint32_t GetLocalSSRC(int channel) { | |
160 return channels_[channel]->send_ssrc; | |
161 } | |
162 bool GetPlayout(int channel) { | 158 bool GetPlayout(int channel) { |
163 return channels_[channel]->playout; | 159 return channels_[channel]->playout; |
164 } | 160 } |
165 bool GetVAD(int channel) { | 161 bool GetVAD(int channel) { |
166 return channels_[channel]->vad; | 162 return channels_[channel]->vad; |
167 } | 163 } |
168 bool GetOpusDtx(int channel) { | 164 bool GetOpusDtx(int channel) { |
169 return channels_[channel]->opus_dtx; | 165 return channels_[channel]->opus_dtx; |
170 } | 166 } |
171 bool GetCodecFEC(int channel) { | 167 bool GetCodecFEC(int channel) { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 WEBRTC_STUB_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)); | 423 WEBRTC_STUB_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)); |
428 WEBRTC_STUB(SetPlayoutSampleRate, (unsigned int samples_per_sec)); | 424 WEBRTC_STUB(SetPlayoutSampleRate, (unsigned int samples_per_sec)); |
429 WEBRTC_STUB_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)); | 425 WEBRTC_STUB_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)); |
430 WEBRTC_STUB(EnableBuiltInAEC, (bool enable)); | 426 WEBRTC_STUB(EnableBuiltInAEC, (bool enable)); |
431 bool BuiltInAECIsAvailable() const override { return false; } | 427 bool BuiltInAECIsAvailable() const override { return false; } |
432 WEBRTC_STUB(EnableBuiltInAGC, (bool enable)); | 428 WEBRTC_STUB(EnableBuiltInAGC, (bool enable)); |
433 bool BuiltInAGCIsAvailable() const override { return false; } | 429 bool BuiltInAGCIsAvailable() const override { return false; } |
434 WEBRTC_STUB(EnableBuiltInNS, (bool enable)); | 430 WEBRTC_STUB(EnableBuiltInNS, (bool enable)); |
435 bool BuiltInNSIsAvailable() const override { return false; } | 431 bool BuiltInNSIsAvailable() const override { return false; } |
436 | 432 |
437 // webrtc::VoERTP_RTCP | |
438 WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) { | |
439 WEBRTC_CHECK_CHANNEL(channel); | |
440 channels_[channel]->send_ssrc = ssrc; | |
441 return 0; | |
442 } | |
443 WEBRTC_STUB(GetLocalSSRC, (int channel, unsigned int& ssrc)); | |
444 WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc)); | |
445 WEBRTC_STUB(SetSendAudioLevelIndicationStatus, (int channel, bool enable, | |
446 unsigned char id)); | |
447 WEBRTC_STUB(SetReceiveAudioLevelIndicationStatus, (int channel, bool enable, | |
448 unsigned char id)); | |
449 WEBRTC_STUB(SetSendAbsoluteSenderTimeStatus, (int channel, bool enable, | |
450 unsigned char id)); | |
451 WEBRTC_STUB(SetReceiveAbsoluteSenderTimeStatus, (int channel, bool enable, | |
452 unsigned char id)); | |
453 WEBRTC_STUB(SetRTCPStatus, (int channel, bool enable)); | |
454 WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled)); | |
455 WEBRTC_STUB(SetRTCP_CNAME, (int channel, const char cname[256])); | |
456 WEBRTC_STUB(GetRTCP_CNAME, (int channel, char cname[256])); | |
457 WEBRTC_STUB(GetRemoteRTCP_CNAME, (int channel, char* cname)); | |
458 WEBRTC_STUB(GetRemoteRTCPData, (int channel, unsigned int& NTPHigh, | |
459 unsigned int& NTPLow, | |
460 unsigned int& timestamp, | |
461 unsigned int& playoutTimestamp, | |
462 unsigned int* jitter, | |
463 unsigned short* fractionLost)); | |
464 WEBRTC_STUB(GetRemoteRTCPReportBlocks, | |
465 (int channel, std::vector<webrtc::ReportBlock>* receive_blocks)); | |
466 WEBRTC_STUB(GetRTPStatistics, (int channel, unsigned int& averageJitterMs, | |
467 unsigned int& maxJitterMs, | |
468 unsigned int& discardedPackets)); | |
469 WEBRTC_STUB(GetRTCPStatistics, (int channel, webrtc::CallStatistics& stats)); | |
470 WEBRTC_STUB(SetREDStatus, (int channel, bool enable, int redPayloadtype)); | |
471 WEBRTC_STUB(GetREDStatus, (int channel, bool& enable, int& redPayloadtype)); | |
472 WEBRTC_STUB(SetNACKStatus, (int channel, bool enable, int maxNoPackets)); | |
473 | |
474 // webrtc::VoEVolumeControl | 433 // webrtc::VoEVolumeControl |
475 WEBRTC_STUB(SetSpeakerVolume, (unsigned int)); | 434 WEBRTC_STUB(SetSpeakerVolume, (unsigned int)); |
476 WEBRTC_STUB(GetSpeakerVolume, (unsigned int&)); | 435 WEBRTC_STUB(GetSpeakerVolume, (unsigned int&)); |
477 WEBRTC_STUB(SetMicVolume, (unsigned int)); | 436 WEBRTC_STUB(SetMicVolume, (unsigned int)); |
478 WEBRTC_STUB(GetMicVolume, (unsigned int&)); | 437 WEBRTC_STUB(GetMicVolume, (unsigned int&)); |
479 WEBRTC_STUB(SetInputMute, (int, bool)); | 438 WEBRTC_STUB(SetInputMute, (int, bool)); |
480 WEBRTC_STUB(GetInputMute, (int, bool&)); | 439 WEBRTC_STUB(GetInputMute, (int, bool&)); |
481 WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&)); | 440 WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&)); |
482 WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&)); | 441 WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&)); |
483 WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&)); | 442 WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&)); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 webrtc::NsModes ns_mode_ = webrtc::kNsDefault; | 593 webrtc::NsModes ns_mode_ = webrtc::kNsDefault; |
635 webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault; | 594 webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault; |
636 webrtc::AgcConfig agc_config_; | 595 webrtc::AgcConfig agc_config_; |
637 int playout_fail_channel_ = -1; | 596 int playout_fail_channel_ = -1; |
638 FakeAudioProcessing audio_processing_; | 597 FakeAudioProcessing audio_processing_; |
639 }; | 598 }; |
640 | 599 |
641 } // namespace cricket | 600 } // namespace cricket |
642 | 601 |
643 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ | 602 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |
OLD | NEW |