OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |