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

Unified Diff: media/audio/audio_manager.h

Issue 1104583002: Adds method to provide custom AudioManager at runtime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fixes, update to test factory. Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/BUILD.gn ('k') | media/audio/audio_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « media/audio/BUILD.gn ('k') | media/audio/audio_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698