OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // AudioOutputDispatcher dispatches creation and deletion of audio | 5 // AudioOutputDispatcher dispatches creation and deletion of audio |
6 // output streams. AudioOutputProxy objects use this class to allocate | 6 // output streams. AudioOutputProxy objects use this class to allocate |
7 // and recycle actual audio output streams. When playback is started, | 7 // and recycle actual audio output streams. When playback is started, |
8 // the proxy calls StreamStarted() to get an output stream that it | 8 // the proxy calls StreamStarted() to get an output stream that it |
9 // uses to play the sound. When playback is stopped, the proxy returns | 9 // uses to play the sound. When playback is stopped, the proxy returns |
10 // the stream back to the dispatcher by calling StreamStopped(). | 10 // the stream back to the dispatcher by calling StreamStopped(). |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 #include "base/basictypes.h" | 27 #include "base/basictypes.h" |
28 #include "base/memory/ref_counted.h" | 28 #include "base/memory/ref_counted.h" |
29 #include "base/timer.h" | 29 #include "base/timer.h" |
30 #include "media/audio/audio_manager.h" | 30 #include "media/audio/audio_manager.h" |
31 #include "media/audio/audio_parameters.h" | 31 #include "media/audio/audio_parameters.h" |
32 | 32 |
33 class AudioOutputStream; | 33 class AudioOutputStream; |
34 class MessageLoop; | 34 class MessageLoop; |
35 | 35 |
36 class MEDIA_EXPORT AudioOutputDispatcher | 36 class AudioOutputDispatcher |
37 : public base::RefCountedThreadSafe<AudioOutputDispatcher> { | 37 : public base::RefCountedThreadSafe<AudioOutputDispatcher> { |
38 public: | 38 public: |
39 // |close_delay_ms| specifies delay after the stream is paused until | 39 // |close_delay_ms| specifies delay after the stream is paused until |
40 // the audio device is closed. | 40 // the audio device is closed. |
41 AudioOutputDispatcher(AudioManager* audio_manager, | 41 AudioOutputDispatcher(AudioManager* audio_manager, |
42 const AudioParameters& params, | 42 const AudioParameters& params, |
43 int close_delay_ms); | 43 int close_delay_ms); |
44 ~AudioOutputDispatcher(); | 44 ~AudioOutputDispatcher(); |
45 | 45 |
46 // Called by AudioOutputProxy when the stream is closed. Opens a new | 46 // Called by AudioOutputProxy when the stream is closed. Opens a new |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 int64 pause_delay_milliseconds_; | 92 int64 pause_delay_milliseconds_; |
93 size_t paused_proxies_; | 93 size_t paused_proxies_; |
94 std::vector<AudioOutputStream*> idle_streams_; | 94 std::vector<AudioOutputStream*> idle_streams_; |
95 std::list<AudioOutputStream*> pausing_streams_; | 95 std::list<AudioOutputStream*> pausing_streams_; |
96 base::DelayTimer<AudioOutputDispatcher> close_timer_; | 96 base::DelayTimer<AudioOutputDispatcher> close_timer_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); | 98 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); |
99 }; | 99 }; |
100 | 100 |
101 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | 101 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ |
OLD | NEW |