| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 class ResourceContext; | 79 class ResourceContext; |
| 80 | 80 |
| 81 class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter { | 81 class CONTENT_EXPORT AudioRendererHost : public BrowserMessageFilter { |
| 82 public: | 82 public: |
| 83 // Called from UI thread from the owner of this object. | 83 // Called from UI thread from the owner of this object. |
| 84 AudioRendererHost(int render_process_id, | 84 AudioRendererHost(int render_process_id, |
| 85 media::AudioManager* audio_manager, | 85 media::AudioManager* audio_manager, |
| 86 AudioMirroringManager* mirroring_manager, | 86 AudioMirroringManager* mirroring_manager, |
| 87 MediaInternals* media_internals, | 87 MediaInternals* media_internals, |
| 88 MediaStreamManager* media_stream_manager, | 88 MediaStreamManager* media_stream_manager, |
| 89 const ResourceContext::SaltCallback& salt_callback); | 89 const std::string& salt); |
| 90 | 90 |
| 91 // Calls |callback| with the list of AudioOutputControllers for this object. | 91 // Calls |callback| with the list of AudioOutputControllers for this object. |
| 92 void GetOutputControllers( | 92 void GetOutputControllers( |
| 93 const RenderProcessHost::GetAudioOutputControllersCallback& | 93 const RenderProcessHost::GetAudioOutputControllersCallback& |
| 94 callback) const; | 94 callback) const; |
| 95 | 95 |
| 96 // BrowserMessageFilter implementation. | 96 // BrowserMessageFilter implementation. |
| 97 void OnChannelClosing() override; | 97 void OnChannelClosing() override; |
| 98 void OnDestruct() const override; | 98 void OnDestruct() const override; |
| 99 bool OnMessageReceived(const IPC::Message& message) override; | 99 bool OnMessageReceived(const IPC::Message& message) override; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 MediaStreamManager* media_stream_manager_; | 248 MediaStreamManager* media_stream_manager_; |
| 249 | 249 |
| 250 // A map of stream IDs to audio sources. | 250 // A map of stream IDs to audio sources. |
| 251 AudioEntryMap audio_entries_; | 251 AudioEntryMap audio_entries_; |
| 252 | 252 |
| 253 // The number of streams in the playing state. Atomic read safe from any | 253 // The number of streams in the playing state. Atomic read safe from any |
| 254 // thread, but should only be updated from the IO thread. | 254 // thread, but should only be updated from the IO thread. |
| 255 base::AtomicRefCount num_playing_streams_; | 255 base::AtomicRefCount num_playing_streams_; |
| 256 | 256 |
| 257 // Salt required to translate renderer device IDs to raw device unique IDs | 257 // Salt required to translate renderer device IDs to raw device unique IDs |
| 258 ResourceContext::SaltCallback salt_callback_; | 258 std::string salt_; |
| 259 | 259 |
| 260 // Map of device authorizations for streams that are not yet created | 260 // Map of device authorizations for streams that are not yet created |
| 261 // The key is the stream ID, and the value is a pair. The pair's first element | 261 // The key is the stream ID, and the value is a pair. The pair's first element |
| 262 // is a bool that is true if the authorization process completes successfully. | 262 // is a bool that is true if the authorization process completes successfully. |
| 263 // The second element contains the unique ID of the authorized device. | 263 // The second element contains the unique ID of the authorized device. |
| 264 std::map<int, std::pair<bool, std::string>> authorizations_; | 264 std::map<int, std::pair<bool, std::string>> authorizations_; |
| 265 | 265 |
| 266 // The maximum number of simultaneous streams during the lifetime of this | 266 // The maximum number of simultaneous streams during the lifetime of this |
| 267 // host. Reported as UMA stat at shutdown. | 267 // host. Reported as UMA stat at shutdown. |
| 268 size_t max_simultaneous_streams_; | 268 size_t max_simultaneous_streams_; |
| 269 | 269 |
| 270 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 270 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 271 }; | 271 }; |
| 272 | 272 |
| 273 } // namespace content | 273 } // namespace content |
| 274 | 274 |
| 275 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 275 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |