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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 virtual void OnDestruct() const OVERRIDE; | 78 virtual void OnDestruct() const OVERRIDE; |
79 virtual bool OnMessageReceived(const IPC::Message& message, | 79 virtual bool OnMessageReceived(const IPC::Message& message, |
80 bool* message_was_ok) OVERRIDE; | 80 bool* message_was_ok) OVERRIDE; |
81 | 81 |
82 // AudioOutputController::EventHandler implementations. | 82 // AudioOutputController::EventHandler implementations. |
83 virtual void OnCreated(media::AudioOutputController* controller) OVERRIDE; | 83 virtual void OnCreated(media::AudioOutputController* controller) OVERRIDE; |
84 virtual void OnPlaying(media::AudioOutputController* controller) OVERRIDE; | 84 virtual void OnPlaying(media::AudioOutputController* controller) OVERRIDE; |
85 virtual void OnPaused(media::AudioOutputController* controller) OVERRIDE; | 85 virtual void OnPaused(media::AudioOutputController* controller) OVERRIDE; |
86 virtual void OnError(media::AudioOutputController* controller, | 86 virtual void OnError(media::AudioOutputController* controller, |
87 int error_code) OVERRIDE; | 87 int error_code) OVERRIDE; |
| 88 virtual void OnDeviceChange(media::AudioOutputController* controller, |
| 89 int new_buffer_size, |
| 90 int new_sample_rate) OVERRIDE; |
88 | 91 |
89 private: | 92 private: |
90 friend class AudioRendererHostTest; | 93 friend class AudioRendererHostTest; |
91 friend class BrowserThread; | 94 friend class BrowserThread; |
92 friend class base::DeleteHelper<AudioRendererHost>; | 95 friend class base::DeleteHelper<AudioRendererHost>; |
93 friend class MockAudioRendererHost; | 96 friend class MockAudioRendererHost; |
94 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, CreateMockStream); | 97 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, CreateMockStream); |
95 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation); | 98 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation); |
96 | 99 |
97 struct AudioEntry; | 100 struct AudioEntry; |
(...skipping 30 matching lines...) Expand all Loading... |
128 // Set the volume of the audio stream referenced by |stream_id|. | 131 // Set the volume of the audio stream referenced by |stream_id|. |
129 void OnSetVolume(int stream_id, double volume); | 132 void OnSetVolume(int stream_id, double volume); |
130 | 133 |
131 // Complete the process of creating an audio stream. This will set up the | 134 // Complete the process of creating an audio stream. This will set up the |
132 // shared memory or shared socket in low latency mode. | 135 // shared memory or shared socket in low latency mode. |
133 void DoCompleteCreation(media::AudioOutputController* controller); | 136 void DoCompleteCreation(media::AudioOutputController* controller); |
134 | 137 |
135 // Send a state change message to the renderer. | 138 // Send a state change message to the renderer. |
136 void DoSendPlayingMessage(media::AudioOutputController* controller); | 139 void DoSendPlayingMessage(media::AudioOutputController* controller); |
137 void DoSendPausedMessage(media::AudioOutputController* controller); | 140 void DoSendPausedMessage(media::AudioOutputController* controller); |
| 141 void DoSendDeviceChangeMessage(media::AudioOutputController* controller, |
| 142 int new_buffer_size, int new_sample_rate); |
138 | 143 |
139 // Handle error coming from audio stream. | 144 // Handle error coming from audio stream. |
140 void DoHandleError(media::AudioOutputController* controller, int error_code); | 145 void DoHandleError(media::AudioOutputController* controller, int error_code); |
141 | 146 |
142 // Send an error message to the renderer. | 147 // Send an error message to the renderer. |
143 void SendErrorMessage(int stream_id); | 148 void SendErrorMessage(int stream_id); |
144 | 149 |
145 // Delete all audio entry and all audio streams | 150 // Delete all audio entry and all audio streams |
146 void DeleteEntries(); | 151 void DeleteEntries(); |
147 | 152 |
(...skipping 28 matching lines...) Expand all Loading... |
176 | 181 |
177 // A map of stream IDs to audio sources. | 182 // A map of stream IDs to audio sources. |
178 AudioEntryMap audio_entries_; | 183 AudioEntryMap audio_entries_; |
179 | 184 |
180 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); | 185 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); |
181 }; | 186 }; |
182 | 187 |
183 } // namespace content | 188 } // namespace content |
184 | 189 |
185 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ | 190 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ |
OLD | NEW |