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/config.h" | 11 #include "webrtc/config.h" |
12 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" | 12 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" |
13 #include "webrtc/test/call_test.h" | 13 #include "webrtc/test/call_test.h" |
| 14 #include "webrtc/test/encoder_settings.h" |
14 #include "webrtc/test/testsupport/fileutils.h" | 15 #include "webrtc/test/testsupport/fileutils.h" |
15 #include "webrtc/voice_engine/include/voe_base.h" | 16 #include "webrtc/voice_engine/include/voe_base.h" |
16 #include "webrtc/voice_engine/include/voe_codec.h" | 17 #include "webrtc/voice_engine/include/voe_codec.h" |
17 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 namespace test { | 20 namespace test { |
20 | 21 |
21 namespace { | 22 namespace { |
22 const int kVideoRotationRtpExtensionId = 4; | 23 const int kVideoRotationRtpExtensionId = 4; |
23 } | 24 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (num_video_streams_ > 0) { | 88 if (num_video_streams_ > 0) { |
88 CreateVideoStreams(); | 89 CreateVideoStreams(); |
89 test->OnVideoStreamsCreated(video_send_stream_, video_receive_streams_); | 90 test->OnVideoStreamsCreated(video_send_stream_, video_receive_streams_); |
90 } | 91 } |
91 if (num_audio_streams_ > 0) { | 92 if (num_audio_streams_ > 0) { |
92 CreateAudioStreams(); | 93 CreateAudioStreams(); |
93 test->OnAudioStreamsCreated(audio_send_stream_, audio_receive_streams_); | 94 test->OnAudioStreamsCreated(audio_send_stream_, audio_receive_streams_); |
94 } | 95 } |
95 | 96 |
96 if (num_video_streams_ > 0) { | 97 if (num_video_streams_ > 0) { |
97 int width = kDefaultWidth; | 98 CreateFrameGeneratorCapturer(); |
98 int height = kDefaultHeight; | |
99 int frame_rate = kDefaultFramerate; | |
100 test->ModifyVideoCaptureStartResolution(&width, &height, &frame_rate); | |
101 CreateFrameGeneratorCapturer(frame_rate, width, height); | |
102 test->OnFrameGeneratorCapturerCreated(frame_generator_capturer_.get()); | 99 test->OnFrameGeneratorCapturerCreated(frame_generator_capturer_.get()); |
103 } | 100 } |
104 | 101 |
105 Start(); | 102 Start(); |
106 test->PerformTest(); | 103 test->PerformTest(); |
107 send_transport_->StopSending(); | 104 send_transport_->StopSending(); |
108 receive_transport_->StopSending(); | 105 receive_transport_->StopSending(); |
109 Stop(); | 106 Stop(); |
110 | 107 |
111 DestroyStreams(); | 108 DestroyStreams(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 RTC_DCHECK_LE(num_audio_streams, 1u); | 179 RTC_DCHECK_LE(num_audio_streams, 1u); |
183 RTC_DCHECK(num_audio_streams == 0 || voe_send_.channel_id >= 0); | 180 RTC_DCHECK(num_audio_streams == 0 || voe_send_.channel_id >= 0); |
184 if (num_video_streams > 0) { | 181 if (num_video_streams > 0) { |
185 video_send_config_ = VideoSendStream::Config(send_transport); | 182 video_send_config_ = VideoSendStream::Config(send_transport); |
186 video_send_config_.encoder_settings.encoder = &fake_encoder_; | 183 video_send_config_.encoder_settings.encoder = &fake_encoder_; |
187 video_send_config_.encoder_settings.payload_name = "FAKE"; | 184 video_send_config_.encoder_settings.payload_name = "FAKE"; |
188 video_send_config_.encoder_settings.payload_type = | 185 video_send_config_.encoder_settings.payload_type = |
189 kFakeVideoSendPayloadType; | 186 kFakeVideoSendPayloadType; |
190 video_send_config_.rtp.extensions.push_back( | 187 video_send_config_.rtp.extensions.push_back( |
191 RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeExtensionId)); | 188 RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeExtensionId)); |
192 FillEncoderConfiguration(num_video_streams, &video_encoder_config_); | 189 video_encoder_config_.streams = test::CreateVideoStreams(num_video_streams); |
193 | |
194 for (size_t i = 0; i < num_video_streams; ++i) | 190 for (size_t i = 0; i < num_video_streams; ++i) |
195 video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[i]); | 191 video_send_config_.rtp.ssrcs.push_back(kVideoSendSsrcs[i]); |
196 video_send_config_.rtp.extensions.push_back(RtpExtension( | 192 video_send_config_.rtp.extensions.push_back(RtpExtension( |
197 RtpExtension::kVideoRotationUri, kVideoRotationRtpExtensionId)); | 193 RtpExtension::kVideoRotationUri, kVideoRotationRtpExtensionId)); |
198 } | 194 } |
199 | 195 |
200 if (num_audio_streams > 0) { | 196 if (num_audio_streams > 0) { |
201 audio_send_config_ = AudioSendStream::Config(send_transport); | 197 audio_send_config_ = AudioSendStream::Config(send_transport); |
202 audio_send_config_.voe_channel_id = voe_send_.channel_id; | 198 audio_send_config_.voe_channel_id = voe_send_.channel_id; |
203 audio_send_config_.rtp.ssrc = kAudioSendSsrc; | 199 audio_send_config_.rtp.ssrc = kAudioSendSsrc; |
(...skipping 29 matching lines...) Expand all Loading... |
233 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; | 229 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; |
234 audio_config.rtcp_send_transport = rtcp_send_transport; | 230 audio_config.rtcp_send_transport = rtcp_send_transport; |
235 audio_config.voe_channel_id = voe_recv_.channel_id; | 231 audio_config.voe_channel_id = voe_recv_.channel_id; |
236 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; | 232 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; |
237 audio_config.decoder_factory = decoder_factory_; | 233 audio_config.decoder_factory = decoder_factory_; |
238 audio_receive_configs_.push_back(audio_config); | 234 audio_receive_configs_.push_back(audio_config); |
239 } | 235 } |
240 } | 236 } |
241 | 237 |
242 void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock, | 238 void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock, |
243 float speed, | 239 float speed) { |
244 int framerate, | 240 VideoStream stream = video_encoder_config_.streams.back(); |
245 int width, | |
246 int height) { | |
247 frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create( | 241 frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create( |
248 width, height, framerate * speed, clock)); | 242 stream.width, stream.height, stream.max_framerate * speed, clock)); |
249 video_send_stream_->SetSource(frame_generator_capturer_.get()); | 243 video_send_stream_->SetSource(frame_generator_capturer_.get()); |
250 } | 244 } |
251 | 245 |
252 void CallTest::CreateFrameGeneratorCapturer(int framerate, | 246 void CallTest::CreateFrameGeneratorCapturer() { |
253 int width, | 247 VideoStream stream = video_encoder_config_.streams.back(); |
254 int height) { | 248 frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create( |
255 frame_generator_capturer_.reset( | 249 stream.width, stream.height, stream.max_framerate, clock_)); |
256 test::FrameGeneratorCapturer::Create(width, height, framerate, clock_)); | |
257 video_send_stream_->SetSource(frame_generator_capturer_.get()); | 250 video_send_stream_->SetSource(frame_generator_capturer_.get()); |
258 } | 251 } |
259 | 252 |
260 void CallTest::CreateFakeAudioDevices() { | 253 void CallTest::CreateFakeAudioDevices() { |
261 fake_send_audio_device_.reset(new FakeAudioDevice( | 254 fake_send_audio_device_.reset(new FakeAudioDevice( |
262 clock_, test::ResourcePath("voice_engine/audio_long16", "pcm"), | 255 clock_, test::ResourcePath("voice_engine/audio_long16", "pcm"), |
263 DriftingClock::kNoDrift)); | 256 DriftingClock::kNoDrift)); |
264 fake_recv_audio_device_.reset(new FakeAudioDevice( | 257 fake_recv_audio_device_.reset(new FakeAudioDevice( |
265 clock_, test::ResourcePath("voice_engine/audio_long16", "pcm"), | 258 clock_, test::ResourcePath("voice_engine/audio_long16", "pcm"), |
266 DriftingClock::kNoDrift)); | 259 DriftingClock::kNoDrift)); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 voe_send_.base = nullptr; | 339 voe_send_.base = nullptr; |
347 voe_send_.codec->Release(); | 340 voe_send_.codec->Release(); |
348 voe_send_.codec = nullptr; | 341 voe_send_.codec = nullptr; |
349 | 342 |
350 VoiceEngine::Delete(voe_send_.voice_engine); | 343 VoiceEngine::Delete(voe_send_.voice_engine); |
351 voe_send_.voice_engine = nullptr; | 344 voe_send_.voice_engine = nullptr; |
352 VoiceEngine::Delete(voe_recv_.voice_engine); | 345 VoiceEngine::Delete(voe_recv_.voice_engine); |
353 voe_recv_.voice_engine = nullptr; | 346 voe_recv_.voice_engine = nullptr; |
354 } | 347 } |
355 | 348 |
356 const int CallTest::kDefaultWidth; | |
357 const int CallTest::kDefaultHeight; | |
358 const int CallTest::kDefaultFramerate; | |
359 const int CallTest::kDefaultTimeoutMs = 30 * 1000; | 349 const int CallTest::kDefaultTimeoutMs = 30 * 1000; |
360 const int CallTest::kLongTimeoutMs = 120 * 1000; | 350 const int CallTest::kLongTimeoutMs = 120 * 1000; |
361 const uint8_t CallTest::kVideoSendPayloadType = 100; | 351 const uint8_t CallTest::kVideoSendPayloadType = 100; |
362 const uint8_t CallTest::kFakeVideoSendPayloadType = 125; | 352 const uint8_t CallTest::kFakeVideoSendPayloadType = 125; |
363 const uint8_t CallTest::kSendRtxPayloadType = 98; | 353 const uint8_t CallTest::kSendRtxPayloadType = 98; |
364 const uint8_t CallTest::kRedPayloadType = 118; | 354 const uint8_t CallTest::kRedPayloadType = 118; |
365 const uint8_t CallTest::kRtxRedPayloadType = 99; | 355 const uint8_t CallTest::kRtxRedPayloadType = 99; |
366 const uint8_t CallTest::kUlpfecPayloadType = 119; | 356 const uint8_t CallTest::kUlpfecPayloadType = 119; |
367 const uint8_t CallTest::kAudioSendPayloadType = 103; | 357 const uint8_t CallTest::kAudioSendPayloadType = 103; |
368 const uint32_t CallTest::kSendRtxSsrcs[kNumSsrcs] = {0xBADCAFD, 0xBADCAFE, | 358 const uint32_t CallTest::kSendRtxSsrcs[kNumSsrcs] = {0xBADCAFD, 0xBADCAFE, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 | 397 |
408 size_t BaseTest::GetNumAudioStreams() const { | 398 size_t BaseTest::GetNumAudioStreams() const { |
409 return 0; | 399 return 0; |
410 } | 400 } |
411 | 401 |
412 void BaseTest::ModifyVideoConfigs( | 402 void BaseTest::ModifyVideoConfigs( |
413 VideoSendStream::Config* send_config, | 403 VideoSendStream::Config* send_config, |
414 std::vector<VideoReceiveStream::Config>* receive_configs, | 404 std::vector<VideoReceiveStream::Config>* receive_configs, |
415 VideoEncoderConfig* encoder_config) {} | 405 VideoEncoderConfig* encoder_config) {} |
416 | 406 |
417 void BaseTest::ModifyVideoCaptureStartResolution(int* width, | |
418 int* heigt, | |
419 int* frame_rate) {} | |
420 | |
421 void BaseTest::OnVideoStreamsCreated( | 407 void BaseTest::OnVideoStreamsCreated( |
422 VideoSendStream* send_stream, | 408 VideoSendStream* send_stream, |
423 const std::vector<VideoReceiveStream*>& receive_streams) {} | 409 const std::vector<VideoReceiveStream*>& receive_streams) {} |
424 | 410 |
425 void BaseTest::ModifyAudioConfigs( | 411 void BaseTest::ModifyAudioConfigs( |
426 AudioSendStream::Config* send_config, | 412 AudioSendStream::Config* send_config, |
427 std::vector<AudioReceiveStream::Config>* receive_configs) {} | 413 std::vector<AudioReceiveStream::Config>* receive_configs) {} |
428 | 414 |
429 void BaseTest::OnAudioStreamsCreated( | 415 void BaseTest::OnAudioStreamsCreated( |
430 AudioSendStream* send_stream, | 416 AudioSendStream* send_stream, |
(...skipping 12 matching lines...) Expand all Loading... |
443 | 429 |
444 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { | 430 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { |
445 } | 431 } |
446 | 432 |
447 bool EndToEndTest::ShouldCreateReceivers() const { | 433 bool EndToEndTest::ShouldCreateReceivers() const { |
448 return true; | 434 return true; |
449 } | 435 } |
450 | 436 |
451 } // namespace test | 437 } // namespace test |
452 } // namespace webrtc | 438 } // namespace webrtc |
OLD | NEW |