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 // AudioOutputDispatcher is a single-threaded class that dispatches creation and | 5 // AudioOutputDispatcher is a single-threaded class that dispatches creation and |
6 // deletion of audio output streams. AudioOutputProxy objects use this class to | 6 // deletion of audio output streams. AudioOutputProxy objects use this class to |
7 // allocate and recycle actual audio output streams. When playback is started, | 7 // allocate and recycle actual audio output streams. When playback is started, |
8 // the proxy calls StreamStarted() to get an output stream that it uses to play | 8 // the proxy calls StreamStarted() to get an output stream that it uses to play |
9 // audio. When playback is stopped, the proxy returns the stream back to the | 9 // audio. When playback is stopped, the proxy returns the stream back to the |
10 // dispatcher by calling StreamStopped(). | 10 // dispatcher by calling StreamStopped(). |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include <vector> | 25 #include <vector> |
26 #include <list> | 26 #include <list> |
27 | 27 |
28 #include "base/basictypes.h" | 28 #include "base/basictypes.h" |
29 #include "base/memory/ref_counted.h" | 29 #include "base/memory/ref_counted.h" |
30 #include "base/memory/weak_ptr.h" | 30 #include "base/memory/weak_ptr.h" |
31 #include "base/timer.h" | 31 #include "base/timer.h" |
32 #include "media/audio/audio_manager.h" | 32 #include "media/audio/audio_manager.h" |
33 #include "media/audio/audio_parameters.h" | 33 #include "media/audio/audio_parameters.h" |
34 | 34 |
| 35 class MessageLoop; |
| 36 |
| 37 namespace media { |
| 38 |
35 class AudioOutputStream; | 39 class AudioOutputStream; |
36 class MessageLoop; | |
37 | 40 |
38 class MEDIA_EXPORT AudioOutputDispatcher | 41 class MEDIA_EXPORT AudioOutputDispatcher |
39 : public base::RefCountedThreadSafe<AudioOutputDispatcher> { | 42 : public base::RefCountedThreadSafe<AudioOutputDispatcher> { |
40 public: | 43 public: |
41 // |close_delay_ms| specifies delay after the stream is paused until | 44 // |close_delay_ms| specifies delay after the stream is paused until |
42 // the audio device is closed. | 45 // the audio device is closed. |
43 AudioOutputDispatcher(AudioManager* audio_manager, | 46 AudioOutputDispatcher(AudioManager* audio_manager, |
44 const AudioParameters& params, | 47 const AudioParameters& params, |
45 base::TimeDelta close_delay); | 48 base::TimeDelta close_delay); |
46 ~AudioOutputDispatcher(); | 49 ~AudioOutputDispatcher(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 AudioOutputStreamList idle_streams_; | 103 AudioOutputStreamList idle_streams_; |
101 AudioOutputStreamList pausing_streams_; | 104 AudioOutputStreamList pausing_streams_; |
102 | 105 |
103 // Used to post delayed tasks to ourselves that we cancel inside Shutdown(). | 106 // Used to post delayed tasks to ourselves that we cancel inside Shutdown(). |
104 base::WeakPtrFactory<AudioOutputDispatcher> weak_this_; | 107 base::WeakPtrFactory<AudioOutputDispatcher> weak_this_; |
105 base::DelayTimer<AudioOutputDispatcher> close_timer_; | 108 base::DelayTimer<AudioOutputDispatcher> close_timer_; |
106 | 109 |
107 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); | 110 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); |
108 }; | 111 }; |
109 | 112 |
| 113 } // namespace media |
| 114 |
110 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | 115 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ |
OLD | NEW |