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 // Audio rendering unit utilizing audio output stream provided by browser | 5 // Audio rendering unit utilizing audio output stream provided by browser |
6 // process through IPC. | 6 // process through IPC. |
7 // | 7 // |
8 // Relationship of classes. | 8 // Relationship of classes. |
9 // | 9 // |
10 // AudioOutputController AudioOutputDevice | 10 // AudioOutputController AudioOutputDevice |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 : NON_EXPORTED_BASE(public AudioRendererSink), | 76 : NON_EXPORTED_BASE(public AudioRendererSink), |
77 public AudioOutputIPCDelegate, | 77 public AudioOutputIPCDelegate, |
78 NON_EXPORTED_BASE(public ScopedLoopObserver) { | 78 NON_EXPORTED_BASE(public ScopedLoopObserver) { |
79 public: | 79 public: |
80 // AudioRendererSink implementation. | 80 // AudioRendererSink implementation. |
81 virtual void Initialize(const AudioParameters& params, | 81 virtual void Initialize(const AudioParameters& params, |
82 RenderCallback* callback) OVERRIDE; | 82 RenderCallback* callback) OVERRIDE; |
83 virtual void Start() OVERRIDE; | 83 virtual void Start() OVERRIDE; |
84 virtual void Stop() OVERRIDE; | 84 virtual void Stop() OVERRIDE; |
85 virtual void Play() OVERRIDE; | 85 virtual void Play() OVERRIDE; |
86 virtual void Pause(bool flush) OVERRIDE; | 86 virtual void Pause() OVERRIDE; |
87 virtual bool SetVolume(double volume) OVERRIDE; | 87 virtual bool SetVolume(double volume) OVERRIDE; |
88 | 88 |
89 // Methods called on IO thread ---------------------------------------------- | 89 // Methods called on IO thread ---------------------------------------------- |
90 // AudioOutputIPCDelegate methods. | 90 // AudioOutputIPCDelegate methods. |
91 virtual void OnStateChanged(AudioOutputIPCDelegate::State state) OVERRIDE; | 91 virtual void OnStateChanged(AudioOutputIPCDelegate::State state) OVERRIDE; |
92 virtual void OnStreamCreated(base::SharedMemoryHandle handle, | 92 virtual void OnStreamCreated(base::SharedMemoryHandle handle, |
93 base::SyncSocket::Handle socket_handle, | 93 base::SyncSocket::Handle socket_handle, |
94 int length) OVERRIDE; | 94 int length) OVERRIDE; |
95 virtual void OnIPCClosed() OVERRIDE; | 95 virtual void OnIPCClosed() OVERRIDE; |
96 | 96 |
(...skipping 21 matching lines...) Expand all Loading... |
118 PAUSED, // Paused. OnStreamCreated() has been called. Can Play()/Stop(). | 118 PAUSED, // Paused. OnStreamCreated() has been called. Can Play()/Stop(). |
119 PLAYING, // Playing back. Can Pause()/Stop(). | 119 PLAYING, // Playing back. Can Pause()/Stop(). |
120 }; | 120 }; |
121 | 121 |
122 // Methods called on IO thread ---------------------------------------------- | 122 // Methods called on IO thread ---------------------------------------------- |
123 // The following methods are tasks posted on the IO thread that needs to | 123 // The following methods are tasks posted on the IO thread that needs to |
124 // be executed on that thread. They interact with AudioMessageFilter and | 124 // be executed on that thread. They interact with AudioMessageFilter and |
125 // sends IPC messages on that thread. | 125 // sends IPC messages on that thread. |
126 void CreateStreamOnIOThread(const AudioParameters& params); | 126 void CreateStreamOnIOThread(const AudioParameters& params); |
127 void PlayOnIOThread(); | 127 void PlayOnIOThread(); |
128 void PauseOnIOThread(bool flush); | 128 void PauseOnIOThread(); |
129 void ShutDownOnIOThread(); | 129 void ShutDownOnIOThread(); |
130 void SetVolumeOnIOThread(double volume); | 130 void SetVolumeOnIOThread(double volume); |
131 | 131 |
132 // MessageLoop::DestructionObserver implementation for the IO loop. | 132 // MessageLoop::DestructionObserver implementation for the IO loop. |
133 // If the IO loop dies before we do, we shut down the audio thread from here. | 133 // If the IO loop dies before we do, we shut down the audio thread from here. |
134 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 134 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; |
135 | 135 |
136 AudioParameters audio_parameters_; | 136 AudioParameters audio_parameters_; |
137 | 137 |
138 RenderCallback* callback_; | 138 RenderCallback* callback_; |
(...skipping 29 matching lines...) Expand all Loading... |
168 // TODO(scherkus): Replace this by changing AudioRendererSink to either accept | 168 // TODO(scherkus): Replace this by changing AudioRendererSink to either accept |
169 // the callback via Start(). See http://crbug.com/151051 for details. | 169 // the callback via Start(). See http://crbug.com/151051 for details. |
170 bool stopping_hack_; | 170 bool stopping_hack_; |
171 | 171 |
172 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); | 172 DISALLOW_COPY_AND_ASSIGN(AudioOutputDevice); |
173 }; | 173 }; |
174 | 174 |
175 } // namespace media | 175 } // namespace media |
176 | 176 |
177 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ | 177 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_DEVICE_H_ |
OLD | NEW |