Index: media/audio/audio_manager.h |
diff --git a/media/audio/audio_manager.h b/media/audio/audio_manager.h |
index 5e49b8b399afd138c35f659d73823be06a0e9567..5da521dcca33de4e76b0006cf64fefa39940bca0 100644 |
--- a/media/audio/audio_manager.h |
+++ b/media/audio/audio_manager.h |
@@ -21,13 +21,24 @@ class SingleThreadTaskRunner; |
namespace media { |
class AudioInputStream; |
+class AudioManagerFactory; |
class AudioOutputStream; |
// Manages all audio resources. Provides some convenience functions that avoid |
// the need to provide iterators over the existing streams. |
class MEDIA_EXPORT AudioManager { |
- public: |
- virtual ~AudioManager(); |
+ public: |
+ virtual ~AudioManager(); |
+ |
+ // This provides an alternative to the statically linked factory method used |
+ // to create AudioManager. This is useful for dynamically-linked third |
+ // party clients seeking to provide a platform-specific implementation of |
+ // AudioManager. After this is called, all static AudioManager::Create* |
+ // methods will return an instance of AudioManager provided by |factory|. This |
+ // call may be made at most once per process, and before any calls to static |
+ // AudioManager::Create* methods. This method takes ownership of |factory|, |
+ // which must not be NULL. |
+ static void SetFactory(AudioManagerFactory* factory); |
// Construct the audio manager; only one instance is allowed. The manager |
// will forward CreateAudioLog() calls to the provided AudioLogFactory; as |
@@ -44,6 +55,10 @@ class MEDIA_EXPORT AudioManager { |
// Similar to Create() except uses a FakeAudioLogFactory for testing. |
static AudioManager* CreateForTesting(); |
+ // Should only be used for testing. Resets a previously-set |
+ // AudioManagerFactory. The instance of AudioManager is not affected. |
+ static void ResetFactoryForTesting(); |
+ |
// Returns the pointer to the last created instance, or NULL if not yet |
// created. This is a utility method for the code outside of media directory, |
// like src/chrome. |
@@ -130,7 +145,8 @@ class MEDIA_EXPORT AudioManager { |
// Do not free the returned AudioInputStream. It is owned by AudioManager. |
// When you are done with it, call |Stop()| and |Close()| to release it. |
virtual AudioInputStream* MakeAudioInputStream( |
- const AudioParameters& params, const std::string& device_id) = 0; |
+ const AudioParameters& params, |
+ const std::string& device_id) = 0; |
// Returns the task runner used for audio IO. |
virtual scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() = 0; |