Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: media/audio/win/audio_low_latency_output_win.h

Issue 10909271: Adds COM init to AudioManager thread for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed Stop() call in ctor Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // - Support for 8-bit audio has not yet been verified and tested. 83 // - Support for 8-bit audio has not yet been verified and tested.
84 // - Open() will fail if channel up-mixing is done for 8-bit audio. 84 // - Open() will fail if channel up-mixing is done for 8-bit audio.
85 // - Supported channel up-mixing cases (client config -> endpoint config): 85 // - Supported channel up-mixing cases (client config -> endpoint config):
86 // o 1 -> 2 86 // o 1 -> 2
87 // o 1 -> 7.1 87 // o 1 -> 7.1
88 // o 2 -> 5.1 88 // o 2 -> 5.1
89 // o 2 -> 7.1 89 // o 2 -> 7.1
90 // 90 //
91 // Core Audio API details: 91 // Core Audio API details:
92 // 92 //
93 // - CoInitializeEx() is called on the creating thread and on the internal
94 // capture thread. Each thread's concurrency model and apartment is set
95 // to multi-threaded (MTA). CHECK() is called to ensure that we crash if
96 // CoInitializeEx(MTA) fails.
97 // - The public API methods (Open(), Start(), Stop() and Close()) must be 93 // - The public API methods (Open(), Start(), Stop() and Close()) must be
98 // called on constructing thread. The reason is that we want to ensure that 94 // called on constructing thread. The reason is that we want to ensure that
99 // the COM environment is the same for all API implementations. 95 // the COM environment is the same for all API implementations.
100 // - Utilized MMDevice interfaces: 96 // - Utilized MMDevice interfaces:
101 // o IMMDeviceEnumerator 97 // o IMMDeviceEnumerator
102 // o IMMDevice 98 // o IMMDevice
103 // - Utilized WASAPI interfaces: 99 // - Utilized WASAPI interfaces:
104 // o IAudioClient 100 // o IAudioClient
105 // o IAudioRenderClient 101 // o IAudioRenderClient
106 // - The stream is initialized in shared mode and the processing of the 102 // - The stream is initialized in shared mode and the processing of the
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // processing/mixing of shared-mode streams for the default endpoint device. 284 // processing/mixing of shared-mode streams for the default endpoint device.
289 int endpoint_channel_count() { return format_.Format.nChannels; } 285 int endpoint_channel_count() { return format_.Format.nChannels; }
290 286
291 // The ratio between the the number of native audio channels used by the 287 // The ratio between the the number of native audio channels used by the
292 // audio device and the number of audio channels from the client. 288 // audio device and the number of audio channels from the client.
293 double channel_factor() const { 289 double channel_factor() const {
294 return (format_.Format.nChannels / static_cast<double> ( 290 return (format_.Format.nChannels / static_cast<double> (
295 client_channel_count_)); 291 client_channel_count_));
296 } 292 }
297 293
298 // Initializes the COM library for use by the calling thread and sets the
299 // thread's concurrency model to multi-threaded.
300 base::win::ScopedCOMInitializer com_init_;
301
302 // Contains the thread ID of the creating thread. 294 // Contains the thread ID of the creating thread.
303 base::PlatformThreadId creating_thread_id_; 295 base::PlatformThreadId creating_thread_id_;
304 296
305 // Our creator, the audio manager needs to be notified when we close. 297 // Our creator, the audio manager needs to be notified when we close.
306 AudioManagerWin* manager_; 298 AudioManagerWin* manager_;
307 299
308 // Rendering is driven by this thread (which has no message loop). 300 // Rendering is driven by this thread (which has no message loop).
309 // All OnMoreData() callbacks will be called from this thread. 301 // All OnMoreData() callbacks will be called from this thread.
310 scoped_ptr<base::DelegateSimpleThread> render_thread_; 302 scoped_ptr<base::DelegateSimpleThread> render_thread_;
311 303
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 385
394 // Container for retrieving data from AudioSourceCallback::OnMoreData(). 386 // Container for retrieving data from AudioSourceCallback::OnMoreData().
395 scoped_ptr<AudioBus> audio_bus_; 387 scoped_ptr<AudioBus> audio_bus_;
396 388
397 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioOutputStream); 389 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioOutputStream);
398 }; 390 };
399 391
400 } // namespace media 392 } // namespace media
401 393
402 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_ 394 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_OUTPUT_WIN_H_
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_input_win.cc ('k') | media/audio/win/audio_low_latency_output_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698