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

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
« no previous file with comments | « webrtc/test/call_test.h ('k') | webrtc/test/encoder_settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 30 matching lines...) Expand all
230 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; 234 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc;
231 audio_config.rtcp_send_transport = rtcp_send_transport; 235 audio_config.rtcp_send_transport = rtcp_send_transport;
232 audio_config.voe_channel_id = voe_recv_.channel_id; 236 audio_config.voe_channel_id = voe_recv_.channel_id;
233 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; 237 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc;
234 audio_config.decoder_factory = decoder_factory_; 238 audio_config.decoder_factory = decoder_factory_;
235 audio_receive_configs_.push_back(audio_config); 239 audio_receive_configs_.push_back(audio_config);
236 } 240 }
237 } 241 }
238 242
239 void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock, 243 void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock,
240 float speed) { 244 float speed,
241 VideoStream stream = video_encoder_config_.streams.back(); 245 int framerate,
246 int width,
247 int height) {
242 frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create( 248 frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
243 stream.width, stream.height, stream.max_framerate * speed, clock)); 249 width, height, framerate * speed, clock));
244 video_send_stream_->SetSource(frame_generator_capturer_.get()); 250 video_send_stream_->SetSource(frame_generator_capturer_.get());
245 } 251 }
246 252
247 void CallTest::CreateFrameGeneratorCapturer() { 253 void CallTest::CreateFrameGeneratorCapturer(int framerate,
248 VideoStream stream = video_encoder_config_.streams.back(); 254 int width,
249 frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create( 255 int height) {
250 stream.width, stream.height, stream.max_framerate, clock_)); 256 frame_generator_capturer_.reset(
257 test::FrameGeneratorCapturer::Create(width, height, framerate, clock_));
251 video_send_stream_->SetSource(frame_generator_capturer_.get()); 258 video_send_stream_->SetSource(frame_generator_capturer_.get());
252 } 259 }
253 260
254 void CallTest::CreateFakeAudioDevices() { 261 void CallTest::CreateFakeAudioDevices() {
255 fake_send_audio_device_.reset(new FakeAudioDevice( 262 fake_send_audio_device_.reset(new FakeAudioDevice(
256 clock_, test::ResourcePath("voice_engine/audio_long16", "pcm"), 263 clock_, test::ResourcePath("voice_engine/audio_long16", "pcm"),
257 DriftingClock::kNoDrift)); 264 DriftingClock::kNoDrift));
258 fake_recv_audio_device_.reset(new FakeAudioDevice( 265 fake_recv_audio_device_.reset(new FakeAudioDevice(
259 clock_, test::ResourcePath("voice_engine/audio_long16", "pcm"), 266 clock_, test::ResourcePath("voice_engine/audio_long16", "pcm"),
260 DriftingClock::kNoDrift)); 267 DriftingClock::kNoDrift));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 voe_send_.base = nullptr; 347 voe_send_.base = nullptr;
341 voe_send_.codec->Release(); 348 voe_send_.codec->Release();
342 voe_send_.codec = nullptr; 349 voe_send_.codec = nullptr;
343 350
344 VoiceEngine::Delete(voe_send_.voice_engine); 351 VoiceEngine::Delete(voe_send_.voice_engine);
345 voe_send_.voice_engine = nullptr; 352 voe_send_.voice_engine = nullptr;
346 VoiceEngine::Delete(voe_recv_.voice_engine); 353 VoiceEngine::Delete(voe_recv_.voice_engine);
347 voe_recv_.voice_engine = nullptr; 354 voe_recv_.voice_engine = nullptr;
348 } 355 }
349 356
357 const int CallTest::kDefaultWidth;
358 const int CallTest::kDefaultHeight;
359 const int CallTest::kDefaultFramerate;
350 const int CallTest::kDefaultTimeoutMs = 30 * 1000; 360 const int CallTest::kDefaultTimeoutMs = 30 * 1000;
351 const int CallTest::kLongTimeoutMs = 120 * 1000; 361 const int CallTest::kLongTimeoutMs = 120 * 1000;
352 const uint8_t CallTest::kVideoSendPayloadType = 100; 362 const uint8_t CallTest::kVideoSendPayloadType = 100;
353 const uint8_t CallTest::kFakeVideoSendPayloadType = 125; 363 const uint8_t CallTest::kFakeVideoSendPayloadType = 125;
354 const uint8_t CallTest::kSendRtxPayloadType = 98; 364 const uint8_t CallTest::kSendRtxPayloadType = 98;
355 const uint8_t CallTest::kRedPayloadType = 118; 365 const uint8_t CallTest::kRedPayloadType = 118;
356 const uint8_t CallTest::kRtxRedPayloadType = 99; 366 const uint8_t CallTest::kRtxRedPayloadType = 99;
357 const uint8_t CallTest::kUlpfecPayloadType = 119; 367 const uint8_t CallTest::kUlpfecPayloadType = 119;
358 const uint8_t CallTest::kAudioSendPayloadType = 103; 368 const uint8_t CallTest::kAudioSendPayloadType = 103;
359 const uint32_t CallTest::kSendRtxSsrcs[kNumSsrcs] = {0xBADCAFD, 0xBADCAFE, 369 const uint32_t CallTest::kSendRtxSsrcs[kNumSsrcs] = {0xBADCAFD, 0xBADCAFE,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 408
399 size_t BaseTest::GetNumAudioStreams() const { 409 size_t BaseTest::GetNumAudioStreams() const {
400 return 0; 410 return 0;
401 } 411 }
402 412
403 void BaseTest::ModifyVideoConfigs( 413 void BaseTest::ModifyVideoConfigs(
404 VideoSendStream::Config* send_config, 414 VideoSendStream::Config* send_config,
405 std::vector<VideoReceiveStream::Config>* receive_configs, 415 std::vector<VideoReceiveStream::Config>* receive_configs,
406 VideoEncoderConfig* encoder_config) {} 416 VideoEncoderConfig* encoder_config) {}
407 417
418 void BaseTest::ModifyVideoCaptureStartResolution(int* width,
419 int* heigt,
420 int* frame_rate) {}
421
408 void BaseTest::OnVideoStreamsCreated( 422 void BaseTest::OnVideoStreamsCreated(
409 VideoSendStream* send_stream, 423 VideoSendStream* send_stream,
410 const std::vector<VideoReceiveStream*>& receive_streams) {} 424 const std::vector<VideoReceiveStream*>& receive_streams) {}
411 425
412 void BaseTest::ModifyAudioConfigs( 426 void BaseTest::ModifyAudioConfigs(
413 AudioSendStream::Config* send_config, 427 AudioSendStream::Config* send_config,
414 std::vector<AudioReceiveStream::Config>* receive_configs) {} 428 std::vector<AudioReceiveStream::Config>* receive_configs) {}
415 429
416 void BaseTest::OnAudioStreamsCreated( 430 void BaseTest::OnAudioStreamsCreated(
417 AudioSendStream* send_stream, 431 AudioSendStream* send_stream,
(...skipping 12 matching lines...) Expand all
430 444
431 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { 445 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {
432 } 446 }
433 447
434 bool EndToEndTest::ShouldCreateReceivers() const { 448 bool EndToEndTest::ShouldCreateReceivers() const {
435 return true; 449 return true;
436 } 450 }
437 451
438 } // namespace test 452 } // namespace test
439 } // namespace webrtc 453 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/call_test.h ('k') | webrtc/test/encoder_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698