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 <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/atomic_ref_count.h" | |
12 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
15 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
16 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
17 #include "media/audio/audio_manager.h" | 16 #include "media/audio/audio_manager.h" |
18 | 17 |
19 #include "media/audio/audio_output_dispatcher.h" | 18 #include "media/audio/audio_output_dispatcher.h" |
20 | 19 |
21 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 const AudioParameters& params, | 53 const AudioParameters& params, |
55 const std::string& input_device_id) OVERRIDE; | 54 const std::string& input_device_id) OVERRIDE; |
56 | 55 |
57 virtual AudioInputStream* MakeAudioInputStream( | 56 virtual AudioInputStream* MakeAudioInputStream( |
58 const AudioParameters& params, const std::string& device_id) OVERRIDE; | 57 const AudioParameters& params, const std::string& device_id) OVERRIDE; |
59 | 58 |
60 virtual AudioOutputStream* MakeAudioOutputStreamProxy( | 59 virtual AudioOutputStream* MakeAudioOutputStreamProxy( |
61 const AudioParameters& params, | 60 const AudioParameters& params, |
62 const std::string& input_device_id) OVERRIDE; | 61 const std::string& input_device_id) OVERRIDE; |
63 | 62 |
64 virtual bool IsRecordingInProcess() OVERRIDE; | |
65 | |
66 // Called internally by the audio stream when it has been closed. | 63 // Called internally by the audio stream when it has been closed. |
67 virtual void ReleaseOutputStream(AudioOutputStream* stream); | 64 virtual void ReleaseOutputStream(AudioOutputStream* stream); |
68 virtual void ReleaseInputStream(AudioInputStream* stream); | 65 virtual void ReleaseInputStream(AudioInputStream* stream); |
69 | 66 |
70 void IncreaseActiveInputStreamCount(); | |
71 void DecreaseActiveInputStreamCount(); | |
72 | |
73 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy | 67 // Creates the output stream for the |AUDIO_PCM_LINEAR| format. The legacy |
74 // name is also from |AUDIO_PCM_LINEAR|. | 68 // name is also from |AUDIO_PCM_LINEAR|. |
75 virtual AudioOutputStream* MakeLinearOutputStream( | 69 virtual AudioOutputStream* MakeLinearOutputStream( |
76 const AudioParameters& params) = 0; | 70 const AudioParameters& params) = 0; |
77 | 71 |
78 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. | 72 // Creates the output stream for the |AUDIO_PCM_LOW_LATENCY| format. |
79 // |input_device_id| is used by unified IO to open the correct input device. | 73 // |input_device_id| is used by unified IO to open the correct input device. |
80 virtual AudioOutputStream* MakeLowLatencyOutputStream( | 74 virtual AudioOutputStream* MakeLowLatencyOutputStream( |
81 const AudioParameters& params, const std::string& input_device_id) = 0; | 75 const AudioParameters& params, const std::string& input_device_id) = 0; |
82 | 76 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 124 |
131 private: | 125 private: |
132 struct DispatcherParams; | 126 struct DispatcherParams; |
133 typedef ScopedVector<DispatcherParams> AudioOutputDispatchers; | 127 typedef ScopedVector<DispatcherParams> AudioOutputDispatchers; |
134 | 128 |
135 class CompareByParams; | 129 class CompareByParams; |
136 | 130 |
137 // Called by Shutdown(). | 131 // Called by Shutdown(). |
138 void ShutdownOnAudioThread(); | 132 void ShutdownOnAudioThread(); |
139 | 133 |
140 // Counts the number of active input streams to find out if something else | |
141 // is currently recording in Chrome. | |
142 base::AtomicRefCount num_active_input_streams_; | |
143 | |
144 // Max number of open output streams, modified by | 134 // Max number of open output streams, modified by |
145 // SetMaxOutputStreamsAllowed(). | 135 // SetMaxOutputStreamsAllowed(). |
146 int max_num_output_streams_; | 136 int max_num_output_streams_; |
147 | 137 |
148 // Max number of open input streams. | 138 // Max number of open input streams. |
149 int max_num_input_streams_; | 139 int max_num_input_streams_; |
150 | 140 |
151 // Number of currently open output streams. | 141 // Number of currently open output streams. |
152 int num_output_streams_; | 142 int num_output_streams_; |
153 | 143 |
(...skipping 15 matching lines...) Expand all Loading... |
169 // Map of cached AudioOutputDispatcher instances. Must only be touched | 159 // Map of cached AudioOutputDispatcher instances. Must only be touched |
170 // from the audio thread (no locking). | 160 // from the audio thread (no locking). |
171 AudioOutputDispatchers output_dispatchers_; | 161 AudioOutputDispatchers output_dispatchers_; |
172 | 162 |
173 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); | 163 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); |
174 }; | 164 }; |
175 | 165 |
176 } // namespace media | 166 } // namespace media |
177 | 167 |
178 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ | 168 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ |
OLD | NEW |