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 // AudioRendererHost serves audio related requests from AudioRenderer which | 5 // AudioRendererHost serves audio related requests from AudioRenderer which |
6 // lives inside the render process and provide access to audio hardware. | 6 // lives inside the render process and provide access to audio hardware. |
7 // | 7 // |
8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI | 8 // This class is owned by BrowserRenderProcessHost, and instantiated on UI |
9 // thread, but all other operations and method calls happen on IO thread, so we | 9 // thread, but all other operations and method calls happen on IO thread, so we |
10 // need to be extra careful about the lifetime of this object. AudioManager is a | 10 // need to be extra careful about the lifetime of this object. AudioManager is a |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 // A helper method to look up a AudioEntry identified by |stream_id|. | 203 // A helper method to look up a AudioEntry identified by |stream_id|. |
204 // Returns NULL if not found. | 204 // Returns NULL if not found. |
205 AudioEntry* LookupById(int stream_id); | 205 AudioEntry* LookupById(int stream_id); |
206 | 206 |
207 // Search for a AudioEntry having the reference to |controller|. | 207 // Search for a AudioEntry having the reference to |controller|. |
208 // This method is used to look up an AudioEntry after a controller | 208 // This method is used to look up an AudioEntry after a controller |
209 // event is received. | 209 // event is received. |
210 AudioEntry* LookupByController(media::AudioOutputController* controller); | 210 AudioEntry* LookupByController(media::AudioOutputController* controller); |
211 | 211 |
| 212 // Notifies |media_observer_| about various audio stream events. |
| 213 void OnSetAudioStreamPlaying(int stream_id, bool playing); |
| 214 void OnSetAudioStreamStatus(int stream_id, const std::string& status); |
| 215 void OnSetAudioStreamVolume(int stream_id, double volume); |
| 216 void OnDeleteAudioStream(int stream_id); |
| 217 |
212 // Return resource_context_->media_observer() or a cached copy thereof. | 218 // Return resource_context_->media_observer() or a cached copy thereof. |
213 // This is necessary because resource_context_ can be destructed before all | 219 // This is necessary because resource_context_ can be destructed before all |
214 // AudioEntries have been deleted. The MediaObserver's lifetime is tied to | 220 // AudioEntries have been deleted. The MediaObserver's lifetime is tied to |
215 // that of the IO thread, so this is safe. | 221 // that of the IO thread, so this is safe. |
216 MediaObserver* media_observer(); | 222 MediaObserver* media_observer(); |
217 | 223 |
218 // A map of stream IDs to audio sources. | 224 // A map of stream IDs to audio sources. |
219 AudioEntryMap audio_entries_; | 225 AudioEntryMap audio_entries_; |
220 | 226 |
221 const content::ResourceContext* resource_context_; | 227 const content::ResourceContext* resource_context_; |
222 MediaObserver* media_observer_; | 228 MediaObserver* media_observer_; |
223 | 229 |
224 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 230 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
225 }; | 231 }; |
226 | 232 |
227 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 233 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
OLD | NEW |