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

Side by Side Diff: content/renderer/media/webrtc_local_audio_track_unittest.cc

Issue 227743004: Added a kEchoCancellation constraint to turn off the audio processing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 7 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 | « content/renderer/media/webrtc_local_audio_source_provider_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/synchronization/waitable_event.h" 5 #include "base/synchronization/waitable_event.h"
6 #include "base/test/test_timeouts.h" 6 #include "base/test/test_timeouts.h"
7 #include "content/renderer/media/media_stream_audio_source.h" 7 #include "content/renderer/media/media_stream_audio_source.h"
8 #include "content/renderer/media/mock_media_constraint_factory.h" 8 #include "content/renderer/media/mock_media_constraint_factory.h"
9 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" 9 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
10 #include "content/renderer/media/webrtc_audio_capturer.h" 10 #include "content/renderer/media/webrtc_audio_capturer.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 media::AudioParameters params_; 163 media::AudioParameters params_;
164 }; 164 };
165 165
166 } // namespace 166 } // namespace
167 167
168 class WebRtcLocalAudioTrackTest : public ::testing::Test { 168 class WebRtcLocalAudioTrackTest : public ::testing::Test {
169 protected: 169 protected:
170 virtual void SetUp() OVERRIDE { 170 virtual void SetUp() OVERRIDE {
171 params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 171 params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
172 media::CHANNEL_LAYOUT_STEREO, 2, 0, 48000, 16, 480); 172 media::CHANNEL_LAYOUT_STEREO, 2, 0, 48000, 16, 480);
173 blink::WebMediaConstraints constraints; 173 MockMediaConstraintFactory constraint_factory;
174 blink_source_.initialize("dummy", blink::WebMediaStreamSource::TypeAudio, 174 blink_source_.initialize("dummy", blink::WebMediaStreamSource::TypeAudio,
175 "dummy"); 175 "dummy");
176 MediaStreamAudioSource* audio_source = new MediaStreamAudioSource(); 176 MediaStreamAudioSource* audio_source = new MediaStreamAudioSource();
177 blink_source_.setExtraData(audio_source); 177 blink_source_.setExtraData(audio_source);
178 178
179 StreamDeviceInfo device(MEDIA_DEVICE_AUDIO_CAPTURE, 179 StreamDeviceInfo device(MEDIA_DEVICE_AUDIO_CAPTURE,
180 std::string(), std::string()); 180 std::string(), std::string());
181 capturer_ = WebRtcAudioCapturer::CreateCapturer(-1, device, 181 capturer_ = WebRtcAudioCapturer::CreateCapturer(
182 constraints, NULL, 182 -1, device, constraint_factory.CreateWebMediaConstraints(), NULL,
183 audio_source); 183 audio_source);
184 audio_source->SetAudioCapturer(capturer_); 184 audio_source->SetAudioCapturer(capturer_);
185 capturer_source_ = new MockCapturerSource(capturer_.get()); 185 capturer_source_ = new MockCapturerSource(capturer_.get());
186 EXPECT_CALL(*capturer_source_.get(), OnInitialize(_, capturer_.get(), -1)) 186 EXPECT_CALL(*capturer_source_.get(), OnInitialize(_, capturer_.get(), -1))
187 .WillOnce(Return()); 187 .WillOnce(Return());
188 EXPECT_CALL(*capturer_source_.get(), SetAutomaticGainControl(true)); 188 EXPECT_CALL(*capturer_source_.get(), SetAutomaticGainControl(true));
189 EXPECT_CALL(*capturer_source_.get(), OnStart()); 189 EXPECT_CALL(*capturer_source_.get(), OnStart());
190 capturer_->SetCapturerSourceForTesting(capturer_source_, params_); 190 capturer_->SetCapturerSourceForTesting(capturer_source_, params_);
191 } 191 }
192 192
193 media::AudioParameters params_; 193 media::AudioParameters params_;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 // Verify the data flow by connecting the |sink_1| to |track_1|. 439 // Verify the data flow by connecting the |sink_1| to |track_1|.
440 scoped_ptr<MockMediaStreamAudioSink> sink_1(new MockMediaStreamAudioSink()); 440 scoped_ptr<MockMediaStreamAudioSink> sink_1(new MockMediaStreamAudioSink());
441 EXPECT_CALL(*sink_1.get(), 441 EXPECT_CALL(*sink_1.get(),
442 CaptureData(kNumberOfNetworkChannelsForTrack1, 442 CaptureData(kNumberOfNetworkChannelsForTrack1,
443 0, 0, _, false)) 443 0, 0, _, false))
444 .Times(AnyNumber()).WillRepeatedly(Return()); 444 .Times(AnyNumber()).WillRepeatedly(Return());
445 EXPECT_CALL(*sink_1.get(), FormatIsSet()).Times(AnyNumber()); 445 EXPECT_CALL(*sink_1.get(), FormatIsSet()).Times(AnyNumber());
446 track_1->AddSink(sink_1.get()); 446 track_1->AddSink(sink_1.get());
447 447
448 // Create a new capturer with new source with different audio format. 448 // Create a new capturer with new source with different audio format.
449 blink::WebMediaConstraints constraints; 449 MockMediaConstraintFactory constraint_factory;
450 StreamDeviceInfo device(MEDIA_DEVICE_AUDIO_CAPTURE, 450 StreamDeviceInfo device(MEDIA_DEVICE_AUDIO_CAPTURE,
451 std::string(), std::string()); 451 std::string(), std::string());
452 scoped_refptr<WebRtcAudioCapturer> new_capturer( 452 scoped_refptr<WebRtcAudioCapturer> new_capturer(
453 WebRtcAudioCapturer::CreateCapturer(-1, device, constraints, NULL, NULL)); 453 WebRtcAudioCapturer::CreateCapturer(
454 -1, device, constraint_factory.CreateWebMediaConstraints(), NULL,
455 NULL));
454 scoped_refptr<MockCapturerSource> new_source( 456 scoped_refptr<MockCapturerSource> new_source(
455 new MockCapturerSource(new_capturer.get())); 457 new MockCapturerSource(new_capturer.get()));
456 EXPECT_CALL(*new_source.get(), OnInitialize(_, new_capturer.get(), -1)); 458 EXPECT_CALL(*new_source.get(), OnInitialize(_, new_capturer.get(), -1));
457 EXPECT_CALL(*new_source.get(), SetAutomaticGainControl(true)); 459 EXPECT_CALL(*new_source.get(), SetAutomaticGainControl(true));
458 EXPECT_CALL(*new_source.get(), OnStart()); 460 EXPECT_CALL(*new_source.get(), OnStart());
459 461
460 media::AudioParameters new_param( 462 media::AudioParameters new_param(
461 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 463 media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
462 media::CHANNEL_LAYOUT_MONO, 44100, 16, 441); 464 media::CHANNEL_LAYOUT_MONO, 44100, 16, 441);
463 new_capturer->SetCapturerSourceForTesting(new_source, new_param); 465 new_capturer->SetCapturerSourceForTesting(new_source, new_param);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 // Stopping the new source will stop the second track. 552 // Stopping the new source will stop the second track.
551 EXPECT_CALL(*source, OnStop()).Times(1); 553 EXPECT_CALL(*source, OnStop()).Times(1);
552 capturer->Stop(); 554 capturer->Stop();
553 555
554 // Even though this test don't use |capturer_source_| it will be stopped 556 // Even though this test don't use |capturer_source_| it will be stopped
555 // during teardown of the test harness. 557 // during teardown of the test harness.
556 EXPECT_CALL(*capturer_source_.get(), OnStop()); 558 EXPECT_CALL(*capturer_source_.get(), OnStop());
557 } 559 }
558 560
559 } // namespace content 561 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_local_audio_source_provider_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698