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 AudioOutputStream; |
35 class MessageLoop; | 36 class MessageLoop; |
36 | 37 |
37 namespace media { | |
38 | |
39 class AudioOutputStream; | |
40 | |
41 class MEDIA_EXPORT AudioOutputDispatcher | 38 class MEDIA_EXPORT AudioOutputDispatcher |
42 : public base::RefCountedThreadSafe<AudioOutputDispatcher> { | 39 : public base::RefCountedThreadSafe<AudioOutputDispatcher> { |
43 public: | 40 public: |
44 // |close_delay_ms| specifies delay after the stream is paused until | 41 // |close_delay_ms| specifies delay after the stream is paused until |
45 // the audio device is closed. | 42 // the audio device is closed. |
46 AudioOutputDispatcher(AudioManager* audio_manager, | 43 AudioOutputDispatcher(AudioManager* audio_manager, |
47 const AudioParameters& params, | 44 const AudioParameters& params, |
48 base::TimeDelta close_delay); | 45 base::TimeDelta close_delay); |
49 ~AudioOutputDispatcher(); | 46 ~AudioOutputDispatcher(); |
50 | 47 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 AudioOutputStreamList idle_streams_; | 100 AudioOutputStreamList idle_streams_; |
104 AudioOutputStreamList pausing_streams_; | 101 AudioOutputStreamList pausing_streams_; |
105 | 102 |
106 // Used to post delayed tasks to ourselves that we cancel inside Shutdown(). | 103 // Used to post delayed tasks to ourselves that we cancel inside Shutdown(). |
107 base::WeakPtrFactory<AudioOutputDispatcher> weak_this_; | 104 base::WeakPtrFactory<AudioOutputDispatcher> weak_this_; |
108 base::DelayTimer<AudioOutputDispatcher> close_timer_; | 105 base::DelayTimer<AudioOutputDispatcher> close_timer_; |
109 | 106 |
110 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); | 107 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); |
111 }; | 108 }; |
112 | 109 |
113 } // namespace media | |
114 | |
115 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | 110 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ |
OLD | NEW |