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

Side by Side Diff: webrtc/call/call_perf_tests.cc

Issue 2652803002: Refactor FakeAudioDevice to have separate methods for starting recording and playout. (Closed)
Patch Set: Made some methods private. Readded init. Created 3 years, 11 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 | « no previous file | webrtc/test/call_test.cc » ('j') | webrtc/test/fake_audio_device.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 float video_ntp_speed, 139 float video_ntp_speed,
140 float video_rtp_speed, 140 float video_rtp_speed,
141 float audio_rtp_speed) { 141 float audio_rtp_speed) {
142 const char* kSyncGroup = "av_sync"; 142 const char* kSyncGroup = "av_sync";
143 const uint32_t kAudioSendSsrc = 1234; 143 const uint32_t kAudioSendSsrc = 1234;
144 const uint32_t kAudioRecvSsrc = 5678; 144 const uint32_t kAudioRecvSsrc = 5678;
145 145
146 metrics::Reset(); 146 metrics::Reset();
147 VoiceEngine* voice_engine = VoiceEngine::Create(); 147 VoiceEngine* voice_engine = VoiceEngine::Create();
148 VoEBase* voe_base = VoEBase::GetInterface(voice_engine); 148 VoEBase* voe_base = VoEBase::GetInterface(voice_engine);
149 const std::string audio_filename = 149 FakeAudioDevice fake_audio_device(Clock::GetRealTimeClock(), audio_rtp_speed);
150 test::ResourcePath("voice_engine/audio_long16", "pcm");
151 ASSERT_STRNE("", audio_filename.c_str());
152 FakeAudioDevice fake_audio_device(Clock::GetRealTimeClock(), audio_filename,
153 audio_rtp_speed);
154 EXPECT_EQ(0, voe_base->Init(&fake_audio_device, nullptr, decoder_factory_)); 150 EXPECT_EQ(0, voe_base->Init(&fake_audio_device, nullptr, decoder_factory_));
155 VoEBase::ChannelConfig config; 151 VoEBase::ChannelConfig config;
156 config.enable_voice_pacing = true; 152 config.enable_voice_pacing = true;
157 int send_channel_id = voe_base->CreateChannel(config); 153 int send_channel_id = voe_base->CreateChannel(config);
158 int recv_channel_id = voe_base->CreateChannel(); 154 int recv_channel_id = voe_base->CreateChannel();
159 155
160 AudioState::Config send_audio_state_config; 156 AudioState::Config send_audio_state_config;
161 send_audio_state_config.voice_engine = voice_engine; 157 send_audio_state_config.voice_engine = voice_engine;
162 send_audio_state_config.audio_mixer = AudioMixerImpl::Create(); 158 send_audio_state_config.audio_mixer = AudioMixerImpl::Create();
163 Call::Config sender_config(&event_log_); 159 Call::Config sender_config(&event_log_);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 253 }
258 EXPECT_EQ(1u, video_receive_streams_.size()); 254 EXPECT_EQ(1u, video_receive_streams_.size());
259 observer.set_receive_stream(video_receive_streams_[0]); 255 observer.set_receive_stream(video_receive_streams_[0]);
260 DriftingClock drifting_clock(clock_, video_ntp_speed); 256 DriftingClock drifting_clock(clock_, video_ntp_speed);
261 CreateFrameGeneratorCapturerWithDrift(&drifting_clock, video_rtp_speed, 257 CreateFrameGeneratorCapturerWithDrift(&drifting_clock, video_rtp_speed,
262 kDefaultFramerate, kDefaultWidth, 258 kDefaultFramerate, kDefaultWidth,
263 kDefaultHeight); 259 kDefaultHeight);
264 260
265 Start(); 261 Start();
266 262
267 fake_audio_device.Start(); 263 fake_audio_device.StartRecordingSine(1000, 256);
264 fake_audio_device.StartPlayout();
268 audio_receive_stream->Start(); 265 audio_receive_stream->Start();
269 EXPECT_EQ(0, voe_base->StartSend(send_channel_id)); 266 EXPECT_EQ(0, voe_base->StartSend(send_channel_id));
270 267
271 EXPECT_TRUE(observer.Wait()) 268 EXPECT_TRUE(observer.Wait())
272 << "Timed out while waiting for audio and video to be synchronized."; 269 << "Timed out while waiting for audio and video to be synchronized.";
273 270
274 EXPECT_EQ(0, voe_base->StopSend(send_channel_id)); 271 EXPECT_EQ(0, voe_base->StopSend(send_channel_id));
275 EXPECT_EQ(0, voe_base->StopPlayout(recv_channel_id)); 272 EXPECT_EQ(0, voe_base->StopPlayout(recv_channel_id));
276 fake_audio_device.Stop(); 273 fake_audio_device.StopPlayout();
the sun 2017/01/24 08:58:12 nit: stop/start in same order - these operations s
perkj_webrtc 2017/01/24 09:57:02 Done.
274 fake_audio_device.StopRecording();
277 275
278 Stop(); 276 Stop();
279 video_send_transport.StopSending(); 277 video_send_transport.StopSending();
280 audio_send_transport.StopSending(); 278 audio_send_transport.StopSending();
281 receive_transport.StopSending(); 279 receive_transport.StopSending();
282 280
283 DestroyStreams(); 281 DestroyStreams();
284 282
285 sender_call_->DestroyAudioSendStream(audio_send_stream); 283 sender_call_->DestroyAudioSendStream(audio_send_stream);
286 receiver_call_->DestroyAudioReceiveStream(audio_receive_stream); 284 receiver_call_->DestroyAudioReceiveStream(audio_receive_stream);
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 uint32_t last_set_bitrate_kbps_; 731 uint32_t last_set_bitrate_kbps_;
734 VideoSendStream* send_stream_; 732 VideoSendStream* send_stream_;
735 test::FrameGeneratorCapturer* frame_generator_; 733 test::FrameGeneratorCapturer* frame_generator_;
736 VideoEncoderConfig encoder_config_; 734 VideoEncoderConfig encoder_config_;
737 } test; 735 } test;
738 736
739 RunBaseTest(&test); 737 RunBaseTest(&test);
740 } 738 }
741 739
742 } // namespace webrtc 740 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/test/call_test.cc » ('j') | webrtc/test/fake_audio_device.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698