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 | 10 |
| 11 #include "base/atomic_ref_count.h" | 11 #include "base/atomic_ref_count.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "base/threading/thread.h" | |
|
henrika (OOO until Aug 14)
2012/09/17 16:44:08
Will fix.
| |
| 16 #include "base/win/scoped_com_initializer.h" | |
| 15 #include "media/audio/audio_manager.h" | 17 #include "media/audio/audio_manager.h" |
| 16 | 18 |
| 17 namespace base { | |
| 18 class Thread; | |
| 19 } | |
| 20 | |
| 21 namespace media { | 19 namespace media { |
| 22 | 20 |
| 23 class AudioOutputDispatcher; | 21 class AudioOutputDispatcher; |
| 22 class AudioThread; | |
| 24 | 23 |
| 25 // AudioManagerBase provides AudioManager functions common for all platforms. | 24 // AudioManagerBase provides AudioManager functions common for all platforms. |
| 26 class MEDIA_EXPORT AudioManagerBase : public AudioManager { | 25 class MEDIA_EXPORT AudioManagerBase : public AudioManager { |
| 27 public: | 26 public: |
| 28 // Name of the generic "default" device. | 27 // Name of the generic "default" device. |
| 29 static const char kDefaultDeviceName[]; | 28 static const char kDefaultDeviceName[]; |
| 30 // Unique Id of the generic "default" device. | 29 // Unique Id of the generic "default" device. |
| 31 static const char kDefaultDeviceId[]; | 30 static const char kDefaultDeviceId[]; |
| 32 | 31 |
| 33 virtual ~AudioManagerBase(); | 32 virtual ~AudioManagerBase(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 // Shutdown is called. | 100 // Shutdown is called. |
| 102 // This must be called in the destructor of the AudioManager<Platform>. | 101 // This must be called in the destructor of the AudioManager<Platform>. |
| 103 void Shutdown(); | 102 void Shutdown(); |
| 104 | 103 |
| 105 void ShutdownOnAudioThread(); | 104 void ShutdownOnAudioThread(); |
| 106 | 105 |
| 107 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } | 106 void SetMaxOutputStreamsAllowed(int max) { max_num_output_streams_ = max; } |
| 108 | 107 |
| 109 // Thread used to interact with AudioOutputStreams created by this | 108 // Thread used to interact with AudioOutputStreams created by this |
| 110 // audio manger. | 109 // audio manger. |
| 111 scoped_ptr<base::Thread> audio_thread_; | 110 scoped_ptr<media::AudioThread> audio_thread_; |
| 112 mutable base::Lock audio_thread_lock_; | 111 mutable base::Lock audio_thread_lock_; |
| 113 | 112 |
| 114 // Map of cached AudioOutputDispatcher instances. Must only be touched | 113 // Map of cached AudioOutputDispatcher instances. Must only be touched |
| 115 // from the audio thread (no locking). | 114 // from the audio thread (no locking). |
| 116 AudioOutputDispatchersMap output_dispatchers_; | 115 AudioOutputDispatchersMap output_dispatchers_; |
| 117 | 116 |
| 118 private: | 117 private: |
| 119 // Counts the number of active input streams to find out if something else | 118 // Counts the number of active input streams to find out if something else |
| 120 // is currently recording in Chrome. | 119 // is currently recording in Chrome. |
| 121 base::AtomicRefCount num_active_input_streams_; | 120 base::AtomicRefCount num_active_input_streams_; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 132 | 131 |
| 133 // Number of currently open input streams. | 132 // Number of currently open input streams. |
| 134 int num_input_streams_; | 133 int num_input_streams_; |
| 135 | 134 |
| 136 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 135 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 } // namespace media | 138 } // namespace media |
| 140 | 139 |
| 141 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 140 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
| OLD | NEW |