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

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: addressed tommi's comments and changed alsa unittest to use Close() to delete stream 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..1c1c098996ddcaec65d038ee3f8e748edcb2cdc3 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,28 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
// Shutdown is called.
void Shutdown();
+ // Returns the platform specific number of audio streams allowed. This is a
+ // practical limit to prevent failure caused by too many audio streams opened.
+ virtual int GetMaxOutputStreamsAllowed() = 0;
tommi (sloooow) - chröme 2012/03/06 16:16:04 nit: Instead of a pure virtual function + implemen
no longer working on chromium 2012/03/06 17:38:41 Done.
+
+ // 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();
@@ -76,6 +108,9 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
// is currently recording in Chrome.
base::AtomicRefCount num_active_input_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