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

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

Issue 190713004: Only turn on the audio processing by default for MEDIA_DEVICE_AUDIO_CAPTURE (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: unittest Created 6 years, 9 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_audio_capturer.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/webrtc/webrtc_local_audio_track_adapter.h" 7 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h"
8 #include "content/renderer/media/webrtc_audio_capturer.h" 8 #include "content/renderer/media/webrtc_audio_capturer.h"
9 #include "content/renderer/media/webrtc_audio_device_impl.h" 9 #include "content/renderer/media/webrtc_audio_device_impl.h"
10 #include "content/renderer/media/webrtc_local_audio_source_provider.h" 10 #include "content/renderer/media/webrtc_local_audio_source_provider.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 }; 157 };
158 158
159 } // namespace 159 } // namespace
160 160
161 class WebRtcLocalAudioTrackTest : public ::testing::Test { 161 class WebRtcLocalAudioTrackTest : public ::testing::Test {
162 protected: 162 protected:
163 virtual void SetUp() OVERRIDE { 163 virtual void SetUp() OVERRIDE {
164 params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 164 params_.Reset(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
165 media::CHANNEL_LAYOUT_STEREO, 2, 0, 48000, 16, 480); 165 media::CHANNEL_LAYOUT_STEREO, 2, 0, 48000, 16, 480);
166 blink::WebMediaConstraints constraints; 166 blink::WebMediaConstraints constraints;
167 capturer_ = WebRtcAudioCapturer::CreateCapturer(-1, StreamDeviceInfo(), 167 StreamDeviceInfo device(MEDIA_DEVICE_AUDIO_CAPTURE,
168 std::string(), std::string());
169 capturer_ = WebRtcAudioCapturer::CreateCapturer(-1, device,
168 constraints, NULL); 170 constraints, NULL);
169 capturer_source_ = new MockCapturerSource(capturer_.get()); 171 capturer_source_ = new MockCapturerSource(capturer_.get());
170 EXPECT_CALL(*capturer_source_.get(), OnInitialize(_, capturer_.get(), -1)) 172 EXPECT_CALL(*capturer_source_.get(), OnInitialize(_, capturer_.get(), -1))
171 .WillOnce(Return()); 173 .WillOnce(Return());
172 capturer_->SetCapturerSourceForTesting(capturer_source_, params_); 174 capturer_->SetCapturerSourceForTesting(capturer_source_, params_);
173 } 175 }
174 176
175 media::AudioParameters params_; 177 media::AudioParameters params_;
176 scoped_refptr<MockCapturerSource> capturer_source_; 178 scoped_refptr<MockCapturerSource> capturer_source_;
177 scoped_refptr<WebRtcAudioCapturer> capturer_; 179 scoped_refptr<WebRtcAudioCapturer> capturer_;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 EXPECT_CALL( 466 EXPECT_CALL(
465 *sink_1.get(), 467 *sink_1.get(),
466 CaptureData( 468 CaptureData(
467 kNumberOfNetworkChannelsForTrack1, 48000, 2, _, 0, 0, true, false)) 469 kNumberOfNetworkChannelsForTrack1, 48000, 2, _, 0, 0, true, false))
468 .Times(AnyNumber()).WillRepeatedly(Return()); 470 .Times(AnyNumber()).WillRepeatedly(Return());
469 EXPECT_CALL(*sink_1.get(), OnSetFormat(_)).Times(AnyNumber()); 471 EXPECT_CALL(*sink_1.get(), OnSetFormat(_)).Times(AnyNumber());
470 track_1->AddSink(sink_1.get()); 472 track_1->AddSink(sink_1.get());
471 473
472 // Create a new capturer with new source with different audio format. 474 // Create a new capturer with new source with different audio format.
473 blink::WebMediaConstraints constraints; 475 blink::WebMediaConstraints constraints;
476 StreamDeviceInfo device(MEDIA_DEVICE_AUDIO_CAPTURE,
477 std::string(), std::string());
474 scoped_refptr<WebRtcAudioCapturer> new_capturer( 478 scoped_refptr<WebRtcAudioCapturer> new_capturer(
475 WebRtcAudioCapturer::CreateCapturer(-1, StreamDeviceInfo(), 479 WebRtcAudioCapturer::CreateCapturer(-1, device, constraints, NULL));
476 constraints, NULL));
477 scoped_refptr<MockCapturerSource> new_source( 480 scoped_refptr<MockCapturerSource> new_source(
478 new MockCapturerSource(new_capturer.get())); 481 new MockCapturerSource(new_capturer.get()));
479 EXPECT_CALL(*new_source.get(), OnInitialize(_, new_capturer.get(), -1)); 482 EXPECT_CALL(*new_source.get(), OnInitialize(_, new_capturer.get(), -1));
480 media::AudioParameters new_param( 483 media::AudioParameters new_param(
481 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 484 media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
482 media::CHANNEL_LAYOUT_MONO, 44100, 16, 441); 485 media::CHANNEL_LAYOUT_MONO, 44100, 16, 441);
483 new_capturer->SetCapturerSourceForTesting(new_source, new_param); 486 new_capturer->SetCapturerSourceForTesting(new_source, new_param);
484 487
485 // Setup the second audio track, connect it to the new capturer and start it. 488 // Setup the second audio track, connect it to the new capturer and start it.
486 EXPECT_CALL(*new_source.get(), SetAutomaticGainControl(true)); 489 EXPECT_CALL(*new_source.get(), SetAutomaticGainControl(true));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 .Times(AtLeast(1)).WillRepeatedly(SignalEvent(&event)); 578 .Times(AtLeast(1)).WillRepeatedly(SignalEvent(&event));
576 track->AddSink(sink.get()); 579 track->AddSink(sink.get());
577 EXPECT_TRUE(event.TimedWait(TestTimeouts::tiny_timeout())); 580 EXPECT_TRUE(event.TimedWait(TestTimeouts::tiny_timeout()));
578 581
579 // Stopping the new source will stop the second track. 582 // Stopping the new source will stop the second track.
580 EXPECT_CALL(*source, OnStop()).Times(1); 583 EXPECT_CALL(*source, OnStop()).Times(1);
581 capturer->Stop(); 584 capturer->Stop();
582 } 585 }
583 586
584 } // namespace content 587 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698