OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // steady state is that the volume control reaches its max and the new_volume | 160 // steady state is that the volume control reaches its max and the new_volume |
161 // value from the AGC is zero. A loud voice input is required to break this | 161 // value from the AGC is zero. A loud voice input is required to break this |
162 // state and start lowering the level again. | 162 // state and start lowering the level again. |
163 // | 163 // |
164 // Implementation notes: | 164 // Implementation notes: |
165 // | 165 // |
166 // - This class must be created and destroyed on the main render thread and | 166 // - This class must be created and destroyed on the main render thread and |
167 // most methods are called on the same thread. However, some methods are | 167 // most methods are called on the same thread. However, some methods are |
168 // also called on a Libjingle worker thread. RenderData is called on the | 168 // also called on a Libjingle worker thread. RenderData is called on the |
169 // AudioOutputDevice thread and CaptureData on the AudioInputDevice thread. | 169 // AudioOutputDevice thread and CaptureData on the AudioInputDevice thread. |
170 // To summarize: this class lives on four different threads. | 170 // To summarize: this class lives on four different threads, so it is |
| 171 // important to be careful with the order in which locks are acquired in |
| 172 // order to avoid potential deadlocks. |
171 // - The webrtc::AudioDeviceModule is reference counted. | 173 // - The webrtc::AudioDeviceModule is reference counted. |
172 // - AGC is only supported in combination with the WASAPI-based audio layer | 174 // - AGC is only supported in combination with the WASAPI-based audio layer |
173 // on Windows, i.e., it is not supported on Windows XP. | 175 // on Windows, i.e., it is not supported on Windows XP. |
174 // - All volume levels required for the AGC scheme are transfered in a | 176 // - All volume levels required for the AGC scheme are transfered in a |
175 // normalized range [0.0, 1.0]. Scaling takes place in both endpoints | 177 // normalized range [0.0, 1.0]. Scaling takes place in both endpoints |
176 // (WebRTC client a media layer). This approach ensures that we can avoid | 178 // (WebRTC client a media layer). This approach ensures that we can avoid |
177 // transferring maximum levels between the renderer and the browser. | 179 // transferring maximum levels between the renderer and the browser. |
178 // | 180 // |
179 | 181 |
180 namespace content { | 182 namespace content { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 // Buffer used for temporary storage during render callback. | 396 // Buffer used for temporary storage during render callback. |
395 // It is only accessed by the audio render thread. | 397 // It is only accessed by the audio render thread. |
396 std::vector<int16> render_buffer_; | 398 std::vector<int16> render_buffer_; |
397 | 399 |
398 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); | 400 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); |
399 }; | 401 }; |
400 | 402 |
401 } // namespace content | 403 } // namespace content |
402 | 404 |
403 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ | 405 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ |
OLD | NEW |