Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: webrtc/test/call_test.cc

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

Powered by Google App Engine
This is Rietveld 408576698