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

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

Issue 3005253002: Add full stack tests for MediaCodec. (Closed)
Patch Set: Created 3 years, 3 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 10
(...skipping 24 matching lines...) Expand all
35 event_log_(RtcEventLog::CreateNull()), 35 event_log_(RtcEventLog::CreateNull()),
36 sender_call_transport_controller_(nullptr), 36 sender_call_transport_controller_(nullptr),
37 video_send_config_(nullptr), 37 video_send_config_(nullptr),
38 video_send_stream_(nullptr), 38 video_send_stream_(nullptr),
39 audio_send_config_(nullptr), 39 audio_send_config_(nullptr),
40 audio_send_stream_(nullptr), 40 audio_send_stream_(nullptr),
41 fake_encoder_(clock_), 41 fake_encoder_(clock_),
42 num_video_streams_(1), 42 num_video_streams_(1),
43 num_audio_streams_(0), 43 num_audio_streams_(0),
44 num_flexfec_streams_(0), 44 num_flexfec_streams_(0),
45 decoder_factory_(CreateBuiltinAudioDecoderFactory()), 45 audio_decoder_factory_(CreateBuiltinAudioDecoderFactory()),
46 encoder_factory_(CreateBuiltinAudioEncoderFactory()), 46 audio_encoder_factory_(CreateBuiltinAudioEncoderFactory()),
47 task_queue_("CallTestTaskQueue"), 47 task_queue_("CallTestTaskQueue"),
48 fake_send_audio_device_(nullptr), 48 fake_send_audio_device_(nullptr),
49 fake_recv_audio_device_(nullptr) {} 49 fake_recv_audio_device_(nullptr) {}
50 50
51 CallTest::~CallTest() { 51 CallTest::~CallTest() {
52 task_queue_.SendTask([this]() { 52 task_queue_.SendTask([this]() {
53 fake_send_audio_device_.reset(); 53 fake_send_audio_device_.reset();
54 fake_recv_audio_device_.reset(); 54 fake_recv_audio_device_.reset();
55 frame_generator_capturer_.reset(); 55 frame_generator_capturer_.reset();
56 }); 56 });
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 RtpExtension::kVideoRotationUri, kVideoRotationRtpExtensionId)); 217 RtpExtension::kVideoRotationUri, kVideoRotationRtpExtensionId));
218 } 218 }
219 219
220 if (num_audio_streams > 0) { 220 if (num_audio_streams > 0) {
221 audio_send_config_ = AudioSendStream::Config(send_transport); 221 audio_send_config_ = AudioSendStream::Config(send_transport);
222 audio_send_config_.voe_channel_id = voe_send_.channel_id; 222 audio_send_config_.voe_channel_id = voe_send_.channel_id;
223 audio_send_config_.rtp.ssrc = kAudioSendSsrc; 223 audio_send_config_.rtp.ssrc = kAudioSendSsrc;
224 audio_send_config_.send_codec_spec = 224 audio_send_config_.send_codec_spec =
225 rtc::Optional<AudioSendStream::Config::SendCodecSpec>( 225 rtc::Optional<AudioSendStream::Config::SendCodecSpec>(
226 {kAudioSendPayloadType, {"OPUS", 48000, 2, {{"stereo", "1"}}}}); 226 {kAudioSendPayloadType, {"OPUS", 48000, 2, {{"stereo", "1"}}}});
227 audio_send_config_.encoder_factory = encoder_factory_; 227 audio_send_config_.encoder_factory = audio_encoder_factory_;
228 } 228 }
229 229
230 // TODO(brandtr): Update this when we support multistream protection. 230 // TODO(brandtr): Update this when we support multistream protection.
231 if (num_flexfec_streams > 0) { 231 if (num_flexfec_streams > 0) {
232 video_send_config_.rtp.flexfec.payload_type = kFlexfecPayloadType; 232 video_send_config_.rtp.flexfec.payload_type = kFlexfecPayloadType;
233 video_send_config_.rtp.flexfec.ssrc = kFlexfecSendSsrc; 233 video_send_config_.rtp.flexfec.ssrc = kFlexfecSendSsrc;
234 video_send_config_.rtp.flexfec.protected_media_ssrcs = {kVideoSendSsrcs[0]}; 234 video_send_config_.rtp.flexfec.protected_media_ssrcs = {kVideoSendSsrcs[0]};
235 } 235 }
236 } 236 }
237 237
(...skipping 22 matching lines...) Expand all
260 } 260 }
261 261
262 RTC_DCHECK_GE(1, num_audio_streams_); 262 RTC_DCHECK_GE(1, num_audio_streams_);
263 if (num_audio_streams_ == 1) { 263 if (num_audio_streams_ == 1) {
264 RTC_DCHECK_LE(0, voe_send_.channel_id); 264 RTC_DCHECK_LE(0, voe_send_.channel_id);
265 AudioReceiveStream::Config audio_config; 265 AudioReceiveStream::Config audio_config;
266 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; 266 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc;
267 audio_config.rtcp_send_transport = rtcp_send_transport; 267 audio_config.rtcp_send_transport = rtcp_send_transport;
268 audio_config.voe_channel_id = voe_recv_.channel_id; 268 audio_config.voe_channel_id = voe_recv_.channel_id;
269 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; 269 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc;
270 audio_config.decoder_factory = decoder_factory_; 270 audio_config.decoder_factory = audio_decoder_factory_;
271 audio_config.decoder_map = {{kAudioSendPayloadType, {"opus", 48000, 2}}}; 271 audio_config.decoder_map = {{kAudioSendPayloadType, {"opus", 48000, 2}}};
272 audio_receive_configs_.push_back(audio_config); 272 audio_receive_configs_.push_back(audio_config);
273 } 273 }
274 274
275 // TODO(brandtr): Update this when we support multistream protection. 275 // TODO(brandtr): Update this when we support multistream protection.
276 RTC_DCHECK(num_flexfec_streams_ <= 1); 276 RTC_DCHECK(num_flexfec_streams_ <= 1);
277 if (num_flexfec_streams_ == 1) { 277 if (num_flexfec_streams_ == 1) {
278 FlexfecReceiveStream::Config config(rtcp_send_transport); 278 FlexfecReceiveStream::Config config(rtcp_send_transport);
279 config.payload_type = kFlexfecPayloadType; 279 config.payload_type = kFlexfecPayloadType;
280 config.remote_ssrc = kFlexfecSendSsrc; 280 config.remote_ssrc = kFlexfecSendSsrc;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 allocated_decoders_.clear(); 419 allocated_decoders_.clear();
420 } 420 }
421 421
422 void CallTest::SetFakeVideoCaptureRotation(VideoRotation rotation) { 422 void CallTest::SetFakeVideoCaptureRotation(VideoRotation rotation) {
423 frame_generator_capturer_->SetFakeRotation(rotation); 423 frame_generator_capturer_->SetFakeRotation(rotation);
424 } 424 }
425 425
426 void CallTest::CreateVoiceEngines() { 426 void CallTest::CreateVoiceEngines() {
427 voe_send_.voice_engine = VoiceEngine::Create(); 427 voe_send_.voice_engine = VoiceEngine::Create();
428 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine); 428 voe_send_.base = VoEBase::GetInterface(voe_send_.voice_engine);
429 EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), 429 EXPECT_EQ(0,
430 apm_send_.get(), decoder_factory_)); 430 voe_send_.base->Init(fake_send_audio_device_.get(), apm_send_.get(),
431 audio_decoder_factory_.get()));
åsapersson 2017/09/11 09:28:44 audio_decoder_factory_?
brandtr 2017/09/13 11:17:23 Done. Not sure why I added this?
431 VoEBase::ChannelConfig config; 432 VoEBase::ChannelConfig config;
432 config.enable_voice_pacing = true; 433 config.enable_voice_pacing = true;
433 voe_send_.channel_id = voe_send_.base->CreateChannel(config); 434 voe_send_.channel_id = voe_send_.base->CreateChannel(config);
434 EXPECT_GE(voe_send_.channel_id, 0); 435 EXPECT_GE(voe_send_.channel_id, 0);
435 436
436 voe_recv_.voice_engine = VoiceEngine::Create(); 437 voe_recv_.voice_engine = VoiceEngine::Create();
437 voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine); 438 voe_recv_.base = VoEBase::GetInterface(voe_recv_.voice_engine);
438 EXPECT_EQ(0, voe_recv_.base->Init(fake_recv_audio_device_.get(), 439 EXPECT_EQ(0,
439 apm_recv_.get(), decoder_factory_)); 440 voe_recv_.base->Init(fake_recv_audio_device_.get(), apm_recv_.get(),
441 audio_decoder_factory_.get()));
åsapersson 2017/09/11 09:28:44 same here
brandtr 2017/09/13 11:17:23 Done.
440 voe_recv_.channel_id = voe_recv_.base->CreateChannel(); 442 voe_recv_.channel_id = voe_recv_.base->CreateChannel();
441 EXPECT_GE(voe_recv_.channel_id, 0); 443 EXPECT_GE(voe_recv_.channel_id, 0);
442 } 444 }
443 445
444 void CallTest::DestroyVoiceEngines() { 446 void CallTest::DestroyVoiceEngines() {
445 voe_recv_.base->DeleteChannel(voe_recv_.channel_id); 447 voe_recv_.base->DeleteChannel(voe_recv_.channel_id);
446 voe_recv_.channel_id = -1; 448 voe_recv_.channel_id = -1;
447 voe_recv_.base->Release(); 449 voe_recv_.base->Release();
448 voe_recv_.base = nullptr; 450 voe_recv_.base = nullptr;
449 451
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 606
605 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { 607 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {
606 } 608 }
607 609
608 bool EndToEndTest::ShouldCreateReceivers() const { 610 bool EndToEndTest::ShouldCreateReceivers() const {
609 return true; 611 return true;
610 } 612 }
611 613
612 } // namespace test 614 } // namespace test
613 } // namespace webrtc 615 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698