Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: media/audio/audio_manager_base.h

Issue 2503693002: Tracks all open input streams in AudioManagerBase. (Closed)
Patch Set: fixes compile error on windows Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/audio/audio_manager_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_set>
10 #include <utility> 11 #include <utility>
11 12
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
15 #include "base/observer_list.h" 16 #include "base/observer_list.h"
16 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
17 #include "build/build_config.h" 18 #include "build/build_config.h"
18 #include "media/audio/audio_manager.h" 19 #include "media/audio/audio_manager.h"
19 #include "media/audio/audio_output_dispatcher.h" 20 #include "media/audio/audio_output_dispatcher.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format. 91 // Creates the input stream for the |AUDIO_PCM_LOW_LATENCY| format.
91 virtual AudioInputStream* MakeLowLatencyInputStream( 92 virtual AudioInputStream* MakeLowLatencyInputStream(
92 const AudioParameters& params, 93 const AudioParameters& params,
93 const std::string& device_id, 94 const std::string& device_id,
94 const LogCallback& log_callback) = 0; 95 const LogCallback& log_callback) = 0;
95 96
96 std::string GetGroupIDOutput(const std::string& output_device_id) override; 97 std::string GetGroupIDOutput(const std::string& output_device_id) override;
97 std::string GetGroupIDInput(const std::string& input_device_id) override; 98 std::string GetGroupIDInput(const std::string& input_device_id) override;
98 99
99 // Get number of input or output streams. 100 // Get number of input or output streams.
100 int input_stream_count() const { return num_input_streams_; } 101 int input_stream_count() const {
102 return static_cast<int>(input_streams_.size());
103 }
101 int output_stream_count() const { return num_output_streams_; } 104 int output_stream_count() const { return num_output_streams_; }
102 105
103 protected: 106 protected:
104 AudioManagerBase( 107 AudioManagerBase(
105 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 108 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
106 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 109 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
107 AudioLogFactory* audio_log_factory); 110 AudioLogFactory* audio_log_factory);
108 111
109 // Releases all the audio output dispatchers. 112 // Releases all the audio output dispatchers.
110 // All audio streams should be closed before Shutdown() is called. 113 // All audio streams should be closed before Shutdown() is called.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Max number of open output streams, modified by 150 // Max number of open output streams, modified by
148 // SetMaxOutputStreamsAllowed(). 151 // SetMaxOutputStreamsAllowed().
149 int max_num_output_streams_; 152 int max_num_output_streams_;
150 153
151 // Max number of open input streams. 154 // Max number of open input streams.
152 int max_num_input_streams_; 155 int max_num_input_streams_;
153 156
154 // Number of currently open output streams. 157 // Number of currently open output streams.
155 int num_output_streams_; 158 int num_output_streams_;
156 159
157 // Number of currently open input streams.
158 int num_input_streams_;
159
160 // Track output state change listeners. 160 // Track output state change listeners.
161 base::ObserverList<AudioDeviceListener> output_listeners_; 161 base::ObserverList<AudioDeviceListener> output_listeners_;
162 162
163 // Contains currently open input streams.
164 std::unordered_set<AudioInputStream*> input_streams_;
165
163 // Map of cached AudioOutputDispatcher instances. Must only be touched 166 // Map of cached AudioOutputDispatcher instances. Must only be touched
164 // from the audio thread (no locking). 167 // from the audio thread (no locking).
165 AudioOutputDispatchers output_dispatchers_; 168 AudioOutputDispatchers output_dispatchers_;
166 169
167 // Proxy for creating AudioLog objects. 170 // Proxy for creating AudioLog objects.
168 AudioLogFactory* const audio_log_factory_; 171 AudioLogFactory* const audio_log_factory_;
169 172
170 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase); 173 DISALLOW_COPY_AND_ASSIGN(AudioManagerBase);
171 }; 174 };
172 175
173 } // namespace media 176 } // namespace media
174 177
175 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_ 178 #endif // MEDIA_AUDIO_AUDIO_MANAGER_BASE_H_
OLDNEW
« no previous file with comments | « no previous file | media/audio/audio_manager_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698