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 // Returns the MediaObserver from |resource_context_| or NULL if none exists. |
182 // This is necessary because resource_context_ can be destructed before all | |
183 // AudioEntries have been deleted. The MediaObserver's lifetime is tied to | |
184 // that of the IO thread, so this is safe. | |
185 content::MediaObserver* GetMediaObserver(); | 182 content::MediaObserver* GetMediaObserver(); |
186 | 183 |
187 // A map of stream IDs to audio sources. | 184 // A map of stream IDs to audio sources. |
188 AudioEntryMap audio_entries_; | 185 AudioEntryMap audio_entries_; |
189 | 186 |
190 content::ResourceContext* resource_context_; | 187 content::ResourceContext* resource_context_; |
191 AudioManager* audio_manager_; | 188 AudioManager* audio_manager_; |
192 content::MediaObserver* media_observer_; | |
193 | 189 |
194 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 190 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
195 }; | 191 }; |
196 | 192 |
197 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 193 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
OLD | NEW |