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