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 16 matching lines...) Expand all Loading... |
27 // the need to provide iterators over the existing streams. | 27 // the need to provide iterators over the existing streams. |
28 class MEDIA_EXPORT AudioManager { | 28 class MEDIA_EXPORT AudioManager { |
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 |
| 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. |
| 40 static AudioManager* CreateWithHangTimer( |
| 41 AudioLogFactory* audio_log_factory, |
| 42 const scoped_refptr<base::SingleThreadTaskRunner>& monitor_task_runner); |
| 43 |
37 // Similar to Create() except uses a FakeAudioLogFactory for testing. | 44 // Similar to Create() except uses a FakeAudioLogFactory for testing. |
38 static AudioManager* CreateForTesting(); | 45 static AudioManager* CreateForTesting(); |
39 | 46 |
40 // Returns the pointer to the last created instance, or NULL if not yet | 47 // Returns the pointer to the last created instance, or NULL if not yet |
41 // created. This is a utility method for the code outside of media directory, | 48 // created. This is a utility method for the code outside of media directory, |
42 // like src/chrome. | 49 // like src/chrome. |
43 static AudioManager* Get(); | 50 static AudioManager* Get(); |
44 | 51 |
45 // Returns true if the OS reports existence of audio devices. This does not | 52 // Returns true if the OS reports existence of audio devices. This does not |
46 // guarantee that the existing devices support all formats and sample rates. | 53 // guarantee that the existing devices support all formats and sample rates. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 protected: | 192 protected: |
186 AudioManager(); | 193 AudioManager(); |
187 | 194 |
188 private: | 195 private: |
189 DISALLOW_COPY_AND_ASSIGN(AudioManager); | 196 DISALLOW_COPY_AND_ASSIGN(AudioManager); |
190 }; | 197 }; |
191 | 198 |
192 } // namespace media | 199 } // namespace media |
193 | 200 |
194 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ | 201 #endif // MEDIA_AUDIO_AUDIO_MANAGER_H_ |
OLD | NEW |