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

Side by Side Diff: media/audio/audio_output_proxy_unittest.cc

Issue 23466008: Wire up the output device id and provide an implementation on Windows. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update comments Created 7 years, 3 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 | « media/audio/audio_output_dispatcher_impl.cc ('k') | media/audio/audio_output_resampler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "media/audio/audio_manager.h" 9 #include "media/audio/audio_manager.h"
10 #include "media/audio/audio_manager_base.h" 10 #include "media/audio/audio_manager_base.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 virtual void InitDispatcher(base::TimeDelta close_delay) { 160 virtual void InitDispatcher(base::TimeDelta close_delay) {
161 // Use a low sample rate and large buffer size when testing otherwise the 161 // Use a low sample rate and large buffer size when testing otherwise the
162 // FakeAudioOutputStream will keep the message loop busy indefinitely; i.e., 162 // FakeAudioOutputStream will keep the message loop busy indefinitely; i.e.,
163 // RunUntilIdle() will never terminate. 163 // RunUntilIdle() will never terminate.
164 params_ = AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, 164 params_ = AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
165 CHANNEL_LAYOUT_STEREO, 8000, 16, 2048); 165 CHANNEL_LAYOUT_STEREO, 8000, 16, 2048);
166 dispatcher_impl_ = new AudioOutputDispatcherImpl(&manager(), 166 dispatcher_impl_ = new AudioOutputDispatcherImpl(&manager(),
167 params_, 167 params_,
168 std::string(), 168 std::string(),
169 std::string(),
169 close_delay); 170 close_delay);
170 171
171 // Necessary to know how long the dispatcher will wait before posting 172 // Necessary to know how long the dispatcher will wait before posting
172 // StopStreamTask. 173 // StopStreamTask.
173 pause_delay_ = dispatcher_impl_->pause_delay_; 174 pause_delay_ = dispatcher_impl_->pause_delay_;
174 } 175 }
175 176
176 virtual void OnStart() {} 177 virtual void OnStart() {}
177 178
178 MockAudioManager& manager() { 179 MockAudioManager& manager() {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 466
466 virtual void InitDispatcher(base::TimeDelta close_delay) OVERRIDE { 467 virtual void InitDispatcher(base::TimeDelta close_delay) OVERRIDE {
467 AudioOutputProxyTest::InitDispatcher(close_delay); 468 AudioOutputProxyTest::InitDispatcher(close_delay);
468 // Use a low sample rate and large buffer size when testing otherwise the 469 // Use a low sample rate and large buffer size when testing otherwise the
469 // FakeAudioOutputStream will keep the message loop busy indefinitely; i.e., 470 // FakeAudioOutputStream will keep the message loop busy indefinitely; i.e.,
470 // RunUntilIdle() will never terminate. 471 // RunUntilIdle() will never terminate.
471 resampler_params_ = AudioParameters( 472 resampler_params_ = AudioParameters(
472 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, 473 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO,
473 16000, 16, 1024); 474 16000, 16, 1024);
474 resampler_ = new AudioOutputResampler( 475 resampler_ = new AudioOutputResampler(
475 &manager(), params_, resampler_params_, std::string(), close_delay); 476 &manager(), params_, resampler_params_, std::string(), std::string(),
477 close_delay);
476 } 478 }
477 479
478 virtual void OnStart() OVERRIDE { 480 virtual void OnStart() OVERRIDE {
479 // Let start run for a bit. 481 // Let start run for a bit.
480 message_loop_.RunUntilIdle(); 482 message_loop_.RunUntilIdle();
481 base::PlatformThread::Sleep( 483 base::PlatformThread::Sleep(
482 base::TimeDelta::FromMilliseconds(kStartRunTimeMs)); 484 base::TimeDelta::FromMilliseconds(kStartRunTimeMs));
483 } 485 }
484 486
485 protected: 487 protected:
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 WaitForCloseTimer(kTestCloseDelayMs); 739 WaitForCloseTimer(kTestCloseDelayMs);
738 EXPECT_TRUE(stream1.stop_called()); 740 EXPECT_TRUE(stream1.stop_called());
739 EXPECT_TRUE(stream1.start_called()); 741 EXPECT_TRUE(stream1.start_called());
740 EXPECT_TRUE(stream2.stop_called()); 742 EXPECT_TRUE(stream2.stop_called());
741 EXPECT_TRUE(stream2.start_called()); 743 EXPECT_TRUE(stream2.start_called());
742 EXPECT_FALSE(stream3.stop_called()); 744 EXPECT_FALSE(stream3.stop_called());
743 EXPECT_FALSE(stream3.start_called()); 745 EXPECT_FALSE(stream3.start_called());
744 } 746 }
745 747
746 } // namespace media 748 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_output_dispatcher_impl.cc ('k') | media/audio/audio_output_resampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698