| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // AudioOutputController after it has closed. | 150 // AudioOutputController after it has closed. |
| 151 void DeleteEntry(scoped_ptr<AudioEntry> entry); | 151 void DeleteEntry(scoped_ptr<AudioEntry> entry); |
| 152 | 152 |
| 153 // Send an error message to the renderer, then close the stream. | 153 // Send an error message to the renderer, then close the stream. |
| 154 void ReportErrorAndClose(int stream_id); | 154 void ReportErrorAndClose(int stream_id); |
| 155 | 155 |
| 156 // A helper method to look up a AudioEntry identified by |stream_id|. | 156 // A helper method to look up a AudioEntry identified by |stream_id|. |
| 157 // Returns NULL if not found. | 157 // Returns NULL if not found. |
| 158 AudioEntry* LookupById(int stream_id); | 158 AudioEntry* LookupById(int stream_id); |
| 159 | 159 |
| 160 // A helper method to update the number of playing streams and alert the |
| 161 // ResourceScheduler when the renderer starts or stops playing an audiostream. |
| 162 void UpdateNumPlayingStreams(AudioEntry* entry, bool is_playing); |
| 163 |
| 164 // Returns true if any streams managed by the RenderView identified by |
| 165 // |render_view_id| are actively playing. |
| 166 bool RenderViewHasActiveAudio(int render_view_id); |
| 167 |
| 160 // ID of the RenderProcessHost that owns this instance. | 168 // ID of the RenderProcessHost that owns this instance. |
| 161 const int render_process_id_; | 169 const int render_process_id_; |
| 162 | 170 |
| 163 media::AudioManager* const audio_manager_; | 171 media::AudioManager* const audio_manager_; |
| 164 AudioMirroringManager* const mirroring_manager_; | 172 AudioMirroringManager* const mirroring_manager_; |
| 165 scoped_ptr<media::AudioLog> audio_log_; | 173 scoped_ptr<media::AudioLog> audio_log_; |
| 166 | 174 |
| 167 // Used to access to AudioInputDeviceManager. | 175 // Used to access to AudioInputDeviceManager. |
| 168 MediaStreamManager* media_stream_manager_; | 176 MediaStreamManager* media_stream_manager_; |
| 169 | 177 |
| 170 // A map of stream IDs to audio sources. | 178 // A map of stream IDs to audio sources. |
| 171 AudioEntryMap audio_entries_; | 179 AudioEntryMap audio_entries_; |
| 172 | 180 |
| 173 // The number of streams in the playing state. | 181 // The number of streams in the playing state. |
| 174 base::AtomicRefCount num_playing_streams_; | 182 base::AtomicRefCount num_playing_streams_; |
| 175 | 183 |
| 176 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 184 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 177 }; | 185 }; |
| 178 | 186 |
| 179 } // namespace content | 187 } // namespace content |
| 180 | 188 |
| 181 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 189 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |