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

Side by Side Diff: webrtc/test/call_test.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
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (num_audio_streams_ > 0) 133 if (num_audio_streams_ > 0)
134 DestroyVoiceEngines(); 134 DestroyVoiceEngines();
135 } 135 }
136 136
137 void CallTest::Start() { 137 void CallTest::Start() {
138 if (video_send_stream_) 138 if (video_send_stream_)
139 video_send_stream_->Start(); 139 video_send_stream_->Start();
140 for (VideoReceiveStream* video_recv_stream : video_receive_streams_) 140 for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
141 video_recv_stream->Start(); 141 video_recv_stream->Start();
142 if (audio_send_stream_) { 142 if (audio_send_stream_) {
143 fake_send_audio_device_->Start(); 143 fake_send_audio_device_->StartRecordingSine(1000, 256);
144 audio_send_stream_->Start(); 144 audio_send_stream_->Start();
145 EXPECT_EQ(0, voe_send_.base->StartSend(voe_send_.channel_id)); 145 EXPECT_EQ(0, voe_send_.base->StartSend(voe_send_.channel_id));
146 } 146 }
147 for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_) 147 for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_)
148 audio_recv_stream->Start(); 148 audio_recv_stream->Start();
149 if (!audio_receive_streams_.empty()) { 149 if (!audio_receive_streams_.empty()) {
150 fake_recv_audio_device_->Start(); 150 fake_recv_audio_device_->StartPlayout();
151 EXPECT_EQ(0, voe_recv_.base->StartPlayout(voe_recv_.channel_id)); 151 EXPECT_EQ(0, voe_recv_.base->StartPlayout(voe_recv_.channel_id));
152 } 152 }
153 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) 153 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_)
154 flexfec_recv_stream->Start(); 154 flexfec_recv_stream->Start();
155 if (frame_generator_capturer_.get() != NULL) 155 if (frame_generator_capturer_.get() != NULL)
156 frame_generator_capturer_->Start(); 156 frame_generator_capturer_->Start();
157 } 157 }
158 158
159 void CallTest::Stop() { 159 void CallTest::Stop() {
160 if (frame_generator_capturer_.get() != NULL) 160 if (frame_generator_capturer_.get() != NULL)
161 frame_generator_capturer_->Stop(); 161 frame_generator_capturer_->Stop();
162 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_) 162 for (FlexfecReceiveStream* flexfec_recv_stream : flexfec_receive_streams_)
163 flexfec_recv_stream->Stop(); 163 flexfec_recv_stream->Stop();
164 if (!audio_receive_streams_.empty()) { 164 if (!audio_receive_streams_.empty()) {
165 fake_recv_audio_device_->Stop(); 165 fake_recv_audio_device_->StopPlayout();
166 EXPECT_EQ(0, voe_recv_.base->StopPlayout(voe_recv_.channel_id)); 166 EXPECT_EQ(0, voe_recv_.base->StopPlayout(voe_recv_.channel_id));
167 } 167 }
168 for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_) 168 for (AudioReceiveStream* audio_recv_stream : audio_receive_streams_)
169 audio_recv_stream->Stop(); 169 audio_recv_stream->Stop();
170 if (audio_send_stream_) { 170 if (audio_send_stream_) {
171 fake_send_audio_device_->Stop(); 171 fake_send_audio_device_->StopRecording();
172 EXPECT_EQ(0, voe_send_.base->StopSend(voe_send_.channel_id)); 172 EXPECT_EQ(0, voe_send_.base->StopSend(voe_send_.channel_id));
173 audio_send_stream_->Stop(); 173 audio_send_stream_->Stop();
174 } 174 }
175 for (VideoReceiveStream* video_recv_stream : video_receive_streams_) 175 for (VideoReceiveStream* video_recv_stream : video_receive_streams_)
176 video_recv_stream->Stop(); 176 video_recv_stream->Stop();
177 if (video_send_stream_) 177 if (video_send_stream_)
178 video_send_stream_->Stop(); 178 video_send_stream_->Stop();
179 } 179 }
180 180
181 void CallTest::CreateCalls(const Call::Config& sender_config, 181 void CallTest::CreateCalls(const Call::Config& sender_config,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 int width, 302 int width,
303 int height) { 303 int height) {
304 frame_generator_capturer_.reset( 304 frame_generator_capturer_.reset(
305 test::FrameGeneratorCapturer::Create(width, height, framerate, clock_)); 305 test::FrameGeneratorCapturer::Create(width, height, framerate, clock_));
306 video_send_stream_->SetSource( 306 video_send_stream_->SetSource(
307 frame_generator_capturer_.get(), 307 frame_generator_capturer_.get(),
308 VideoSendStream::DegradationPreference::kBalanced); 308 VideoSendStream::DegradationPreference::kBalanced);
309 } 309 }
310 310
311 void CallTest::CreateFakeAudioDevices() { 311 void CallTest::CreateFakeAudioDevices() {
312 fake_send_audio_device_.reset(new FakeAudioDevice( 312 fake_send_audio_device_.reset(
313 clock_, test::ResourcePath("voice_engine/audio_long16", "pcm"), 313 new FakeAudioDevice(clock_, DriftingClock::kNoDrift));
314 DriftingClock::kNoDrift)); 314 fake_recv_audio_device_.reset(
315 fake_recv_audio_device_.reset(new FakeAudioDevice( 315 new FakeAudioDevice(clock_, DriftingClock::kNoDrift));
316 clock_, test::ResourcePath("voice_engine/audio_long16", "pcm"),
317 DriftingClock::kNoDrift));
318 } 316 }
319 317
320 void CallTest::CreateVideoStreams() { 318 void CallTest::CreateVideoStreams() {
321 RTC_DCHECK(video_send_stream_ == nullptr); 319 RTC_DCHECK(video_send_stream_ == nullptr);
322 RTC_DCHECK(video_receive_streams_.empty()); 320 RTC_DCHECK(video_receive_streams_.empty());
323 RTC_DCHECK(audio_send_stream_ == nullptr); 321 RTC_DCHECK(audio_send_stream_ == nullptr);
324 RTC_DCHECK(audio_receive_streams_.empty()); 322 RTC_DCHECK(audio_receive_streams_.empty());
325 323
326 video_send_stream_ = sender_call_->CreateVideoSendStream( 324 video_send_stream_ = sender_call_->CreateVideoSendStream(
327 video_send_config_.Copy(), video_encoder_config_.Copy()); 325 video_send_config_.Copy(), video_encoder_config_.Copy());
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 507
510 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) { 508 EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {
511 } 509 }
512 510
513 bool EndToEndTest::ShouldCreateReceivers() const { 511 bool EndToEndTest::ShouldCreateReceivers() const {
514 return true; 512 return true;
515 } 513 }
516 514
517 } // namespace test 515 } // namespace test
518 } // namespace webrtc 516 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698