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