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

Side by Side Diff: media/audio/mac/audio_manager_mac.h

Issue 154543002: Cleanup AudioManager initialization on OSX to reduce startup delay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 10 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
« no previous file with comments | « no previous file | media/audio/mac/audio_manager_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_MAC_AUDIO_MANAGER_MAC_H_ 5 #ifndef MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_
6 #define MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ 6 #define MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_
7 7
8 #include <CoreAudio/AudioHardware.h> 8 #include <CoreAudio/AudioHardware.h>
9 #include <string> 9 #include <string>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 bool ShouldDeferOutputStreamStart(); 71 bool ShouldDeferOutputStreamStart();
72 72
73 protected: 73 protected:
74 virtual ~AudioManagerMac(); 74 virtual ~AudioManagerMac();
75 75
76 virtual AudioParameters GetPreferredOutputStreamParameters( 76 virtual AudioParameters GetPreferredOutputStreamParameters(
77 const std::string& output_device_id, 77 const std::string& output_device_id,
78 const AudioParameters& input_params) OVERRIDE; 78 const AudioParameters& input_params) OVERRIDE;
79 79
80 private: 80 private:
81 // Helper methods for constructing AudioDeviceListenerMac on the audio thread. 81 void InitializeOnAudioThread();
82 void CreateDeviceListener(); 82 void ShutdownOnAudioThread();
83 void DestroyDeviceListener();
84 83
85 int ChooseBufferSize(int output_sample_rate); 84 int ChooseBufferSize(int output_sample_rate);
86 85
87 // Notify streams of a device change if the default output device or its 86 // Notify streams of a device change if the default output device or its
88 // sample rate has changed, otherwise does nothing. 87 // sample rate has changed, otherwise does nothing.
89 void HandleDeviceChanges(); 88 void HandleDeviceChanges();
90 89
91 scoped_ptr<AudioDeviceListenerMac> output_device_listener_; 90 scoped_ptr<AudioDeviceListenerMac> output_device_listener_;
92 91
93 // Track the output sample-rate and the default output device 92 // Track the output sample-rate and the default output device
94 // so we can intelligently handle device notifications only when necessary. 93 // so we can intelligently handle device notifications only when necessary.
95 int current_sample_rate_; 94 int current_sample_rate_;
96 AudioDeviceID current_output_device_; 95 AudioDeviceID current_output_device_;
97 96
98 // Helper class which monitors power events to determine if output streams 97 // Helper class which monitors power events to determine if output streams
99 // should defer Start() calls. Required to workaround an OSX bug. See 98 // should defer Start() calls. Required to workaround an OSX bug. See
100 // http://crbug.com/160920 for more details. 99 // http://crbug.com/160920 for more details.
101 class AudioPowerObserver; 100 class AudioPowerObserver;
102 scoped_ptr<AudioPowerObserver> power_observer_; 101 scoped_ptr<AudioPowerObserver> power_observer_;
103 102
104 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); 103 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac);
105 }; 104 };
106 105
107 } // namespace media 106 } // namespace media
108 107
109 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ 108 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | media/audio/mac/audio_manager_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698