| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 struct AudioEntry; | 130 struct AudioEntry; |
| 131 typedef std::map<int, AudioEntry*> AudioEntryMap; | 131 typedef std::map<int, AudioEntry*> AudioEntryMap; |
| 132 | 132 |
| 133 virtual ~AudioInputRendererHost(); | 133 virtual ~AudioInputRendererHost(); |
| 134 | 134 |
| 135 // Methods called on IO thread ---------------------------------------------- | 135 // Methods called on IO thread ---------------------------------------------- |
| 136 | 136 |
| 137 // Audio related IPC message handlers. | 137 // Audio related IPC message handlers. |
| 138 | 138 |
| 139 // For ChromeOS: Checks if the stream should contain keyboard mic, if so |
| 140 // registers to AudioInputDeviceManager. Then calls DoCreateStream. |
| 141 // For non-ChromeOS: Just calls DoCreateStream. |
| 142 void OnCreateStream(int stream_id, |
| 143 int render_view_id, |
| 144 int session_id, |
| 145 const AudioInputHostMsg_CreateStream_Config& config); |
| 146 |
| 139 // Creates an audio input stream with the specified format whose data is | 147 // Creates an audio input stream with the specified format whose data is |
| 140 // consumed by an entity in the render view referenced by |render_view_id|. | 148 // consumed by an entity in the render view referenced by |render_view_id|. |
| 141 // |session_id| is used to find out which device to be used for the stream. | 149 // |session_id| is used to find out which device to be used for the stream. |
| 142 // Upon success/failure, the peer is notified via the | 150 // Upon success/failure, the peer is notified via the |
| 143 // NotifyStreamCreated message. | 151 // NotifyStreamCreated message. |
| 144 void OnCreateStream(int stream_id, | 152 void DoCreateStream(int stream_id, |
| 145 int render_view_id, | 153 int render_view_id, |
| 146 int session_id, | 154 int session_id, |
| 147 const AudioInputHostMsg_CreateStream_Config& config); | 155 const AudioInputHostMsg_CreateStream_Config& config); |
| 148 | 156 |
| 149 // Record the audio input stream referenced by |stream_id|. | 157 // Record the audio input stream referenced by |stream_id|. |
| 150 void OnRecordStream(int stream_id); | 158 void OnRecordStream(int stream_id); |
| 151 | 159 |
| 152 // Close the audio stream referenced by |stream_id|. | 160 // Close the audio stream referenced by |stream_id|. |
| 153 void OnCloseStream(int stream_id); | 161 void OnCloseStream(int stream_id); |
| 154 | 162 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 197 |
| 190 // A helper method to look up a AudioEntry identified by |stream_id|. | 198 // A helper method to look up a AudioEntry identified by |stream_id|. |
| 191 // Returns NULL if not found. | 199 // Returns NULL if not found. |
| 192 AudioEntry* LookupById(int stream_id); | 200 AudioEntry* LookupById(int stream_id); |
| 193 | 201 |
| 194 // Search for a AudioEntry having the reference to |controller|. | 202 // Search for a AudioEntry having the reference to |controller|. |
| 195 // This method is used to look up an AudioEntry after a controller | 203 // This method is used to look up an AudioEntry after a controller |
| 196 // event is received. | 204 // event is received. |
| 197 AudioEntry* LookupByController(media::AudioInputController* controller); | 205 AudioEntry* LookupByController(media::AudioInputController* controller); |
| 198 | 206 |
| 207 // If ChromeOS and |config|'s layout has keyboard mic, unregister in |
| 208 // AudioInputDeviceManager. |
| 209 void MaybeUnregisterKeyboardMicStream( |
| 210 const AudioInputHostMsg_CreateStream_Config& config); |
| 211 |
| 199 // Used to create an AudioInputController. | 212 // Used to create an AudioInputController. |
| 200 media::AudioManager* audio_manager_; | 213 media::AudioManager* audio_manager_; |
| 201 | 214 |
| 202 // Used to access to AudioInputDeviceManager. | 215 // Used to access to AudioInputDeviceManager. |
| 203 MediaStreamManager* media_stream_manager_; | 216 MediaStreamManager* media_stream_manager_; |
| 204 | 217 |
| 205 AudioMirroringManager* audio_mirroring_manager_; | 218 AudioMirroringManager* audio_mirroring_manager_; |
| 206 | 219 |
| 207 // A map of stream IDs to audio sources. | 220 // A map of stream IDs to audio sources. |
| 208 AudioEntryMap audio_entries_; | 221 AudioEntryMap audio_entries_; |
| 209 | 222 |
| 210 // Raw pointer of the UserInputMonitor. | 223 // Raw pointer of the UserInputMonitor. |
| 211 media::UserInputMonitor* user_input_monitor_; | 224 media::UserInputMonitor* user_input_monitor_; |
| 212 | 225 |
| 213 scoped_ptr<media::AudioLog> audio_log_; | 226 scoped_ptr<media::AudioLog> audio_log_; |
| 214 | 227 |
| 215 DISALLOW_COPY_AND_ASSIGN(AudioInputRendererHost); | 228 DISALLOW_COPY_AND_ASSIGN(AudioInputRendererHost); |
| 216 }; | 229 }; |
| 217 | 230 |
| 218 } // namespace content | 231 } // namespace content |
| 219 | 232 |
| 220 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_RENDERER_HOST_H_ | 233 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_RENDERER_HOST_H_ |
| OLD | NEW |