| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // added to the pool of pending streams (i.e. |idle_streams_|). | 62 // added to the pool of pending streams (i.e. |idle_streams_|). |
| 63 // Ownership of the |stream| is passed to the dispatcher. | 63 // Ownership of the |stream| is passed to the dispatcher. |
| 64 void StreamStopped(AudioOutputStream* stream); | 64 void StreamStopped(AudioOutputStream* stream); |
| 65 | 65 |
| 66 // Called by AudioOutputProxy when the stream is closed. | 66 // Called by AudioOutputProxy when the stream is closed. |
| 67 void StreamClosed(); | 67 void StreamClosed(); |
| 68 | 68 |
| 69 // Called on the audio thread when the AudioManager is shutting down. | 69 // Called on the audio thread when the AudioManager is shutting down. |
| 70 void Shutdown(); | 70 void Shutdown(); |
| 71 | 71 |
| 72 MessageLoop* message_loop(); | |
| 73 | |
| 74 private: | 72 private: |
| 75 friend class AudioOutputProxyTest; | 73 friend class AudioOutputProxyTest; |
| 76 | 74 |
| 77 // Creates a new physical output stream, opens it and pushes to | 75 // Creates a new physical output stream, opens it and pushes to |
| 78 // |idle_streams_|. Returns false if the stream couldn't be created or | 76 // |idle_streams_|. Returns false if the stream couldn't be created or |
| 79 // opened. | 77 // opened. |
| 80 bool CreateAndOpenStream(); | 78 bool CreateAndOpenStream(); |
| 81 | 79 |
| 82 // A task scheduled by StreamStarted(). Opens a new stream and puts | 80 // A task scheduled by StreamStarted(). Opens a new stream and puts |
| 83 // it in |idle_streams_|. | 81 // it in |idle_streams_|. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 103 AudioOutputStreamList pausing_streams_; | 101 AudioOutputStreamList pausing_streams_; |
| 104 | 102 |
| 105 // 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(). |
| 106 base::WeakPtrFactory<AudioOutputDispatcher> weak_this_; | 104 base::WeakPtrFactory<AudioOutputDispatcher> weak_this_; |
| 107 base::DelayTimer<AudioOutputDispatcher> close_timer_; | 105 base::DelayTimer<AudioOutputDispatcher> close_timer_; |
| 108 | 106 |
| 109 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); | 107 DISALLOW_COPY_AND_ASSIGN(AudioOutputDispatcher); |
| 110 }; | 108 }; |
| 111 | 109 |
| 112 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ | 110 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DISPATCHER_H_ |
| OLD | NEW |