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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 bool started() const { return render_thread_.get() != NULL; } | 150 bool started() const { return render_thread_.get() != NULL; } |
151 | 151 |
152 private: | 152 private: |
153 // DelegateSimpleThread::Delegate implementation. | 153 // DelegateSimpleThread::Delegate implementation. |
154 virtual void Run() OVERRIDE; | 154 virtual void Run() OVERRIDE; |
155 | 155 |
156 // Core part of the thread loop which controls the actual rendering. | 156 // Core part of the thread loop which controls the actual rendering. |
157 // Checks available amount of space in the endpoint buffer and reads | 157 // Checks available amount of space in the endpoint buffer and reads |
158 // data from the client to fill up the buffer without causing audio | 158 // data from the client to fill up the buffer without causing audio |
159 // glitches. | 159 // glitches. |
160 bool RenderAudioFromSource(IAudioClock* audio_clock, UINT64 device_frequency); | 160 bool RenderAudioFromSource(UINT64 device_frequency); |
161 | 161 |
162 // Called when the device will be opened in exclusive mode and use the | 162 // Called when the device will be opened in exclusive mode and use the |
163 // application specified format. | 163 // application specified format. |
164 // TODO(henrika): rewrite and move to CoreAudioUtil when removing flag | 164 // TODO(henrika): rewrite and move to CoreAudioUtil when removing flag |
165 // for exclusive audio mode. | 165 // for exclusive audio mode. |
166 HRESULT ExclusiveModeInitialization(IAudioClient* client, | 166 HRESULT ExclusiveModeInitialization(IAudioClient* client, |
167 HANDLE event_handle, | 167 HANDLE event_handle, |
168 uint32* endpoint_buffer_size); | 168 uint32* endpoint_buffer_size); |
169 | 169 |
170 // If |render_thread_| is valid, sets |stop_render_event_| and blocks until | 170 // If |render_thread_| is valid, sets |stop_render_event_| and blocks until |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // The audio engine will signal this event each time a buffer becomes | 243 // The audio engine will signal this event each time a buffer becomes |
244 // ready to be filled by the client. | 244 // ready to be filled by the client. |
245 base::win::ScopedHandle audio_samples_render_event_; | 245 base::win::ScopedHandle audio_samples_render_event_; |
246 | 246 |
247 // This event will be signaled when rendering shall stop. | 247 // This event will be signaled when rendering shall stop. |
248 base::win::ScopedHandle stop_render_event_; | 248 base::win::ScopedHandle stop_render_event_; |
249 | 249 |
250 // Container for retrieving data from AudioSourceCallback::OnMoreData(). | 250 // Container for retrieving data from AudioSourceCallback::OnMoreData(). |
251 scoped_ptr<AudioBus> audio_bus_; | 251 scoped_ptr<AudioBus> audio_bus_; |
252 | 252 |
| 253 base::win::ScopedComPtr<IAudioClock> audio_clock_; |
| 254 |
253 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioOutputStream); | 255 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioOutputStream); |
254 }; | 256 }; |
255 | 257 |
256 } // namespace media | 258 } // namespace media |
257 | 259 |
258 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ | 260 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ |
OLD | NEW |