| 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 // 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 // A helper method to look up a AudioEntry identified by |stream_id|. | 172 // A helper method to look up a AudioEntry identified by |stream_id|. |
| 173 // Returns NULL if not found. | 173 // Returns NULL if not found. |
| 174 AudioEntry* LookupById(int stream_id); | 174 AudioEntry* LookupById(int stream_id); |
| 175 | 175 |
| 176 // Search for a AudioEntry having the reference to |controller|. | 176 // Search for a AudioEntry having the reference to |controller|. |
| 177 // This method is used to look up an AudioEntry after a controller | 177 // This method is used to look up an AudioEntry after a controller |
| 178 // event is received. | 178 // event is received. |
| 179 AudioEntry* LookupByController(media::AudioOutputController* controller); | 179 AudioEntry* LookupByController(media::AudioOutputController* controller); |
| 180 | 180 |
| 181 // Return resource_context_->media_observer() or a cached copy thereof. | 181 // Notifies the MediaObserver about various audio stream events. |
| 182 // This is necessary because resource_context_ can be destructed before all | 182 void OnSetAudioStreamPlaying(int stream_id, bool playing); |
| 183 void OnSetAudioStreamStatus(int stream_id, const std::string& status); |
| 184 void OnSetAudioStreamVolume(int stream_id, double volume); |
| 185 void OnDeleteAudioStream(int stream_id); |
| 186 |
| 187 // Return the MediaObserver from |resource_context_| or a cached copy thereof. |
| 188 // This is necessary because |resource_context_| can be destructed before all |
| 183 // AudioEntries have been deleted. The MediaObserver's lifetime is tied to | 189 // AudioEntries have been deleted. The MediaObserver's lifetime is tied to |
| 184 // that of the IO thread, so this is safe. | 190 // that of the IO thread, so this is safe. |
| 191 // TODO(vrk): Saving the |media_observer_| pointer is a hack! We shouldn't |
| 192 // need to do this and the field should be removed. See crbug.com/116906. |
| 185 content::MediaObserver* GetMediaObserver(); | 193 content::MediaObserver* GetMediaObserver(); |
| 186 | 194 |
| 187 // A map of stream IDs to audio sources. | 195 // A map of stream IDs to audio sources. |
| 188 AudioEntryMap audio_entries_; | 196 AudioEntryMap audio_entries_; |
| 189 | 197 |
| 190 content::ResourceContext* resource_context_; | 198 content::ResourceContext* resource_context_; |
| 191 AudioManager* audio_manager_; | 199 AudioManager* audio_manager_; |
| 192 content::MediaObserver* media_observer_; | 200 content::MediaObserver* media_observer_; |
| 193 | 201 |
| 194 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 202 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 195 }; | 203 }; |
| 196 | 204 |
| 197 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 205 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |