Chromium Code Reviews| 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 // Implementation of AudioInputStream for Windows using Windows Core Audio | 5 // Implementation of AudioInputStream for Windows using Windows Core Audio |
| 6 // WASAPI for low latency capturing. | 6 // WASAPI for low latency capturing. |
| 7 // | 7 // |
| 8 // Overview of operation: | 8 // Overview of operation: |
| 9 // | 9 // |
| 10 // - An object of WASAPIAudioInputStream is created by the AudioManager | 10 // - An object of WASAPIAudioInputStream is created by the AudioManager |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 // interface to control the master volume level of an audio endpoint device. | 51 // interface to control the master volume level of an audio endpoint device. |
| 52 // This implementation is using the ISimpleAudioVolume interface. | 52 // This implementation is using the ISimpleAudioVolume interface. |
| 53 // MSDN states that "In rare cases, a specialized audio application might | 53 // MSDN states that "In rare cases, a specialized audio application might |
| 54 // require the use of the IAudioEndpointVolume". | 54 // require the use of the IAudioEndpointVolume". |
| 55 // | 55 // |
| 56 #ifndef MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ | 56 #ifndef MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ |
| 57 #define MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ | 57 #define MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ |
| 58 | 58 |
| 59 #include <Audioclient.h> | 59 #include <Audioclient.h> |
| 60 #include <MMDeviceAPI.h> | 60 #include <MMDeviceAPI.h> |
| 61 #include <endpointvolume.h> | |
| 61 #include <stddef.h> | 62 #include <stddef.h> |
| 62 #include <stdint.h> | 63 #include <stdint.h> |
| 63 | 64 |
| 64 #include <memory> | 65 #include <memory> |
| 65 #include <string> | 66 #include <string> |
| 66 | 67 |
| 67 #include "base/compiler_specific.h" | 68 #include "base/compiler_specific.h" |
| 68 #include "base/macros.h" | 69 #include "base/macros.h" |
| 69 #include "base/threading/non_thread_safe.h" | 70 #include "base/threading/non_thread_safe.h" |
| 70 #include "base/threading/platform_thread.h" | 71 #include "base/threading/platform_thread.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 // The IAudioCaptureClient interface enables a client to read input data | 190 // The IAudioCaptureClient interface enables a client to read input data |
| 190 // from a capture endpoint buffer. | 191 // from a capture endpoint buffer. |
| 191 base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_; | 192 base::win::ScopedComPtr<IAudioCaptureClient> audio_capture_client_; |
| 192 | 193 |
| 193 // The ISimpleAudioVolume interface enables a client to control the | 194 // The ISimpleAudioVolume interface enables a client to control the |
| 194 // master volume level of an audio session. | 195 // master volume level of an audio session. |
| 195 // The volume-level is a value in the range 0.0 to 1.0. | 196 // The volume-level is a value in the range 0.0 to 1.0. |
| 196 // This interface does only work with shared-mode streams. | 197 // This interface does only work with shared-mode streams. |
| 197 base::win::ScopedComPtr<ISimpleAudioVolume> simple_audio_volume_; | 198 base::win::ScopedComPtr<ISimpleAudioVolume> simple_audio_volume_; |
| 198 | 199 |
| 200 // The IAudioEndpointVolume allows a client to control the volume level of | |
| 201 // the whole system. | |
| 202 base::win::ScopedComPtr<IAudioEndpointVolume> system_audio_volume_; | |
| 203 | |
| 199 // The audio engine will signal this event each time a buffer has been | 204 // The audio engine will signal this event each time a buffer has been |
| 200 // recorded. | 205 // recorded. |
| 201 base::win::ScopedHandle audio_samples_ready_event_; | 206 base::win::ScopedHandle audio_samples_ready_event_; |
| 202 | 207 |
| 203 // This event will be signaled when capturing shall stop. | 208 // This event will be signaled when capturing shall stop. |
| 204 base::win::ScopedHandle stop_capture_event_; | 209 base::win::ScopedHandle stop_capture_event_; |
| 205 | 210 |
| 206 // Extra audio bus used for storage of deinterleaved data for the OnData | 211 // Extra audio bus used for storage of deinterleaved data for the OnData |
| 207 // callback. | 212 // callback. |
| 208 std::unique_ptr<media::AudioBus> audio_bus_; | 213 std::unique_ptr<media::AudioBus> audio_bus_; |
| 209 | 214 |
| 215 // Never set it through external API. Only used when |device_id_| == | |
| 216 // kLoopbackWithMuteDeviceId. | |
| 217 // True, if we have muted the system audio for the stream capturing, and | |
| 218 // indicate we need to unmute the system audio when stopping capturing. | |
|
henrika (OOO until Aug 14)
2016/07/26 10:04:25
..and indicates that we need to...
qiangchen
2016/07/26 16:53:02
Done.
| |
| 219 bool mute_done_; | |
| 220 | |
| 210 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioInputStream); | 221 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioInputStream); |
| 211 }; | 222 }; |
| 212 | 223 |
| 213 } // namespace media | 224 } // namespace media |
| 214 | 225 |
| 215 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ | 226 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ |
| OLD | NEW |