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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 } | 147 } |
148 bool vad = false; | 148 bool vad = false; |
149 bool codec_fec = false; | 149 bool codec_fec = false; |
150 int max_encoding_bandwidth = 0; | 150 int max_encoding_bandwidth = 0; |
151 bool opus_dtx = false; | 151 bool opus_dtx = false; |
152 int cn8_type = 13; | 152 int cn8_type = 13; |
153 int cn16_type = 105; | 153 int cn16_type = 105; |
154 int associate_send_channel = -1; | 154 int associate_send_channel = -1; |
155 std::vector<webrtc::CodecInst> recv_codecs; | 155 std::vector<webrtc::CodecInst> recv_codecs; |
156 webrtc::CodecInst send_codec; | 156 webrtc::CodecInst send_codec; |
157 int neteq_capacity = -1; | 157 size_t neteq_capacity = -1; |
tommi
2016/09/02 07:59:52
assigning a negative value to an unsigned type doe
kwiberg-webrtc
2016/09/02 08:05:51
Now, sing with me:
♪ rtc::Optional, rtc::Optiona
the sun
2016/09/02 08:54:40
In this context, setting it to zero will work fine
| |
158 bool neteq_fast_accelerate = false; | 158 bool neteq_fast_accelerate = false; |
159 }; | 159 }; |
160 | 160 |
161 FakeWebRtcVoiceEngine() { | 161 FakeWebRtcVoiceEngine() { |
162 memset(&agc_config_, 0, sizeof(agc_config_)); | 162 memset(&agc_config_, 0, sizeof(agc_config_)); |
163 } | 163 } |
164 ~FakeWebRtcVoiceEngine() override { | 164 ~FakeWebRtcVoiceEngine() override { |
165 RTC_CHECK(channels_.empty()); | 165 RTC_CHECK(channels_.empty()); |
166 } | 166 } |
167 | 167 |
(...skipping 15 matching lines...) Expand all Loading... | |
183 return channels_[channel]->max_encoding_bandwidth; | 183 return channels_[channel]->max_encoding_bandwidth; |
184 } | 184 } |
185 int GetSendCNPayloadType(int channel, bool wideband) { | 185 int GetSendCNPayloadType(int channel, bool wideband) { |
186 return (wideband) ? | 186 return (wideband) ? |
187 channels_[channel]->cn16_type : | 187 channels_[channel]->cn16_type : |
188 channels_[channel]->cn8_type; | 188 channels_[channel]->cn8_type; |
189 } | 189 } |
190 void set_fail_create_channel(bool fail_create_channel) { | 190 void set_fail_create_channel(bool fail_create_channel) { |
191 fail_create_channel_ = fail_create_channel; | 191 fail_create_channel_ = fail_create_channel; |
192 } | 192 } |
193 int AddChannel(const webrtc::Config& config) { | 193 int AddChannel(const webrtc::AudioCodingModule::Config& acm_config) { |
194 if (fail_create_channel_) { | 194 if (fail_create_channel_) { |
195 return -1; | 195 return -1; |
196 } | 196 } |
197 Channel* ch = new Channel(); | 197 Channel* ch = new Channel(); |
198 auto db = webrtc::acm2::RentACodec::Database(); | 198 auto db = webrtc::acm2::RentACodec::Database(); |
199 ch->recv_codecs.assign(db.begin(), db.end()); | 199 ch->recv_codecs.assign(db.begin(), db.end()); |
200 if (config.Get<webrtc::NetEqCapacityConfig>().enabled) { | 200 ch->neteq_capacity = acm_config.neteq_config.max_packets_in_buffer; |
201 ch->neteq_capacity = config.Get<webrtc::NetEqCapacityConfig>().capacity; | 201 ch->neteq_fast_accelerate = acm_config.neteq_config.enable_fast_accelerate; |
202 } | |
203 ch->neteq_fast_accelerate = | |
204 config.Get<webrtc::NetEqFastAccelerate>().enabled; | |
205 channels_[++last_channel_] = ch; | 202 channels_[++last_channel_] = ch; |
206 return last_channel_; | 203 return last_channel_; |
207 } | 204 } |
208 | 205 |
209 int GetNumSetSendCodecs() const { return num_set_send_codecs_; } | 206 int GetNumSetSendCodecs() const { return num_set_send_codecs_; } |
210 | 207 |
211 int GetAssociateSendChannel(int channel) { | 208 int GetAssociateSendChannel(int channel) { |
212 return channels_[channel]->associate_send_channel; | 209 return channels_[channel]->associate_send_channel; |
213 } | 210 } |
214 | 211 |
(...skipping 15 matching lines...) Expand all Loading... | |
230 inited_ = false; | 227 inited_ = false; |
231 return 0; | 228 return 0; |
232 } | 229 } |
233 webrtc::AudioProcessing* audio_processing() override { | 230 webrtc::AudioProcessing* audio_processing() override { |
234 return &audio_processing_; | 231 return &audio_processing_; |
235 } | 232 } |
236 webrtc::AudioDeviceModule* audio_device_module() override { | 233 webrtc::AudioDeviceModule* audio_device_module() override { |
237 return nullptr; | 234 return nullptr; |
238 } | 235 } |
239 WEBRTC_FUNC(CreateChannel, ()) { | 236 WEBRTC_FUNC(CreateChannel, ()) { |
240 webrtc::Config empty_config; | 237 return AddChannel(webrtc::AudioCodingModule::Config()); |
241 return AddChannel(empty_config); | |
242 } | 238 } |
243 WEBRTC_FUNC(CreateChannel, (const webrtc::Config& config)) { | 239 WEBRTC_FUNC(CreateChannel, |
244 return AddChannel(config); | 240 (const webrtc::AudioCodingModule::Config& acm_config)) { |
241 return AddChannel(acm_config); | |
245 } | 242 } |
246 WEBRTC_FUNC(DeleteChannel, (int channel)) { | 243 WEBRTC_FUNC(DeleteChannel, (int channel)) { |
247 WEBRTC_CHECK_CHANNEL(channel); | 244 WEBRTC_CHECK_CHANNEL(channel); |
248 for (const auto& ch : channels_) { | 245 for (const auto& ch : channels_) { |
249 if (ch.second->associate_send_channel == channel) { | 246 if (ch.second->associate_send_channel == channel) { |
250 ch.second->associate_send_channel = -1; | 247 ch.second->associate_send_channel = -1; |
251 } | 248 } |
252 } | 249 } |
253 delete channels_[channel]; | 250 delete channels_[channel]; |
254 channels_.erase(channel); | 251 channels_.erase(channel); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
540 } | 537 } |
541 bool IsHighPassFilterEnabled() override { | 538 bool IsHighPassFilterEnabled() override { |
542 return highpass_filter_enabled_; | 539 return highpass_filter_enabled_; |
543 } | 540 } |
544 bool IsStereoChannelSwappingEnabled() override { | 541 bool IsStereoChannelSwappingEnabled() override { |
545 return stereo_swapping_enabled_; | 542 return stereo_swapping_enabled_; |
546 } | 543 } |
547 void EnableStereoChannelSwapping(bool enable) override { | 544 void EnableStereoChannelSwapping(bool enable) override { |
548 stereo_swapping_enabled_ = enable; | 545 stereo_swapping_enabled_ = enable; |
549 } | 546 } |
550 int GetNetEqCapacity() const { | 547 size_t GetNetEqCapacity() const { |
551 auto ch = channels_.find(last_channel_); | 548 auto ch = channels_.find(last_channel_); |
552 ASSERT(ch != channels_.end()); | 549 ASSERT(ch != channels_.end()); |
553 return ch->second->neteq_capacity; | 550 return ch->second->neteq_capacity; |
554 } | 551 } |
555 bool GetNetEqFastAccelerate() const { | 552 bool GetNetEqFastAccelerate() const { |
556 auto ch = channels_.find(last_channel_); | 553 auto ch = channels_.find(last_channel_); |
557 ASSERT(ch != channels_.end()); | 554 ASSERT(ch != channels_.end()); |
558 return ch->second->neteq_fast_accelerate; | 555 return ch->second->neteq_fast_accelerate; |
559 } | 556 } |
560 | 557 |
(...skipping 15 matching lines...) Expand all Loading... | |
576 webrtc::AecmModes aecm_mode_ = webrtc::kAecmSpeakerphone; | 573 webrtc::AecmModes aecm_mode_ = webrtc::kAecmSpeakerphone; |
577 webrtc::NsModes ns_mode_ = webrtc::kNsDefault; | 574 webrtc::NsModes ns_mode_ = webrtc::kNsDefault; |
578 webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault; | 575 webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault; |
579 webrtc::AgcConfig agc_config_; | 576 webrtc::AgcConfig agc_config_; |
580 FakeAudioProcessing audio_processing_; | 577 FakeAudioProcessing audio_processing_; |
581 }; | 578 }; |
582 | 579 |
583 } // namespace cricket | 580 } // namespace cricket |
584 | 581 |
585 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ | 582 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ |
OLD | NEW |