| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 namespace content { | 60 namespace content { |
| 61 | 61 |
| 62 class MediaObserver; | 62 class MediaObserver; |
| 63 class ResourceContext; | 63 class ResourceContext; |
| 64 | 64 |
| 65 class CONTENT_EXPORT AudioRendererHost | 65 class CONTENT_EXPORT AudioRendererHost |
| 66 : public BrowserMessageFilter, | 66 : public BrowserMessageFilter, |
| 67 public media::AudioOutputController::EventHandler { | 67 public media::AudioOutputController::EventHandler { |
| 68 public: | 68 public: |
| 69 // Called from UI thread from the owner of this object. | 69 // Called from UI thread from the owner of this object. |
| 70 AudioRendererHost(media::AudioManager* audio_manager, | 70 AudioRendererHost(int render_process_id, |
| 71 media::AudioManager* audio_manager, |
| 71 MediaObserver* media_observer); | 72 MediaObserver* media_observer); |
| 72 | 73 |
| 73 // BrowserMessageFilter implementation. | 74 // BrowserMessageFilter implementation. |
| 74 virtual void OnChannelClosing() OVERRIDE; | 75 virtual void OnChannelClosing() OVERRIDE; |
| 75 virtual void OnDestruct() const OVERRIDE; | 76 virtual void OnDestruct() const OVERRIDE; |
| 76 virtual bool OnMessageReceived(const IPC::Message& message, | 77 virtual bool OnMessageReceived(const IPC::Message& message, |
| 77 bool* message_was_ok) OVERRIDE; | 78 bool* message_was_ok) OVERRIDE; |
| 78 | 79 |
| 79 // AudioOutputController::EventHandler implementations. | 80 // AudioOutputController::EventHandler implementations. |
| 80 virtual void OnCreated(media::AudioOutputController* controller) OVERRIDE; | 81 virtual void OnCreated(media::AudioOutputController* controller) OVERRIDE; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // Returns NULL if not found. | 158 // Returns NULL if not found. |
| 158 AudioEntry* LookupById(int stream_id); | 159 AudioEntry* LookupById(int stream_id); |
| 159 | 160 |
| 160 // Search for a AudioEntry having the reference to |controller|. | 161 // Search for a AudioEntry having the reference to |controller|. |
| 161 // This method is used to look up an AudioEntry after a controller | 162 // This method is used to look up an AudioEntry after a controller |
| 162 // event is received. | 163 // event is received. |
| 163 AudioEntry* LookupByController(media::AudioOutputController* controller); | 164 AudioEntry* LookupByController(media::AudioOutputController* controller); |
| 164 | 165 |
| 165 media::AudioOutputController* LookupControllerByIdForTesting(int stream_id); | 166 media::AudioOutputController* LookupControllerByIdForTesting(int stream_id); |
| 166 | 167 |
| 168 int render_process_id_; |
| 169 |
| 167 // A map of stream IDs to audio sources. | 170 // A map of stream IDs to audio sources. |
| 168 AudioEntryMap audio_entries_; | 171 AudioEntryMap audio_entries_; |
| 169 | 172 |
| 170 media::AudioManager* audio_manager_; | 173 media::AudioManager* audio_manager_; |
| 171 MediaObserver* media_observer_; | 174 MediaObserver* media_observer_; |
| 172 | 175 |
| 173 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 176 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
| 174 }; | 177 }; |
| 175 | 178 |
| 176 } // namespace content | 179 } // namespace content |
| 177 | 180 |
| 178 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 181 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
| OLD | NEW |