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 RenderProcessHostImpl, and instantiated on UI | 8 // This class is owned by RenderProcessHostImpl, 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 public media::AudioOutputDelegate::EventHandler { | 73 public media::AudioOutputDelegate::EventHandler { |
74 public: | 74 public: |
75 // Called from UI thread from the owner of this object. | 75 // Called from UI thread from the owner of this object. |
76 AudioRendererHost(int render_process_id, | 76 AudioRendererHost(int render_process_id, |
77 media::AudioManager* audio_manager, | 77 media::AudioManager* audio_manager, |
78 media::AudioSystem* audio_system, | 78 media::AudioSystem* audio_system, |
79 AudioMirroringManager* mirroring_manager, | 79 AudioMirroringManager* mirroring_manager, |
80 MediaStreamManager* media_stream_manager, | 80 MediaStreamManager* media_stream_manager, |
81 const std::string& salt); | 81 const std::string& salt); |
82 | 82 |
83 // Calls |callback| with the list of AudioOutputControllers for this object. | |
84 void GetOutputControllers( | |
85 const RenderProcessHost::GetAudioOutputControllersCallback& | |
86 callback) const; | |
87 | |
88 // BrowserMessageFilter implementation. | 83 // BrowserMessageFilter implementation. |
89 void OnChannelClosing() override; | 84 void OnChannelClosing() override; |
90 void OnDestruct() const override; | 85 void OnDestruct() const override; |
91 bool OnMessageReceived(const IPC::Message& message) override; | 86 bool OnMessageReceived(const IPC::Message& message) override; |
92 | 87 |
93 // AudioOutputDelegate::EventHandler implementation | 88 // AudioOutputDelegate::EventHandler implementation |
94 void OnStreamCreated(int stream_id, | 89 void OnStreamCreated(int stream_id, |
95 base::SharedMemory* shared_memory, | 90 base::SharedMemory* shared_memory, |
96 base::CancelableSyncSocket* foreign_socket) override; | 91 base::CancelableSyncSocket* foreign_socket) override; |
97 void OnStreamError(int stream_id) override; | 92 void OnStreamError(int stream_id) override; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Helper methods. | 167 // Helper methods. |
173 | 168 |
174 // Called after the |render_frame_id| provided to OnCreateStream() was | 169 // Called after the |render_frame_id| provided to OnCreateStream() was |
175 // validated. When |is_valid| is false, this calls OnStreamError(). | 170 // validated. When |is_valid| is false, this calls OnStreamError(). |
176 void DidValidateRenderFrame(int stream_id, bool is_valid); | 171 void DidValidateRenderFrame(int stream_id, bool is_valid); |
177 | 172 |
178 // Updates status of stream for AudioStreamMonitor and updates | 173 // Updates status of stream for AudioStreamMonitor and updates |
179 // the number of playing streams. | 174 // the number of playing streams. |
180 void StreamStateChanged(int stream_id, bool is_playing); | 175 void StreamStateChanged(int stream_id, bool is_playing); |
181 | 176 |
182 RenderProcessHost::AudioOutputControllerList DoGetOutputControllers() const; | |
183 | |
184 // Send an error message to the renderer. | 177 // Send an error message to the renderer. |
185 void SendErrorMessage(int stream_id); | 178 void SendErrorMessage(int stream_id); |
186 | 179 |
187 // Helper methods to look up a AudioOutputDelegate identified by |stream_id|. | 180 // Helper methods to look up a AudioOutputDelegate identified by |stream_id|. |
188 // Returns delegates_.end() if not found. | 181 // Returns delegates_.end() if not found. |
189 AudioOutputDelegateVector::iterator LookupIteratorById(int stream_id); | 182 AudioOutputDelegateVector::iterator LookupIteratorById(int stream_id); |
190 // Returns nullptr if not found. | 183 // Returns nullptr if not found. |
191 media::AudioOutputDelegate* LookupById(int stream_id); | 184 media::AudioOutputDelegate* LookupById(int stream_id); |
192 | 185 |
193 // Helper method to check if the authorization procedure for stream | 186 // Helper method to check if the authorization procedure for stream |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 ValidateRenderFrameIdFunction validate_render_frame_id_function_; | 221 ValidateRenderFrameIdFunction validate_render_frame_id_function_; |
229 | 222 |
230 AudioOutputAuthorizationHandler authorization_handler_; | 223 AudioOutputAuthorizationHandler authorization_handler_; |
231 | 224 |
232 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 225 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
233 }; | 226 }; |
234 | 227 |
235 } // namespace content | 228 } // namespace content |
236 | 229 |
237 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 230 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
OLD | NEW |