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 AudioOutputStream for Windows using Windows Core Audio | 5 // Implementation of AudioOutputStream for Windows using Windows Core Audio |
6 // WASAPI for low latency rendering. | 6 // WASAPI for low latency rendering. |
7 // | 7 // |
8 // Overview of operation and performance: | 8 // Overview of operation and performance: |
9 // | 9 // |
10 // - An object of WASAPIAudioOutputStream is created by the AudioManager | 10 // - An object of WASAPIAudioOutputStream is created by the AudioManager |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // for more details. | 91 // for more details. |
92 | 92 |
93 #ifndef MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ | 93 #ifndef MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ |
94 #define MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ | 94 #define MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ |
95 | 95 |
96 #include <Audioclient.h> | 96 #include <Audioclient.h> |
97 #include <MMDeviceAPI.h> | 97 #include <MMDeviceAPI.h> |
98 #include <stddef.h> | 98 #include <stddef.h> |
99 #include <stdint.h> | 99 #include <stdint.h> |
100 | 100 |
| 101 #include <memory> |
101 #include <string> | 102 #include <string> |
102 | 103 |
103 #include "base/compiler_specific.h" | 104 #include "base/compiler_specific.h" |
104 #include "base/macros.h" | 105 #include "base/macros.h" |
105 #include "base/memory/scoped_ptr.h" | |
106 #include "base/threading/platform_thread.h" | 106 #include "base/threading/platform_thread.h" |
107 #include "base/threading/simple_thread.h" | 107 #include "base/threading/simple_thread.h" |
108 #include "base/win/scoped_co_mem.h" | 108 #include "base/win/scoped_co_mem.h" |
109 #include "base/win/scoped_com_initializer.h" | 109 #include "base/win/scoped_com_initializer.h" |
110 #include "base/win/scoped_comptr.h" | 110 #include "base/win/scoped_comptr.h" |
111 #include "base/win/scoped_handle.h" | 111 #include "base/win/scoped_handle.h" |
112 #include "media/audio/audio_io.h" | 112 #include "media/audio/audio_io.h" |
113 #include "media/base/audio_parameters.h" | 113 #include "media/base/audio_parameters.h" |
114 #include "media/base/media_export.h" | 114 #include "media/base/media_export.h" |
115 | 115 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 void StopThread(); | 176 void StopThread(); |
177 | 177 |
178 // Contains the thread ID of the creating thread. | 178 // Contains the thread ID of the creating thread. |
179 const base::PlatformThreadId creating_thread_id_; | 179 const base::PlatformThreadId creating_thread_id_; |
180 | 180 |
181 // Our creator, the audio manager needs to be notified when we close. | 181 // Our creator, the audio manager needs to be notified when we close. |
182 AudioManagerWin* const manager_; | 182 AudioManagerWin* const manager_; |
183 | 183 |
184 // Rendering is driven by this thread (which has no message loop). | 184 // Rendering is driven by this thread (which has no message loop). |
185 // All OnMoreData() callbacks will be called from this thread. | 185 // All OnMoreData() callbacks will be called from this thread. |
186 scoped_ptr<base::DelegateSimpleThread> render_thread_; | 186 std::unique_ptr<base::DelegateSimpleThread> render_thread_; |
187 | 187 |
188 // Contains the desired audio format which is set up at construction. | 188 // Contains the desired audio format which is set up at construction. |
189 // Extended PCM waveform format structure based on WAVEFORMATEXTENSIBLE. | 189 // Extended PCM waveform format structure based on WAVEFORMATEXTENSIBLE. |
190 // Use this for multiple channel and hi-resolution PCM data. | 190 // Use this for multiple channel and hi-resolution PCM data. |
191 WAVEFORMATPCMEX format_; | 191 WAVEFORMATPCMEX format_; |
192 | 192 |
193 // Set to true when stream is successfully opened. | 193 // Set to true when stream is successfully opened. |
194 bool opened_; | 194 bool opened_; |
195 | 195 |
196 // Volume level from 0 to 1. | 196 // Volume level from 0 to 1. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 base::win::ScopedComPtr<IAudioRenderClient> audio_render_client_; | 233 base::win::ScopedComPtr<IAudioRenderClient> audio_render_client_; |
234 | 234 |
235 // The audio engine will signal this event each time a buffer becomes | 235 // The audio engine will signal this event each time a buffer becomes |
236 // ready to be filled by the client. | 236 // ready to be filled by the client. |
237 base::win::ScopedHandle audio_samples_render_event_; | 237 base::win::ScopedHandle audio_samples_render_event_; |
238 | 238 |
239 // This event will be signaled when rendering shall stop. | 239 // This event will be signaled when rendering shall stop. |
240 base::win::ScopedHandle stop_render_event_; | 240 base::win::ScopedHandle stop_render_event_; |
241 | 241 |
242 // Container for retrieving data from AudioSourceCallback::OnMoreData(). | 242 // Container for retrieving data from AudioSourceCallback::OnMoreData(). |
243 scoped_ptr<AudioBus> audio_bus_; | 243 std::unique_ptr<AudioBus> audio_bus_; |
244 | 244 |
245 base::win::ScopedComPtr<IAudioClock> audio_clock_; | 245 base::win::ScopedComPtr<IAudioClock> audio_clock_; |
246 | 246 |
247 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioOutputStream); | 247 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioOutputStream); |
248 }; | 248 }; |
249 | 249 |
250 } // namespace media | 250 } // namespace media |
251 | 251 |
252 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ | 252 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ |
OLD | NEW |