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

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

Issue 233823003: Defer input stream start around suspend and resume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests. Created 6 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 | 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 #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 <list> 9 #include <list>
10 #include <string> 10 #include <string>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 int* channels); 62 int* channels);
63 63
64 static int HardwareSampleRateForDevice(AudioDeviceID device_id); 64 static int HardwareSampleRateForDevice(AudioDeviceID device_id);
65 static int HardwareSampleRate(); 65 static int HardwareSampleRate();
66 66
67 // OSX has issues with starting streams as the sytem goes into suspend and 67 // OSX has issues with starting streams as the sytem goes into suspend and
68 // immediately after it wakes up from resume. See http://crbug.com/160920. 68 // immediately after it wakes up from resume. See http://crbug.com/160920.
69 // As a workaround we delay Start() when it occurs after suspend and for a 69 // As a workaround we delay Start() when it occurs after suspend and for a
70 // small amount of time after resume. 70 // small amount of time after resume.
71 // 71 //
72 // Output streams should consult ShouldDeferOutputStreamStart() and if true 72 // Streams should consult ShouldDeferStreamStart() and if true check the value
73 // check the value again after |kStartDelayInSecsForPowerEvents| has elapsed. 73 // again after |kStartDelayInSecsForPowerEvents| has elapsed. If false, the
74 // If false, the stream may be started immediately. 74 // stream may be started immediately.
75 enum { kStartDelayInSecsForPowerEvents = 1 }; 75 enum { kStartDelayInSecsForPowerEvents = 1 };
76 bool ShouldDeferOutputStreamStart(); 76 bool ShouldDeferStreamStart();
77 77
78 protected: 78 protected:
79 virtual ~AudioManagerMac(); 79 virtual ~AudioManagerMac();
80 80
81 virtual AudioParameters GetPreferredOutputStreamParameters( 81 virtual AudioParameters GetPreferredOutputStreamParameters(
82 const std::string& output_device_id, 82 const std::string& output_device_id,
83 const AudioParameters& input_params) OVERRIDE; 83 const AudioParameters& input_params) OVERRIDE;
84 84
85 private: 85 private:
86 void InitializeOnAudioThread(); 86 void InitializeOnAudioThread();
(...skipping 22 matching lines...) Expand all
109 // shutdown. See ShutdownOnAudioThread() for more details. 109 // shutdown. See ShutdownOnAudioThread() for more details.
110 std::list<AudioInputStream*> input_streams_; 110 std::list<AudioInputStream*> input_streams_;
111 std::list<AudioOutputStream*> output_streams_; 111 std::list<AudioOutputStream*> output_streams_;
112 112
113 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); 113 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac);
114 }; 114 };
115 115
116 } // namespace media 116 } // namespace media
117 117
118 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ 118 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_
OLDNEW
« no previous file with comments | « media/audio/mac/audio_low_latency_input_mac_unittest.cc ('k') | media/audio/mac/audio_manager_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698