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 "media/audio/audio_output_dispatcher.h" | 5 #include "media/audio/audio_output_dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "media/audio/audio_io.h" | 11 #include "media/audio/audio_io.h" |
12 | 12 |
| 13 namespace media { |
| 14 |
13 AudioOutputDispatcher::AudioOutputDispatcher( | 15 AudioOutputDispatcher::AudioOutputDispatcher( |
14 AudioManager* audio_manager, const AudioParameters& params, | 16 AudioManager* audio_manager, const AudioParameters& params, |
15 base::TimeDelta close_delay) | 17 base::TimeDelta close_delay) |
16 : audio_manager_(audio_manager), | 18 : audio_manager_(audio_manager), |
17 message_loop_(MessageLoop::current()), | 19 message_loop_(MessageLoop::current()), |
18 params_(params), | 20 params_(params), |
19 pause_delay_(base::TimeDelta::FromMilliseconds( | 21 pause_delay_(base::TimeDelta::FromMilliseconds( |
20 2 * params.frames_per_buffer() * | 22 2 * params.frames_per_buffer() * |
21 base::Time::kMillisecondsPerSecond / params.sample_rate())), | 23 base::Time::kMillisecondsPerSecond / params.sample_rate())), |
22 paused_proxies_(0), | 24 paused_proxies_(0), |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 163 |
162 // This method is called by |close_timer_|. | 164 // This method is called by |close_timer_|. |
163 void AudioOutputDispatcher::ClosePendingStreams() { | 165 void AudioOutputDispatcher::ClosePendingStreams() { |
164 DCHECK_EQ(MessageLoop::current(), message_loop_); | 166 DCHECK_EQ(MessageLoop::current(), message_loop_); |
165 | 167 |
166 while (!idle_streams_.empty()) { | 168 while (!idle_streams_.empty()) { |
167 idle_streams_.back()->Close(); | 169 idle_streams_.back()->Close(); |
168 idle_streams_.pop_back(); | 170 idle_streams_.pop_back(); |
169 } | 171 } |
170 } | 172 } |
| 173 |
| 174 } // namespace media |
OLD | NEW |