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 18 matching lines...) Expand all Loading... |
29 public: | 29 public: |
30 virtual ~AudioManager(); | 30 virtual ~AudioManager(); |
31 | 31 |
32 // Construct the audio manager; only one instance is allowed. The manager | 32 // Construct the audio manager; only one instance is allowed. The manager |
33 // will forward CreateAudioLog() calls to the provided AudioLogFactory; as | 33 // will forward CreateAudioLog() calls to the provided AudioLogFactory; as |
34 // such |audio_log_factory| must outlive the AudioManager. | 34 // such |audio_log_factory| must outlive the AudioManager. |
35 static AudioManager* Create(AudioLogFactory* audio_log_factory); | 35 static AudioManager* Create(AudioLogFactory* audio_log_factory); |
36 | 36 |
37 // Similar to Create() except also schedules a monitor on the given task | 37 // Similar to Create() except also schedules a monitor on the given task |
38 // runner to ensure the audio thread is not stuck for more than 60 seconds; if | 38 // runner to ensure the audio thread is not stuck for more than 60 seconds; if |
39 // a hang is detected, the process will be crashed. | 39 // a hang is detected, the process will be crashed. See EnableHangMonitor(). |
40 static AudioManager* CreateWithHangTimer( | 40 static AudioManager* CreateWithHangTimer( |
41 AudioLogFactory* audio_log_factory, | 41 AudioLogFactory* audio_log_factory, |
42 const scoped_refptr<base::SingleThreadTaskRunner>& monitor_task_runner); | 42 const scoped_refptr<base::SingleThreadTaskRunner>& monitor_task_runner); |
43 | 43 |
44 // Similar to Create() except uses a FakeAudioLogFactory for testing. | 44 // Similar to Create() except uses a FakeAudioLogFactory for testing. |
45 static AudioManager* CreateForTesting(); | 45 static AudioManager* CreateForTesting(); |
46 | 46 |
| 47 // Enables the hang monitor for the AudioManager once it's created. Must be |
| 48 // called before the AudioManager is created. CreateWithHangTimer() requires |
| 49 // either switches::kEnableAudioHangMonitor to be present or this to have been |
| 50 // called previously to start the hang monitor. Does nothing on OSX. |
| 51 static void EnableHangMonitor(); |
| 52 |
47 // Returns the pointer to the last created instance, or NULL if not yet | 53 // Returns the pointer to the last created instance, or NULL if not yet |
48 // created. This is a utility method for the code outside of media directory, | 54 // created. This is a utility method for the code outside of media directory, |
49 // like src/chrome. | 55 // like src/chrome. |
50 static AudioManager* Get(); | 56 static AudioManager* Get(); |
51 | 57 |
52 // Returns true if the OS reports existence of audio devices. This does not | 58 // Returns true if the OS reports existence of audio devices. This does not |
53 // guarantee that the existing devices support all formats and sample rates. | 59 // guarantee that the existing devices support all formats and sample rates. |
54 virtual bool HasAudioOutputDevices() = 0; | 60 virtual bool HasAudioOutputDevices() = 0; |
55 | 61 |
56 // Returns true if the OS reports existence of audio recording devices. This | 62 // Returns true if the OS reports existence of audio recording devices. This |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 protected: | 198 protected: |
193 AudioManager(); | 199 AudioManager(); |
194 | 200 |
195 private: | 201 private: |
196 DISALLOW_COPY_AND_ASSIGN(AudioManager); | 202 DISALLOW_COPY_AND_ASSIGN(AudioManager); |
197 }; | 203 }; |
198 | 204 |
199 } // namespace media | 205 } // namespace media |
200 | 206 |
201 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ | 207 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ |
OLD | NEW |