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

Unified Diff: media/audio/audio_manager_base.h

Issue 9570014: Move some generic functions to AudioManagerBase to be inherited by platform-specific AudioManager*** (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changed the GetMaxOutputStreamsAllowed Created 8 years, 9 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_base.h
diff --git a/media/audio/audio_manager_base.h b/media/audio/audio_manager_base.h
index 7f42ea70d81a7c4c9fd1d43bfff192eb6ba36191..42814379756d1bf2df714d26f9c521c806cbf152 100644
--- a/media/audio/audio_manager_base.h
+++ b/media/audio/audio_manager_base.h
@@ -38,14 +38,24 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
virtual bool CanShowAudioInputSettings() OVERRIDE;
virtual void ShowAudioInputSettings() OVERRIDE;
- virtual void GetAudioInputDeviceNames(media::AudioDeviceNames* device_names)
- OVERRIDE;
+ virtual void GetAudioInputDeviceNames(
+ media::AudioDeviceNames* device_names) OVERRIDE;
+
+ virtual AudioOutputStream* MakeAudioOutputStream(
+ const AudioParameters& params) OVERRIDE;
+
+ virtual AudioInputStream* MakeAudioInputStream(
+ const AudioParameters& params, const std::string& device_id) OVERRIDE;
virtual AudioOutputStream* MakeAudioOutputStreamProxy(
const AudioParameters& params) OVERRIDE;
virtual bool IsRecordingInProcess() OVERRIDE;
+ // Called internally by the audio stream when it has been closed.
+ virtual void ReleaseOutputStream(AudioOutputStream* stream);
+ virtual void ReleaseInputStream(AudioInputStream* stream);
+
void IncreaseActiveInputStreamCount();
void DecreaseActiveInputStreamCount();
@@ -54,6 +64,24 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
// Shutdown is called.
void Shutdown();
+ // Creates the output stream for the |AUDIO_PCM_LINEAR format|. The legacy
scherkus (not reviewing) 2012/03/06 22:31:51 nit: move format outside of ||
no longer working on chromium 2012/03/07 09:57:08 Done.
+ // name is also from |AUDIO_PCM_LINEAR|.
+ virtual AudioOutputStream* MakeLinearOutputStream(
+ const AudioParameters& params) = 0;
+
+ // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format.
+ virtual AudioOutputStream* MakeLowLatencyOutputStream(
+ const AudioParameters& params) = 0;
+
+ // Creates the input stream for the |AUDIO_PCM_LINEAR format|. The legacy
scherkus (not reviewing) 2012/03/06 22:31:51 nit: move format outside of ||
no longer working on chromium 2012/03/07 09:57:08 Done.
+ // name is also from |AUDIO_PCM_LINEAR|.
+ virtual AudioInputStream* MakeLinearInputStream(
+ const AudioParameters& params, const std::string& device_id) = 0;
+
+ // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format.
+ virtual AudioInputStream* MakeLowLatencyInputStream(
+ const AudioParameters& params, const std::string& device_id) = 0;
+
protected:
AudioManagerBase();
@@ -63,6 +91,8 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
void ShutdownOnAudioThread();
+ void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; }
+
// Thread used to interact with AudioOutputStreams created by this
// audio manger.
scoped_ptr<base::Thread> audio_thread_;
@@ -76,6 +106,13 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
// is currently recording in Chrome.
base::AtomicRefCount num_active_input_streams_;
+ // Max number of open output streams, modified by
+ // SetMaxOutputStreamsAllowed().
+ int max_num_output_streams_;
+
+ // Number of currently open output streams.
+ int num_output_streams_;
+
DISALLOW_COPY_AND_ASSIGN(AudioManagerBase);
};

Powered by Google App Engine
This is Rietveld 408576698