Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 6 #define MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/atomic_ref_count.h" | 12 #include "base/atomic_ref_count.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "media/audio/audio_manager.h" | 17 #include "media/audio/audio_manager.h" |
| 18 | 18 |
| 19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 20 #include "base/win/scoped_com_initializer.h" | 20 #include "base/win/scoped_com_initializer.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class Thread; | 24 class Thread; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace media { | 27 namespace media { |
| 28 | 28 |
| 29 class AudioOutputDispatcher; | 29 class AudioOutputDispatcher; |
| 30 class VirtualAudioInputStream; | |
| 31 class VirtualAudioOutputStream; | |
| 30 | 32 |
| 31 // AudioManagerBase provides AudioManager functions common for all platforms. | 33 // AudioManagerBase provides AudioManager functions common for all platforms. |
| 32 class MEDIA_EXPORT AudioManagerBase : public AudioManager { | 34 class MEDIA_EXPORT AudioManagerBase : public AudioManager { |
| 33 public: | 35 public: |
| 34 // Name of the generic "default" device. | 36 // Name of the generic "default" device. |
| 35 static const char kDefaultDeviceName[]; | 37 static const char kDefaultDeviceName[]; |
| 36 // Unique Id of the generic "default" device. | 38 // Unique Id of the generic "default" device. |
| 37 static const char kDefaultDeviceId[]; | 39 static const char kDefaultDeviceId[]; |
| 38 | 40 |
| 39 virtual ~AudioManagerBase(); | 41 virtual ~AudioManagerBase(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 55 const AudioParameters& params, const std::string& device_id) OVERRIDE; | 57 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
| 56 | 58 |
| 57 virtual AudioOutputStream* MakeAudioOutputStreamProxy( | 59 virtual AudioOutputStream* MakeAudioOutputStreamProxy( |
| 58 const AudioParameters& params) OVERRIDE; | 60 const AudioParameters& params) OVERRIDE; |
| 59 | 61 |
| 60 virtual bool IsRecordingInProcess() OVERRIDE; | 62 virtual bool IsRecordingInProcess() OVERRIDE; |
| 61 | 63 |
| 62 // Called internally by the audio stream when it has been closed. | 64 // Called internally by the audio stream when it has been closed. |
| 63 virtual void ReleaseOutputStream(AudioOutputStream* stream); | 65 virtual void ReleaseOutputStream(AudioOutputStream* stream); |
| 64 virtual void ReleaseInputStream(AudioInputStream* stream); | 66 virtual void ReleaseInputStream(AudioInputStream* stream); |
| 67 // Used by VirtualAudioOutputStreams | |
| 68 virtual void ReleaseVirtualOutputStream(VirtualAudioOutputStream* stream); | |
| 65 | 69 |
| 66 void IncreaseActiveInputStreamCount(); | 70 void IncreaseActiveInputStreamCount(); |
| 67 void DecreaseActiveInputStreamCount(); | 71 void DecreaseActiveInputStreamCount(); |
| 68 | 72 |
| 69 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy | 73 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy |
| 70 // name is also from |AUDIO_PCM_LINEAR|. | 74 // name is also from |AUDIO_PCM_LINEAR|. |
| 71 virtual AudioOutputStream* MakeLinearOutputStream( | 75 virtual AudioOutputStream* MakeLinearOutputStream( |
| 72 const AudioParameters& params) = 0; | 76 const AudioParameters& params) = 0; |
| 73 | 77 |
| 74 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. | 78 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 | 156 |
| 153 // Thread used to interact with audio streams created by this audio manager. | 157 // Thread used to interact with audio streams created by this audio manager. |
| 154 scoped_ptr<base::Thread> audio_thread_; | 158 scoped_ptr<base::Thread> audio_thread_; |
| 155 mutable base::Lock audio_thread_lock_; | 159 mutable base::Lock audio_thread_lock_; |
| 156 | 160 |
| 157 // The message loop of the audio thread this object runs on. Used for internal | 161 // The message loop of the audio thread this object runs on. Used for internal |
| 158 // tasks which run on the audio thread even after Shutdown() has been started | 162 // tasks which run on the audio thread even after Shutdown() has been started |
| 159 // and GetMessageLoop() starts returning NULL. | 163 // and GetMessageLoop() starts returning NULL. |
| 160 scoped_refptr<base::MessageLoopProxy> message_loop_; | 164 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 161 | 165 |
| 166 // Currently active virtual audio input stream. When this is set, we will | |
| 167 // create all audio output streams as virtual streams so as to redirect them | |
| 168 // to this virtual input stream for tab audio capture. | |
| 169 VirtualAudioInputStream* virtual_audio_input_stream_; | |
|
no longer working on chromium
2012/11/26 22:20:07
does it mean that when tab capture is being used,
justinlin
2012/11/27 22:26:12
Yes. We want to eventually be able to do this for
| |
| 170 | |
| 162 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 171 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
| 163 }; | 172 }; |
| 164 | 173 |
| 165 } // namespace media | 174 } // namespace media |
| 166 | 175 |
| 167 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 176 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
| OLD | NEW |