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

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: Split into multiple CLs. 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
Index: media/audio/audio_manager.h
diff --git a/media/audio/audio_manager.h b/media/audio/audio_manager.h
index 5e49b8b399afd138c35f659d73823be06a0e9567..f9118b901481ab37b0928fe859b4fb4ae2076aa1 100644
--- a/media/audio/audio_manager.h
+++ b/media/audio/audio_manager.h
@@ -21,13 +21,20 @@ 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();
+
+ // Used to override the defualt implementation. After this is called, all
DaleCurtis 2015/04/23 16:18:25 default. Add some more details about why this is
slan 2015/04/23 18:11:33 Done.
+ // static AudioManager::Create* methods will return an instance of
+ // AudioManager provided by |factory|. 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 +51,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 ResetFactory();
DaleCurtis 2015/04/23 16:18:25 Name it ResetFactoryForTesting, so presubmit catch
slan 2015/04/23 18:11:33 Done.
+
// 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 +141,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;

Powered by Google App Engine
This is Rietveld 408576698