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

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: rebased and fixed windows compiling 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
« no previous file with comments | « media/audio/audio_input_volume_unittest.cc ('k') | media/audio/audio_manager_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ea9c78a870965d95fb99608697280504473fe724 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
+ // 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
+ // 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_;
@@ -72,10 +102,18 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
// from the audio thread (no locking).
AudioOutputDispatchersMap output_dispatchers_;
+ private:
// Counts the number of active input streams to find out if something else
// 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);
};
« no previous file with comments | « media/audio/audio_input_volume_unittest.cc ('k') | media/audio/audio_manager_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698