| 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( | 89 void OnStreamCreated( |
| 95 int stream_id, | 90 int stream_id, |
| 96 base::SharedMemory* shared_memory, | 91 base::SharedMemory* shared_memory, |
| 97 std::unique_ptr<base::CancelableSyncSocket> foreign_socket) override; | 92 std::unique_ptr<base::CancelableSyncSocket> foreign_socket) override; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // Helper methods. | 168 // Helper methods. |
| 174 | 169 |
| 175 // Called after the |render_frame_id| provided to OnCreateStream() was | 170 // Called after the |render_frame_id| provided to OnCreateStream() was |
| 176 // validated. When |is_valid| is false, this calls OnStreamError(). | 171 // validated. When |is_valid| is false, this calls OnStreamError(). |
| 177 void DidValidateRenderFrame(int stream_id, bool is_valid); | 172 void DidValidateRenderFrame(int stream_id, bool is_valid); |
| 178 | 173 |
| 179 // Updates status of stream for AudioStreamMonitor and updates | 174 // Updates status of stream for AudioStreamMonitor and updates |
| 180 // the number of playing streams. | 175 // the number of playing streams. |
| 181 void StreamStateChanged(int stream_id, bool is_playing); | 176 void StreamStateChanged(int stream_id, bool is_playing); |
| 182 | 177 |
| 183 RenderProcessHost::AudioOutputControllerList DoGetOutputControllers() const; | |
| 184 | |
| 185 // Send an error message to the renderer. | 178 // Send an error message to the renderer. |
| 186 void SendErrorMessage(int stream_id); | 179 void SendErrorMessage(int stream_id); |
| 187 | 180 |
| 188 // Helper methods to look up a AudioOutputDelegate identified by |stream_id|. | 181 // Helper methods to look up a AudioOutputDelegate identified by |stream_id|. |
| 189 // Returns delegates_.end() if not found. | 182 // Returns delegates_.end() if not found. |
| 190 AudioOutputDelegateVector::iterator LookupIteratorById(int stream_id); | 183 AudioOutputDelegateVector::iterator LookupIteratorById(int stream_id); |
| 191 // Returns nullptr if not found. | 184 // Returns nullptr if not found. |
| 192 media::AudioOutputDelegate* LookupById(int stream_id); | 185 media::AudioOutputDelegate* LookupById(int stream_id); |
| 193 | 186 |
| 194 // Helper method to check if the authorization procedure for stream | 187 // Helper method to check if the authorization procedure for stream |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 ValidateRenderFrameIdFunction validate_render_frame_id_function_; | 222 ValidateRenderFrameIdFunction validate_render_frame_id_function_; |
| 230 | 223 |
| 231 AudioOutputAuthorizationHandler authorization_handler_; | 224 AudioOutputAuthorizationHandler authorization_handler_; |
| 232 | 225 |
| 233 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 226 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 234 }; | 227 }; |
| 235 | 228 |
| 236 } // namespace content | 229 } // namespace content |
| 237 | 230 |
| 238 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 231 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |