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, | 124 public webrtc::VoEHardware, public webrtc::VoERTP_RTCP, |
125 public webrtc::VoENetwork, public webrtc::VoERTP_RTCP, | |
126 public webrtc::VoEVolumeControl { | 125 public webrtc::VoEVolumeControl { |
127 public: | 126 public: |
128 struct Channel { | 127 struct Channel { |
129 Channel() { | 128 Channel() { |
130 memset(&send_codec, 0, sizeof(send_codec)); | 129 memset(&send_codec, 0, sizeof(send_codec)); |
131 } | 130 } |
132 bool external_transport = false; | |
133 bool playout = false; | 131 bool playout = false; |
134 float volume_scale = 1.0f; | 132 float volume_scale = 1.0f; |
135 bool vad = false; | 133 bool vad = false; |
136 bool codec_fec = false; | 134 bool codec_fec = false; |
137 int max_encoding_bandwidth = 0; | 135 int max_encoding_bandwidth = 0; |
138 bool opus_dtx = false; | 136 bool opus_dtx = false; |
139 bool red = false; | 137 bool red = false; |
140 bool nack = false; | 138 bool nack = false; |
141 int cn8_type = 13; | 139 int cn8_type = 13; |
142 int cn16_type = 105; | 140 int cn16_type = 105; |
143 int red_type = 117; | 141 int red_type = 117; |
144 int nack_max_packets = 0; | 142 int nack_max_packets = 0; |
145 uint32_t send_ssrc = 0; | 143 uint32_t send_ssrc = 0; |
146 int associate_send_channel = -1; | 144 int associate_send_channel = -1; |
147 std::vector<webrtc::CodecInst> recv_codecs; | 145 std::vector<webrtc::CodecInst> recv_codecs; |
148 webrtc::CodecInst send_codec; | 146 webrtc::CodecInst send_codec; |
149 webrtc::PacketTime last_rtp_packet_time; | |
150 std::list<std::string> packets; | |
151 int neteq_capacity = -1; | 147 int neteq_capacity = -1; |
152 bool neteq_fast_accelerate = false; | 148 bool neteq_fast_accelerate = false; |
153 }; | 149 }; |
154 | 150 |
155 FakeWebRtcVoiceEngine() { | 151 FakeWebRtcVoiceEngine() { |
156 memset(&agc_config_, 0, sizeof(agc_config_)); | 152 memset(&agc_config_, 0, sizeof(agc_config_)); |
157 } | 153 } |
158 ~FakeWebRtcVoiceEngine() override { | 154 ~FakeWebRtcVoiceEngine() override { |
159 RTC_CHECK(channels_.empty()); | 155 RTC_CHECK(channels_.empty()); |
160 } | 156 } |
(...skipping 23 matching lines...) Expand all Loading... |
184 } | 180 } |
185 int GetMaxEncodingBandwidth(int channel) { | 181 int GetMaxEncodingBandwidth(int channel) { |
186 return channels_[channel]->max_encoding_bandwidth; | 182 return channels_[channel]->max_encoding_bandwidth; |
187 } | 183 } |
188 bool GetNACK(int channel) { | 184 bool GetNACK(int channel) { |
189 return channels_[channel]->nack; | 185 return channels_[channel]->nack; |
190 } | 186 } |
191 int GetNACKMaxPackets(int channel) { | 187 int GetNACKMaxPackets(int channel) { |
192 return channels_[channel]->nack_max_packets; | 188 return channels_[channel]->nack_max_packets; |
193 } | 189 } |
194 const webrtc::PacketTime& GetLastRtpPacketTime(int channel) { | |
195 RTC_DCHECK(channels_.find(channel) != channels_.end()); | |
196 return channels_[channel]->last_rtp_packet_time; | |
197 } | |
198 int GetSendCNPayloadType(int channel, bool wideband) { | 190 int GetSendCNPayloadType(int channel, bool wideband) { |
199 return (wideband) ? | 191 return (wideband) ? |
200 channels_[channel]->cn16_type : | 192 channels_[channel]->cn16_type : |
201 channels_[channel]->cn8_type; | 193 channels_[channel]->cn8_type; |
202 } | 194 } |
203 int GetSendREDPayloadType(int channel) { | 195 int GetSendREDPayloadType(int channel) { |
204 return channels_[channel]->red_type; | 196 return channels_[channel]->red_type; |
205 } | 197 } |
206 void set_playout_fail_channel(int channel) { | 198 void set_playout_fail_channel(int channel) { |
207 playout_fail_channel_ = channel; | 199 playout_fail_channel_ = channel; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 WEBRTC_STUB_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)); | 440 WEBRTC_STUB_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)); |
449 WEBRTC_STUB(SetPlayoutSampleRate, (unsigned int samples_per_sec)); | 441 WEBRTC_STUB(SetPlayoutSampleRate, (unsigned int samples_per_sec)); |
450 WEBRTC_STUB_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)); | 442 WEBRTC_STUB_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)); |
451 WEBRTC_STUB(EnableBuiltInAEC, (bool enable)); | 443 WEBRTC_STUB(EnableBuiltInAEC, (bool enable)); |
452 virtual bool BuiltInAECIsAvailable() const { return false; } | 444 virtual bool BuiltInAECIsAvailable() const { return false; } |
453 WEBRTC_STUB(EnableBuiltInAGC, (bool enable)); | 445 WEBRTC_STUB(EnableBuiltInAGC, (bool enable)); |
454 virtual bool BuiltInAGCIsAvailable() const { return false; } | 446 virtual bool BuiltInAGCIsAvailable() const { return false; } |
455 WEBRTC_STUB(EnableBuiltInNS, (bool enable)); | 447 WEBRTC_STUB(EnableBuiltInNS, (bool enable)); |
456 virtual bool BuiltInNSIsAvailable() const { return false; } | 448 virtual bool BuiltInNSIsAvailable() const { return false; } |
457 | 449 |
458 // webrtc::VoENetwork | |
459 WEBRTC_FUNC(RegisterExternalTransport, (int channel, | |
460 webrtc::Transport& transport)) { | |
461 WEBRTC_CHECK_CHANNEL(channel); | |
462 channels_[channel]->external_transport = true; | |
463 return 0; | |
464 } | |
465 WEBRTC_FUNC(DeRegisterExternalTransport, (int channel)) { | |
466 WEBRTC_CHECK_CHANNEL(channel); | |
467 channels_[channel]->external_transport = false; | |
468 return 0; | |
469 } | |
470 WEBRTC_FUNC(ReceivedRTPPacket, (int channel, const void* data, | |
471 size_t length)) { | |
472 WEBRTC_CHECK_CHANNEL(channel); | |
473 if (!channels_[channel]->external_transport) return -1; | |
474 channels_[channel]->packets.push_back( | |
475 std::string(static_cast<const char*>(data), length)); | |
476 return 0; | |
477 } | |
478 WEBRTC_FUNC(ReceivedRTPPacket, (int channel, const void* data, | |
479 size_t length, | |
480 const webrtc::PacketTime& packet_time)) { | |
481 WEBRTC_CHECK_CHANNEL(channel); | |
482 if (ReceivedRTPPacket(channel, data, length) == -1) { | |
483 return -1; | |
484 } | |
485 channels_[channel]->last_rtp_packet_time = packet_time; | |
486 return 0; | |
487 } | |
488 | |
489 WEBRTC_STUB(ReceivedRTCPPacket, (int channel, const void* data, | |
490 size_t length)); | |
491 | |
492 // webrtc::VoERTP_RTCP | 450 // webrtc::VoERTP_RTCP |
493 WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) { | 451 WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) { |
494 WEBRTC_CHECK_CHANNEL(channel); | 452 WEBRTC_CHECK_CHANNEL(channel); |
495 channels_[channel]->send_ssrc = ssrc; | 453 channels_[channel]->send_ssrc = ssrc; |
496 return 0; | 454 return 0; |
497 } | 455 } |
498 WEBRTC_STUB(GetLocalSSRC, (int channel, unsigned int& ssrc)); | 456 WEBRTC_STUB(GetLocalSSRC, (int channel, unsigned int& ssrc)); |
499 WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc)); | 457 WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc)); |
500 WEBRTC_STUB(SetSendAudioLevelIndicationStatus, (int channel, bool enable, | 458 WEBRTC_STUB(SetSendAudioLevelIndicationStatus, (int channel, bool enable, |
501 unsigned char id)); | 459 unsigned char id)); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 webrtc::NsModes ns_mode_ = webrtc::kNsDefault; | 662 webrtc::NsModes ns_mode_ = webrtc::kNsDefault; |
705 webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault; | 663 webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault; |
706 webrtc::AgcConfig agc_config_; | 664 webrtc::AgcConfig agc_config_; |
707 int playout_fail_channel_ = -1; | 665 int playout_fail_channel_ = -1; |
708 FakeAudioProcessing audio_processing_; | 666 FakeAudioProcessing audio_processing_; |
709 }; | 667 }; |
710 | 668 |
711 } // namespace cricket | 669 } // namespace cricket |
712 | 670 |
713 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ | 671 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |
OLD | NEW |