| 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 // AudioInputRendererHost serves audio related requests from audio capturer | 5 // AudioInputRendererHost serves audio related requests from audio capturer |
| 6 // which lives inside the render process and provide access to audio hardware. | 6 // which lives inside the render process and provide access to audio hardware. |
| 7 // | 7 // |
| 8 // Create stream sequence (AudioInputController = AIC): | 8 // Create stream sequence (AudioInputController = AIC): |
| 9 // | 9 // |
| 10 // AudioInputHostMsg_CreateStream -> OnCreateStream -> AIC::CreateLowLatency -> | 10 // AudioInputHostMsg_CreateStream -> OnCreateStream -> AIC::CreateLowLatency -> |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // Start the audio input device with the session id. If the device | 133 // Start the audio input device with the session id. If the device |
| 134 // starts successfully, it will trigger OnDeviceStarted() callback. | 134 // starts successfully, it will trigger OnDeviceStarted() callback. |
| 135 void OnStartDevice(int stream_id, int session_id); | 135 void OnStartDevice(int stream_id, int session_id); |
| 136 | 136 |
| 137 // Audio related IPC message handlers. | 137 // Audio related IPC message handlers. |
| 138 // Creates an audio input stream with the specified format. If this call is | 138 // Creates an audio input stream with the specified format. If this call is |
| 139 // successful this object would keep an internal entry of the stream for the | 139 // successful this object would keep an internal entry of the stream for the |
| 140 // required properties. | 140 // required properties. |
| 141 void OnCreateStream(int stream_id, | 141 void OnCreateStream(int stream_id, |
| 142 const AudioParameters& params, | 142 const AudioParameters& params, |
| 143 const std::string& device_id); | 143 const std::string& device_id, |
| 144 bool automatic_gain_control); |
| 144 | 145 |
| 145 // Record the audio input stream referenced by |stream_id|. | 146 // Record the audio input stream referenced by |stream_id|. |
| 146 void OnRecordStream(int stream_id); | 147 void OnRecordStream(int stream_id); |
| 147 | 148 |
| 148 // Close the audio stream referenced by |stream_id|. | 149 // Close the audio stream referenced by |stream_id|. |
| 149 void OnCloseStream(int stream_id); | 150 void OnCloseStream(int stream_id); |
| 150 | 151 |
| 151 // Set the volume of the audio stream referenced by |stream_id|. | 152 // Set the volume of the audio stream referenced by |stream_id|. |
| 152 void OnSetVolume(int stream_id, double volume); | 153 void OnSetVolume(int stream_id, double volume); |
| 153 | 154 |
| 154 // Get the volume of the audio stream referenced by |stream_id|. | |
| 155 void OnGetVolume(int stream_id); | |
| 156 | |
| 157 // Complete the process of creating an audio input stream. This will set up | 155 // Complete the process of creating an audio input stream. This will set up |
| 158 // the shared memory or shared socket in low latency mode. | 156 // the shared memory or shared socket in low latency mode. |
| 159 void DoCompleteCreation(media::AudioInputController* controller); | 157 void DoCompleteCreation(media::AudioInputController* controller); |
| 160 | 158 |
| 161 // Send a state change message to the renderer. | 159 // Send a state change message to the renderer. |
| 162 void DoSendRecordingMessage(media::AudioInputController* controller); | 160 void DoSendRecordingMessage(media::AudioInputController* controller); |
| 163 void DoSendPausedMessage(media::AudioInputController* controller); | 161 void DoSendPausedMessage(media::AudioInputController* controller); |
| 164 | 162 |
| 165 // Handle error coming from audio stream. | 163 // Handle error coming from audio stream. |
| 166 void DoHandleError(media::AudioInputController* controller, int error_code); | 164 void DoHandleError(media::AudioInputController* controller, int error_code); |
| 167 | 165 |
| 168 // Send an error message to the renderer. | 166 // Send an error message to the renderer. |
| 169 void SendErrorMessage(int stream_id); | 167 void SendErrorMessage(int stream_id); |
| 170 | 168 |
| 171 // Delete all audio entry and all audio streams | 169 // Delete all audio entry and all audio streams |
| 172 void DeleteEntries(); | 170 void DeleteEntries(); |
| 173 | 171 |
| 174 // Closes the stream. The stream is then deleted in DeleteEntry() after it | 172 // Closes the stream. The stream is then deleted in DeleteEntry() after it |
| 175 // is closed. | 173 // is closed. |
| 176 void CloseAndDeleteStream(AudioEntry* entry); | 174 void CloseAndDeleteStream(AudioEntry* entry); |
| 177 | 175 |
| 178 // Called on the audio thread after the audio input stream is closed. | |
| 179 void OnStreamClosed(AudioEntry* entry); | |
| 180 | |
| 181 // Delete an audio entry and close the related audio stream. | 176 // Delete an audio entry and close the related audio stream. |
| 182 void DeleteEntry(AudioEntry* entry); | 177 void DeleteEntry(AudioEntry* entry); |
| 183 | 178 |
| 184 // Delete audio entry and close the related audio input stream. | 179 // Delete audio entry and close the related audio input stream. |
| 185 void DeleteEntryOnError(AudioEntry* entry); | 180 void DeleteEntryOnError(AudioEntry* entry); |
| 186 | 181 |
| 187 // Stop the device and delete its audio session entry. | 182 // Stop the device and delete its audio session entry. |
| 188 void StopAndDeleteDevice(int stream_id); | 183 void StopAndDeleteDevice(int stream_id); |
| 189 | 184 |
| 190 // A helper method to look up a AudioEntry identified by |stream_id|. | 185 // A helper method to look up a AudioEntry identified by |stream_id|. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 209 AudioEntryMap audio_entries_; | 204 AudioEntryMap audio_entries_; |
| 210 | 205 |
| 211 // A map of session IDs to audio session sources. | 206 // A map of session IDs to audio session sources. |
| 212 typedef std::map<int, int> SessionEntryMap; | 207 typedef std::map<int, int> SessionEntryMap; |
| 213 SessionEntryMap session_entries_; | 208 SessionEntryMap session_entries_; |
| 214 | 209 |
| 215 DISALLOW_COPY_AND_ASSIGN(AudioInputRendererHost); | 210 DISALLOW_COPY_AND_ASSIGN(AudioInputRendererHost); |
| 216 }; | 211 }; |
| 217 | 212 |
| 218 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_RENDERER_HOST_H_ | 213 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_RENDERER_HOST_H_ |
| OLD | NEW |