| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // Send an error message to the renderer. | 152 // Send an error message to the renderer. |
| 153 void SendErrorMessage(int stream_id); | 153 void SendErrorMessage(int stream_id); |
| 154 | 154 |
| 155 // Delete all audio entry and all audio streams | 155 // Delete all audio entry and all audio streams |
| 156 void DeleteEntries(); | 156 void DeleteEntries(); |
| 157 | 157 |
| 158 // Closes the stream. The stream is then deleted in DeleteEntry() after it | 158 // Closes the stream. The stream is then deleted in DeleteEntry() after it |
| 159 // is closed. | 159 // is closed. |
| 160 void CloseAndDeleteStream(AudioEntry* entry); | 160 void CloseAndDeleteStream(AudioEntry* entry); |
| 161 | 161 |
| 162 // Called on the audio thread after the audio stream is closed. | |
| 163 void OnStreamClosed(AudioEntry* entry); | |
| 164 | |
| 165 // Delete an audio entry and close the related audio stream. | 162 // Delete an audio entry and close the related audio stream. |
| 166 void DeleteEntry(AudioEntry* entry); | 163 void DeleteEntry(AudioEntry* entry); |
| 167 | 164 |
| 168 // Delete audio entry and close the related audio stream due to an error, | 165 // Delete audio entry and close the related audio stream due to an error, |
| 169 // and error message is send to the renderer. | 166 // and error message is send to the renderer. |
| 170 void DeleteEntryOnError(AudioEntry* entry); | 167 void DeleteEntryOnError(AudioEntry* entry); |
| 171 | 168 |
| 172 // A helper method to look up a AudioEntry identified by |stream_id|. | 169 // A helper method to look up a AudioEntry identified by |stream_id|. |
| 173 // Returns NULL if not found. | 170 // Returns NULL if not found. |
| 174 AudioEntry* LookupById(int stream_id); | 171 AudioEntry* LookupById(int stream_id); |
| 175 | 172 |
| 176 // Search for a AudioEntry having the reference to |controller|. | 173 // Search for a AudioEntry having the reference to |controller|. |
| 177 // This method is used to look up an AudioEntry after a controller | 174 // This method is used to look up an AudioEntry after a controller |
| 178 // event is received. | 175 // event is received. |
| 179 AudioEntry* LookupByController(media::AudioOutputController* controller); | 176 AudioEntry* LookupByController(media::AudioOutputController* controller); |
| 180 | 177 |
| 181 // A map of stream IDs to audio sources. | 178 // A map of stream IDs to audio sources. |
| 182 AudioEntryMap audio_entries_; | 179 AudioEntryMap audio_entries_; |
| 183 | 180 |
| 184 AudioManager* audio_manager_; | 181 AudioManager* audio_manager_; |
| 185 content::MediaObserver* media_observer_; | 182 content::MediaObserver* media_observer_; |
| 186 | 183 |
| 187 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 184 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 188 }; | 185 }; |
| 189 | 186 |
| 190 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 187 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |