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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 class AudioManagerWin; | 115 class AudioManagerWin; |
116 | 116 |
117 // AudioOutputStream implementation using Windows Core Audio APIs. | 117 // AudioOutputStream implementation using Windows Core Audio APIs. |
118 class MEDIA_EXPORT WASAPIAudioOutputStream : | 118 class MEDIA_EXPORT WASAPIAudioOutputStream : |
119 public AudioOutputStream, | 119 public AudioOutputStream, |
120 public base::DelegateSimpleThread::Delegate { | 120 public base::DelegateSimpleThread::Delegate { |
121 public: | 121 public: |
122 // The ctor takes all the usual parameters, plus |manager| which is the | 122 // The ctor takes all the usual parameters, plus |manager| which is the |
123 // the audio manager who is creating this object. | 123 // the audio manager who is creating this object. |
124 WASAPIAudioOutputStream(AudioManagerWin* manager, | 124 WASAPIAudioOutputStream(AudioManagerWin* manager, |
| 125 const std::string& device_id, |
125 const AudioParameters& params, | 126 const AudioParameters& params, |
126 ERole device_role); | 127 ERole device_role); |
127 | 128 |
128 // The dtor is typically called by the AudioManager only and it is usually | 129 // The dtor is typically called by the AudioManager only and it is usually |
129 // triggered by calling AudioOutputStream::Close(). | 130 // triggered by calling AudioOutputStream::Close(). |
130 virtual ~WASAPIAudioOutputStream(); | 131 virtual ~WASAPIAudioOutputStream(); |
131 | 132 |
132 // Implementation of AudioOutputStream. | 133 // Implementation of AudioOutputStream. |
133 virtual bool Open() OVERRIDE; | 134 virtual bool Open() OVERRIDE; |
134 virtual void Start(AudioSourceCallback* callback) OVERRIDE; | 135 virtual void Start(AudioSourceCallback* callback) OVERRIDE; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 214 |
214 // Size in bytes of each audio packet. | 215 // Size in bytes of each audio packet. |
215 size_t packet_size_bytes_; | 216 size_t packet_size_bytes_; |
216 | 217 |
217 // Size in milliseconds of each audio packet. | 218 // Size in milliseconds of each audio packet. |
218 float packet_size_ms_; | 219 float packet_size_ms_; |
219 | 220 |
220 // Length of the audio endpoint buffer. | 221 // Length of the audio endpoint buffer. |
221 uint32 endpoint_buffer_size_frames_; | 222 uint32 endpoint_buffer_size_frames_; |
222 | 223 |
| 224 // The target device id or an empty string for the default device. |
| 225 const std::string device_id_; |
| 226 |
223 // Defines the role that the system has assigned to an audio endpoint device. | 227 // Defines the role that the system has assigned to an audio endpoint device. |
224 ERole device_role_; | 228 ERole device_role_; |
225 | 229 |
226 // The sharing mode for the connection. | 230 // The sharing mode for the connection. |
227 // Valid values are AUDCLNT_SHAREMODE_SHARED and AUDCLNT_SHAREMODE_EXCLUSIVE | 231 // Valid values are AUDCLNT_SHAREMODE_SHARED and AUDCLNT_SHAREMODE_EXCLUSIVE |
228 // where AUDCLNT_SHAREMODE_SHARED is the default. | 232 // where AUDCLNT_SHAREMODE_SHARED is the default. |
229 AUDCLNT_SHAREMODE share_mode_; | 233 AUDCLNT_SHAREMODE share_mode_; |
230 | 234 |
231 // Counts the number of audio frames written to the endpoint buffer. | 235 // Counts the number of audio frames written to the endpoint buffer. |
232 UINT64 num_written_frames_; | 236 UINT64 num_written_frames_; |
(...skipping 21 matching lines...) Expand all Loading... |
254 | 258 |
255 // Container for retrieving data from AudioSourceCallback::OnMoreData(). | 259 // Container for retrieving data from AudioSourceCallback::OnMoreData(). |
256 scoped_ptr<AudioBus> audio_bus_; | 260 scoped_ptr<AudioBus> audio_bus_; |
257 | 261 |
258 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioOutputStream); | 262 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioOutputStream); |
259 }; | 263 }; |
260 | 264 |
261 } // namespace media | 265 } // namespace media |
262 | 266 |
263 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ | 267 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ |
OLD | NEW |