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 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_H_ |
6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_ | 6 #define MEDIA_AUDIO_AUDIO_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // which must not be NULL. | 40 // which must not be NULL. |
41 static void SetFactory(AudioManagerFactory* factory); | 41 static void SetFactory(AudioManagerFactory* factory); |
42 | 42 |
43 // Construct the audio manager; only one instance is allowed. The manager | 43 // Construct the audio manager; only one instance is allowed. The manager |
44 // will forward CreateAudioLog() calls to the provided AudioLogFactory; as | 44 // will forward CreateAudioLog() calls to the provided AudioLogFactory; as |
45 // such |audio_log_factory| must outlive the AudioManager. | 45 // such |audio_log_factory| must outlive the AudioManager. |
46 static AudioManager* Create(AudioLogFactory* audio_log_factory); | 46 static AudioManager* Create(AudioLogFactory* audio_log_factory); |
47 | 47 |
48 // Similar to Create() except also schedules a monitor on the given task | 48 // Similar to Create() except also schedules a monitor on the given task |
49 // runner to ensure the audio thread is not stuck for more than 60 seconds; if | 49 // runner to ensure the audio thread is not stuck for more than 60 seconds; if |
50 // a hang is detected, the process will be crashed. | 50 // a hang is detected, the process will be crashed. See EnableHangMonitor(). |
51 static AudioManager* CreateWithHangTimer( | 51 static AudioManager* CreateWithHangTimer( |
52 AudioLogFactory* audio_log_factory, | 52 AudioLogFactory* audio_log_factory, |
53 const scoped_refptr<base::SingleThreadTaskRunner>& monitor_task_runner); | 53 const scoped_refptr<base::SingleThreadTaskRunner>& monitor_task_runner); |
54 | 54 |
55 // Similar to Create() except uses a FakeAudioLogFactory for testing. | 55 // Similar to Create() except uses a FakeAudioLogFactory for testing. |
56 static AudioManager* CreateForTesting(); | 56 static AudioManager* CreateForTesting(); |
57 | 57 |
| 58 // Enables the hang monitor for the AudioManager once it's created. Must be |
| 59 // called before the AudioManager is created. CreateWithHangTimer() requires |
| 60 // either switches::kEnableAudioHangMonitor to be present or this to have been |
| 61 // called previously to start the hang monitor. Does nothing on OSX. |
| 62 static void EnableHangMonitor(); |
| 63 |
58 // Should only be used for testing. Resets a previously-set | 64 // Should only be used for testing. Resets a previously-set |
59 // AudioManagerFactory. The instance of AudioManager is not affected. | 65 // AudioManagerFactory. The instance of AudioManager is not affected. |
60 static void ResetFactoryForTesting(); | 66 static void ResetFactoryForTesting(); |
61 | 67 |
62 // Returns the pointer to the last created instance, or NULL if not yet | 68 // Returns the pointer to the last created instance, or NULL if not yet |
63 // created. This is a utility method for the code outside of media directory, | 69 // created. This is a utility method for the code outside of media directory, |
64 // like src/chrome. | 70 // like src/chrome. |
65 static AudioManager* Get(); | 71 static AudioManager* Get(); |
66 | 72 |
67 // Returns true if the OS reports existence of audio devices. This does not | 73 // Returns true if the OS reports existence of audio devices. This does not |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 protected: | 214 protected: |
209 AudioManager(); | 215 AudioManager(); |
210 | 216 |
211 private: | 217 private: |
212 DISALLOW_COPY_AND_ASSIGN(AudioManager); | 218 DISALLOW_COPY_AND_ASSIGN(AudioManager); |
213 }; | 219 }; |
214 | 220 |
215 } // namespace media | 221 } // namespace media |
216 | 222 |
217 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ | 223 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ |
OLD | NEW |