| 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 <set> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <utility> | 11 #include <utility> |
| 11 | 12 |
| 12 #include "base/atomic_ref_count.h" | 13 #include "base/atomic_ref_count.h" |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 16 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 17 #include "media/audio/audio_manager.h" | 18 #include "media/audio/audio_manager.h" |
| 18 | 19 |
| 19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
| 20 #include "base/win/scoped_com_initializer.h" | 21 #include "base/win/scoped_com_initializer.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 namespace base { | 24 namespace base { |
| 24 class Thread; | 25 class Thread; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace media { | 28 namespace media { |
| 28 | 29 |
| 29 class AudioOutputDispatcher; | 30 class AudioOutputDispatcher; |
| 30 | 31 |
| 31 // AudioManagerBase provides AudioManager functions common for all platforms. | 32 // AudioManagerBase provides AudioManager functions common for all platforms. |
| 32 class MEDIA_EXPORT AudioManagerBase : public AudioManager { | 33 class MEDIA_EXPORT AudioManagerBase : public AudioManager { |
| 33 public: | 34 public: |
| 35 typedef std::set<AudioOutputStream*> AudioOutputStreamList; |
| 36 |
| 34 // Name of the generic "default" device. | 37 // Name of the generic "default" device. |
| 35 static const char kDefaultDeviceName[]; | 38 static const char kDefaultDeviceName[]; |
| 36 // Unique Id of the generic "default" device. | 39 // Unique Id of the generic "default" device. |
| 37 static const char kDefaultDeviceId[]; | 40 static const char kDefaultDeviceId[]; |
| 38 | 41 |
| 39 virtual ~AudioManagerBase(); | 42 virtual ~AudioManagerBase(); |
| 40 | 43 |
| 41 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE; | 44 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE; |
| 42 | 45 |
| 43 virtual string16 GetAudioInputDeviceModel() OVERRIDE; | 46 virtual string16 GetAudioInputDeviceModel() OVERRIDE; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 | 62 |
| 60 virtual bool IsRecordingInProcess() OVERRIDE; | 63 virtual bool IsRecordingInProcess() OVERRIDE; |
| 61 | 64 |
| 62 // Called internally by the audio stream when it has been closed. | 65 // Called internally by the audio stream when it has been closed. |
| 63 virtual void ReleaseOutputStream(AudioOutputStream* stream); | 66 virtual void ReleaseOutputStream(AudioOutputStream* stream); |
| 64 virtual void ReleaseInputStream(AudioInputStream* stream); | 67 virtual void ReleaseInputStream(AudioInputStream* stream); |
| 65 | 68 |
| 66 void IncreaseActiveInputStreamCount(); | 69 void IncreaseActiveInputStreamCount(); |
| 67 void DecreaseActiveInputStreamCount(); | 70 void DecreaseActiveInputStreamCount(); |
| 68 | 71 |
| 72 // These must be called on the audio thread. |
| 73 void RegisterVirtualAudioOutputStream(AudioOutputStream* stream); |
| 74 void UnregisterVirtualAudioOutputStream(AudioOutputStream* stream); |
| 75 AudioOutputStreamList GetVirtualAudioOutputStreams(); |
| 76 |
| 69 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy | 77 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy |
| 70 // name is also from |AUDIO_PCM_LINEAR|. | 78 // name is also from |AUDIO_PCM_LINEAR|. |
| 71 virtual AudioOutputStream* MakeLinearOutputStream( | 79 virtual AudioOutputStream* MakeLinearOutputStream( |
| 72 const AudioParameters& params) = 0; | 80 const AudioParameters& params) = 0; |
| 73 | 81 |
| 74 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. | 82 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. |
| 75 virtual AudioOutputStream* MakeLowLatencyOutputStream( | 83 virtual AudioOutputStream* MakeLowLatencyOutputStream( |
| 76 const AudioParameters& params) = 0; | 84 const AudioParameters& params) = 0; |
| 77 | 85 |
| 78 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy | 86 // Creates the input stream for the |AUDIO_PCM_LINEAR| format. The legacy |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 160 |
| 153 // Thread used to interact with audio streams created by this audio manager. | 161 // Thread used to interact with audio streams created by this audio manager. |
| 154 scoped_ptr<base::Thread> audio_thread_; | 162 scoped_ptr<base::Thread> audio_thread_; |
| 155 mutable base::Lock audio_thread_lock_; | 163 mutable base::Lock audio_thread_lock_; |
| 156 | 164 |
| 157 // The message loop of the audio thread this object runs on. Used for internal | 165 // 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 | 166 // tasks which run on the audio thread even after Shutdown() has been started |
| 159 // and GetMessageLoop() starts returning NULL. | 167 // and GetMessageLoop() starts returning NULL. |
| 160 scoped_refptr<base::MessageLoopProxy> message_loop_; | 168 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 161 | 169 |
| 170 AudioOutputStreamList virtual_audio_output_streams_; |
| 171 |
| 162 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 172 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
| 163 }; | 173 }; |
| 164 | 174 |
| 165 } // namespace media | 175 } // namespace media |
| 166 | 176 |
| 167 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 177 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
| OLD | NEW |