OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 #include "webrtc/base/checks.h" | 10 #include "webrtc/base/checks.h" |
11 #include "webrtc/common.h" | 11 #include "webrtc/common.h" |
12 #include "webrtc/config.h" | 12 #include "webrtc/config.h" |
| 13 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" |
13 #include "webrtc/test/call_test.h" | 14 #include "webrtc/test/call_test.h" |
14 #include "webrtc/test/encoder_settings.h" | 15 #include "webrtc/test/encoder_settings.h" |
15 #include "webrtc/test/testsupport/fileutils.h" | 16 #include "webrtc/test/testsupport/fileutils.h" |
16 #include "webrtc/voice_engine/include/voe_base.h" | 17 #include "webrtc/voice_engine/include/voe_base.h" |
17 #include "webrtc/voice_engine/include/voe_codec.h" | 18 #include "webrtc/voice_engine/include/voe_codec.h" |
18 | 19 |
19 namespace webrtc { | 20 namespace webrtc { |
20 namespace test { | 21 namespace test { |
21 | 22 |
22 namespace { | 23 namespace { |
23 const int kVideoRotationRtpExtensionId = 4; | 24 const int kVideoRotationRtpExtensionId = 4; |
24 } | 25 } |
25 | 26 |
26 CallTest::CallTest() | 27 CallTest::CallTest() |
27 : clock_(Clock::GetRealTimeClock()), | 28 : clock_(Clock::GetRealTimeClock()), |
28 video_send_config_(nullptr), | 29 video_send_config_(nullptr), |
29 video_send_stream_(nullptr), | 30 video_send_stream_(nullptr), |
30 audio_send_config_(nullptr), | 31 audio_send_config_(nullptr), |
31 audio_send_stream_(nullptr), | 32 audio_send_stream_(nullptr), |
32 fake_encoder_(clock_), | 33 fake_encoder_(clock_), |
33 num_video_streams_(1), | 34 num_video_streams_(1), |
34 num_audio_streams_(0), | 35 num_audio_streams_(0), |
| 36 decoder_factory_(CreateBuiltinAudioDecoderFactory()), |
35 fake_send_audio_device_(nullptr), | 37 fake_send_audio_device_(nullptr), |
36 fake_recv_audio_device_(nullptr) {} | 38 fake_recv_audio_device_(nullptr) {} |
37 | 39 |
38 CallTest::~CallTest() { | 40 CallTest::~CallTest() { |
39 } | 41 } |
40 | 42 |
41 void CallTest::RunBaseTest(BaseTest* test) { | 43 void CallTest::RunBaseTest(BaseTest* test) { |
42 num_video_streams_ = test->GetNumVideoStreams(); | 44 num_video_streams_ = test->GetNumVideoStreams(); |
43 num_audio_streams_ = test->GetNumAudioStreams(); | 45 num_audio_streams_ = test->GetNumAudioStreams(); |
44 RTC_DCHECK(num_video_streams_ > 0 || num_audio_streams_ > 0); | 46 RTC_DCHECK(num_video_streams_ > 0 || num_audio_streams_ > 0); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 224 } |
223 | 225 |
224 RTC_DCHECK(num_audio_streams_ <= 1); | 226 RTC_DCHECK(num_audio_streams_ <= 1); |
225 if (num_audio_streams_ == 1) { | 227 if (num_audio_streams_ == 1) { |
226 RTC_DCHECK(voe_send_.channel_id >= 0); | 228 RTC_DCHECK(voe_send_.channel_id >= 0); |
227 AudioReceiveStream::Config audio_config; | 229 AudioReceiveStream::Config audio_config; |
228 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; | 230 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; |
229 audio_config.rtcp_send_transport = rtcp_send_transport; | 231 audio_config.rtcp_send_transport = rtcp_send_transport; |
230 audio_config.voe_channel_id = voe_recv_.channel_id; | 232 audio_config.voe_channel_id = voe_recv_.channel_id; |
231 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; | 233 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; |
| 234 audio_config.decoder_factory = decoder_factory_; |
232 audio_receive_configs_.push_back(audio_config); | 235 audio_receive_configs_.push_back(audio_config); |
233 } | 236 } |
234 } | 237 } |
235 | 238 |
236 void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock, | 239 void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock, |
237 float speed) { | 240 float speed) { |
238 VideoStream stream = video_encoder_config_.streams.back(); | 241 VideoStream stream = video_encoder_config_.streams.back(); |
239 frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create( | 242 frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create( |
240 video_send_stream_->Input(), stream.width, stream.height, | 243 video_send_stream_->Input(), stream.width, stream.height, |
241 stream.max_framerate * speed, clock)); | 244 stream.max_framerate * speed, clock)); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 video_receive_streams_.clear(); | 303 video_receive_streams_.clear(); |
301 | 304 |
302 allocated_decoders_.clear(); | 305 allocated_decoders_.clear(); |
303 } | 306 } |
304 | 307 |
305 void CallTest::CreateVoiceEngines() { | 308 void CallTest::CreateVoiceEngines() { |
306 CreateFakeAudioDevices(); | 309 CreateFakeAudioDevices(); |
307 voe_send_.voice_engine = VoiceEngine::Create(); | 310 voe_send_.voice_engine = VoiceEngine::Create(); |
308 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); | 311 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); |
309 voe_send_.codec = VoECodec::GetInterface(voe_send_.voice_engine); | 312 voe_send_.codec = VoECodec::GetInterface(voe_send_.voice_engine); |
310 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr)); | 313 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr, |
| 314 decoder_factory_)); |
311 Config voe_config; | 315 Config voe_config; |
312 voe_config.Set<VoicePacing>(new VoicePacing(true)); | 316 voe_config.Set<VoicePacing>(new VoicePacing(true)); |
313 voe_send_.channel_id = voe_send_.base->CreateChannel(voe_config); | 317 voe_send_.channel_id = voe_send_.base->CreateChannel(voe_config); |
314 EXPECT_GE(voe_send_.channel_id, 0); | 318 EXPECT_GE(voe_send_.channel_id, 0); |
315 | 319 |
316 voe_recv_.voice_engine = VoiceEngine::Create(); | 320 voe_recv_.voice_engine = VoiceEngine::Create(); |
317 voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine); | 321 voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine); |
318 voe_recv_.codec = VoECodec::GetInterface(voe_recv_.voice_engine); | 322 voe_recv_.codec = VoECodec::GetInterface(voe_recv_.voice_engine); |
319 EXPECT_EQ(0, voe_recv_.base->Init(fake_recv_audio_device_.get(), nullptr)); | 323 EXPECT_EQ(0, voe_recv_.base->Init(fake_recv_audio_device_.get(), nullptr, |
| 324 decoder_factory_)); |
320 voe_recv_.channel_id = voe_recv_.base->CreateChannel(); | 325 voe_recv_.channel_id = voe_recv_.base->CreateChannel(); |
321 EXPECT_GE(voe_recv_.channel_id, 0); | 326 EXPECT_GE(voe_recv_.channel_id, 0); |
322 } | 327 } |
323 | 328 |
324 void CallTest::DestroyVoiceEngines() { | 329 void CallTest::DestroyVoiceEngines() { |
325 voe_recv_.base->DeleteChannel(voe_recv_.channel_id); | 330 voe_recv_.base->DeleteChannel(voe_recv_.channel_id); |
326 voe_recv_.channel_id = -1; | 331 voe_recv_.channel_id = -1; |
327 voe_recv_.base->Release(); | 332 voe_recv_.base->Release(); |
328 voe_recv_.base = nullptr; | 333 voe_recv_.base = nullptr; |
329 voe_recv_.codec->Release(); | 334 voe_recv_.codec->Release(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 430 |
426 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { | 431 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { |
427 } | 432 } |
428 | 433 |
429 bool EndToEndTest::ShouldCreateReceivers() const { | 434 bool EndToEndTest::ShouldCreateReceivers() const { |
430 return true; | 435 return true; |
431 } | 436 } |
432 | 437 |
433 } // namespace test | 438 } // namespace test |
434 } // namespace webrtc | 439 } // namespace webrtc |
OLD | NEW |