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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 #include "media/audio/audio_output_controller.h" | 52 #include "media/audio/audio_output_controller.h" |
53 #include "media/audio/simple_sources.h" | 53 #include "media/audio/simple_sources.h" |
54 | 54 |
55 namespace media { | 55 namespace media { |
56 class AudioManager; | 56 class AudioManager; |
57 class AudioParameters; | 57 class AudioParameters; |
58 } | 58 } |
59 | 59 |
60 namespace content { | 60 namespace content { |
61 | 61 |
62 class AudioMirroringManager; | |
62 class MediaObserver; | 63 class MediaObserver; |
63 class ResourceContext; | 64 class ResourceContext; |
64 | 65 |
65 class CONTENT_EXPORT AudioRendererHost | 66 class CONTENT_EXPORT AudioRendererHost |
66 : public BrowserMessageFilter, | 67 : public BrowserMessageFilter, |
67 public media::AudioOutputController::EventHandler { | 68 public media::AudioOutputController::EventHandler { |
68 public: | 69 public: |
69 // Called from UI thread from the owner of this object. | 70 // Called from UI thread from the owner of this object. |
70 AudioRendererHost(media::AudioManager* audio_manager, | 71 AudioRendererHost(int render_process_id, |
72 media::AudioManager* audio_manager, | |
73 AudioMirroringManager* mirroring_manager, | |
71 MediaObserver* media_observer); | 74 MediaObserver* media_observer); |
72 | 75 |
73 // BrowserMessageFilter implementation. | 76 // BrowserMessageFilter implementation. |
74 virtual void OnChannelClosing() OVERRIDE; | 77 virtual void OnChannelClosing() OVERRIDE; |
75 virtual void OnDestruct() const OVERRIDE; | 78 virtual void OnDestruct() const OVERRIDE; |
76 virtual bool OnMessageReceived(const IPC::Message& message, | 79 virtual bool OnMessageReceived(const IPC::Message& message, |
77 bool* message_was_ok) OVERRIDE; | 80 bool* message_was_ok) OVERRIDE; |
78 | 81 |
79 // AudioOutputController::EventHandler implementations. | 82 // AudioOutputController::EventHandler implementations. |
80 virtual void OnCreated(media::AudioOutputController* controller) OVERRIDE; | 83 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. | 160 // Returns NULL if not found. |
158 AudioEntry* LookupById(int stream_id); | 161 AudioEntry* LookupById(int stream_id); |
159 | 162 |
160 // Search for a AudioEntry having the reference to |controller|. | 163 // Search for a AudioEntry having the reference to |controller|. |
161 // This method is used to look up an AudioEntry after a controller | 164 // This method is used to look up an AudioEntry after a controller |
162 // event is received. | 165 // event is received. |
163 AudioEntry* LookupByController(media::AudioOutputController* controller); | 166 AudioEntry* LookupByController(media::AudioOutputController* controller); |
164 | 167 |
165 media::AudioOutputController* LookupControllerByIdForTesting(int stream_id); | 168 media::AudioOutputController* LookupControllerByIdForTesting(int stream_id); |
166 | 169 |
170 // ID of the RenderProcessHost that owns this instance. | |
171 const int render_process_id_; | |
172 | |
173 // Dependencies. | |
Chris Rogers
2013/01/09 21:18:44
comment is vague and adds little value - I'd remov
miu
2013/01/10 21:23:26
Done.
| |
174 media::AudioManager* const audio_manager_; | |
175 AudioMirroringManager* const mirroring_manager_; | |
176 MediaObserver* const media_observer_; | |
177 | |
167 // A map of stream IDs to audio sources. | 178 // A map of stream IDs to audio sources. |
168 AudioEntryMap audio_entries_; | 179 AudioEntryMap audio_entries_; |
169 | 180 |
170 media::AudioManager* audio_manager_; | |
171 MediaObserver* media_observer_; | |
172 | |
173 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 181 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
174 }; | 182 }; |
175 | 183 |
176 } // namespace content | 184 } // namespace content |
177 | 185 |
178 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 186 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
OLD | NEW |