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

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

Issue 1097553003: Switch to STA mode for audio thread and WASAPI I/O streams. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 5 years, 8 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
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 #ifndef MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ 5 #ifndef MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
6 #define MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ 6 #define MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "media/audio/audio_manager_base.h" 10 #include "media/audio/audio_manager_base.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 protected: 49 protected:
50 virtual ~AudioManagerWin(); 50 virtual ~AudioManagerWin();
51 51
52 virtual AudioParameters GetPreferredOutputStreamParameters( 52 virtual AudioParameters GetPreferredOutputStreamParameters(
53 const std::string& output_device_id, 53 const std::string& output_device_id,
54 const AudioParameters& input_params) override; 54 const AudioParameters& input_params) override;
55 55
56 private: 56 private:
57 enum EnumerationType { 57 enum EnumerationType {
58 kNoEnumeration,
58 kMMDeviceEnumeration, 59 kMMDeviceEnumeration,
59 kWaveEnumeration, 60 kWaveEnumeration,
60 }; 61 };
61 62
62 // Allow unit test to modify the utilized enumeration API. 63 // Allow unit test to modify the utilized enumeration API.
63 friend class AudioManagerTest; 64 friend class AudioManagerTest;
64 65
65 EnumerationType enumeration_type_; 66 EnumerationType enumeration_type_;
66 EnumerationType enumeration_type() { return enumeration_type_; } 67 EnumerationType enumeration_type() const {
67 void SetEnumerationType(EnumerationType type) { 68 DCHECK_NE(enumeration_type_, kNoEnumeration);
68 enumeration_type_ = type; 69 return enumeration_type_;
69 } 70 }
71 void set_enumeration_type(EnumerationType type) { enumeration_type_ = type; }
70 72
71 inline bool core_audio_supported() const { 73 bool core_audio_supported() const {
74 DCHECK_NE(enumeration_type_, kNoEnumeration);
72 return enumeration_type_ == kMMDeviceEnumeration; 75 return enumeration_type_ == kMMDeviceEnumeration;
73 } 76 }
74 77
75 // Returns a PCMWaveInAudioInputStream instance or NULL on failure. 78 // Returns a PCMWaveInAudioInputStream instance or NULL on failure.
76 // This method converts MMDevice-style device ID to WaveIn-style device ID if 79 // This method converts MMDevice-style device ID to WaveIn-style device ID if
77 // necessary. 80 // necessary.
78 // (Please see device_enumeration_win.h for more info about the two kinds of 81 // (Please see device_enumeration_win.h for more info about the two kinds of
79 // device IDs.) 82 // device IDs.)
80 AudioInputStream* CreatePCMWaveInAudioInputStream( 83 AudioInputStream* CreatePCMWaveInAudioInputStream(
81 const AudioParameters& params, 84 const AudioParameters& params,
82 const std::string& device_id); 85 const std::string& device_id);
83 86
84 // Helper methods for performing expensive initialization tasks on the audio 87 // Helper methods for performing expensive initialization tasks on the audio
85 // thread instead of on the UI thread which AudioManager is constructed on. 88 // thread instead of on the UI thread which AudioManager is constructed on.
86 void InitializeOnAudioThread(); 89 void InitializeOnAudioThread();
87 void ShutdownOnAudioThread(); 90 void ShutdownOnAudioThread();
88 91
89 void GetAudioDeviceNamesImpl(bool input, AudioDeviceNames* device_names); 92 void GetAudioDeviceNamesImpl(bool input, AudioDeviceNames* device_names);
90 93
91 // Listen for output device changes. 94 // Listen for output device changes.
92 scoped_ptr<AudioDeviceListenerWin> output_device_listener_; 95 scoped_ptr<AudioDeviceListenerWin> output_device_listener_;
93 96
94 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin); 97 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin);
95 }; 98 };
96 99
97 } // namespace media 100 } // namespace media
98 101
99 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ 102 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698