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

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

Issue 218763007: Update MediaStreamTrack::Stop to latest draft. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 8 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 | Annotate | Revision Log
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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "content/public/common/content_switches.h" 7 #include "content/public/common/content_switches.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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 switches::kEnableAudioTrackProcessing); 89 switches::kEnableAudioTrackProcessing);
90 } 90 }
91 91
92 void VerifyAudioParams(const blink::WebMediaConstraints& constraints, 92 void VerifyAudioParams(const blink::WebMediaConstraints& constraints,
93 bool need_audio_processing) { 93 bool need_audio_processing) {
94 capturer_ = WebRtcAudioCapturer::CreateCapturer( 94 capturer_ = WebRtcAudioCapturer::CreateCapturer(
95 -1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, 95 -1, StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE,
96 "", "", params_.sample_rate(), 96 "", "", params_.sample_rate(),
97 params_.channel_layout(), 97 params_.channel_layout(),
98 params_.frames_per_buffer()), 98 params_.frames_per_buffer()),
99 constraints, NULL); 99 constraints, NULL, NULL);
100 capturer_source_ = new MockCapturerSource(); 100 capturer_source_ = new MockCapturerSource();
101 EXPECT_CALL(*capturer_source_.get(), Initialize(_, capturer_.get(), -1)); 101 EXPECT_CALL(*capturer_source_.get(), Initialize(_, capturer_.get(), -1));
102 EXPECT_CALL(*capturer_source_.get(), SetAutomaticGainControl(true));
103 EXPECT_CALL(*capturer_source_.get(), Start());
102 capturer_->SetCapturerSourceForTesting(capturer_source_, params_); 104 capturer_->SetCapturerSourceForTesting(capturer_source_, params_);
103 105
104 EXPECT_CALL(*capturer_source_.get(), SetAutomaticGainControl(true));
105 EXPECT_CALL(*capturer_source_.get(), Start());
106 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter( 106 scoped_refptr<WebRtcLocalAudioTrackAdapter> adapter(
107 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL)); 107 WebRtcLocalAudioTrackAdapter::Create(std::string(), NULL));
108 track_.reset(new WebRtcLocalAudioTrack(adapter, capturer_, NULL)); 108 track_.reset(new WebRtcLocalAudioTrack(adapter, capturer_, NULL));
109 track_->Start(); 109 track_->Start();
110 110
111 // Connect a mock sink to the track. 111 // Connect a mock sink to the track.
112 scoped_ptr<MockPeerConnectionAudioSink> sink( 112 scoped_ptr<MockPeerConnectionAudioSink> sink(
113 new MockPeerConnectionAudioSink()); 113 new MockPeerConnectionAudioSink());
114 track_->AddSink(sink.get()); 114 track_->AddSink(sink.get());
115 115
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 TEST_F(WebRtcAudioCapturerTest, VerifyAudioParamsWithAudioProcessing) { 165 TEST_F(WebRtcAudioCapturerTest, VerifyAudioParamsWithAudioProcessing) {
166 EnableAudioTrackProcessing(); 166 EnableAudioTrackProcessing();
167 // Turn off the default constraints to verify that the sink will get packets 167 // Turn off the default constraints to verify that the sink will get packets
168 // with a buffer size smaller than 10ms. 168 // with a buffer size smaller than 10ms.
169 MockMediaConstraintFactory constraint_factory; 169 MockMediaConstraintFactory constraint_factory;
170 constraint_factory.DisableDefaultAudioConstraints(); 170 constraint_factory.DisableDefaultAudioConstraints();
171 VerifyAudioParams(constraint_factory.CreateWebMediaConstraints(), false); 171 VerifyAudioParams(constraint_factory.CreateWebMediaConstraints(), false);
172 } 172 }
173 173
174 } // namespace content 174 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_capturer.cc ('k') | content/renderer/media/webrtc_local_audio_source_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698