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

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

Issue 2023943002: Revert of Forward output glitch information from stream WebRTC log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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 | « media/audio/audio_manager_base.h ('k') | media/audio/audio_output_dispatcher_impl.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 #include "media/audio/audio_manager_base.h" 5 #include "media/audio/audio_manager_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // All the input streams should have been deleted. 98 // All the input streams should have been deleted.
99 CHECK_EQ(0, num_input_streams_); 99 CHECK_EQ(0, num_input_streams_);
100 } 100 }
101 101
102 base::string16 AudioManagerBase::GetAudioInputDeviceModel() { 102 base::string16 AudioManagerBase::GetAudioInputDeviceModel() {
103 return base::string16(); 103 return base::string16();
104 } 104 }
105 105
106 AudioOutputStream* AudioManagerBase::MakeAudioOutputStream( 106 AudioOutputStream* AudioManagerBase::MakeAudioOutputStream(
107 const AudioParameters& params, 107 const AudioParameters& params,
108 const std::string& device_id, 108 const std::string& device_id) {
109 const LogCallback& log_callback) {
110 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); 109 DCHECK(GetTaskRunner()->BelongsToCurrentThread());
111 110
112 if (!params.IsValid()) { 111 if (!params.IsValid()) {
113 DLOG(ERROR) << "Audio parameters are invalid"; 112 DLOG(ERROR) << "Audio parameters are invalid";
114 return NULL; 113 return NULL;
115 } 114 }
116 115
117 // Limit the number of audio streams opened. This is to prevent using 116 // Limit the number of audio streams opened. This is to prevent using
118 // excessive resources for a large number of audio streams. More 117 // excessive resources for a large number of audio streams. More
119 // importantly it prevents instability on certain systems. 118 // importantly it prevents instability on certain systems.
120 // See bug: http://crbug.com/30242. 119 // See bug: http://crbug.com/30242.
121 if (num_output_streams_ >= max_num_output_streams_) { 120 if (num_output_streams_ >= max_num_output_streams_) {
122 DLOG(ERROR) << "Number of opened output audio streams " 121 DLOG(ERROR) << "Number of opened output audio streams "
123 << num_output_streams_ 122 << num_output_streams_
124 << " exceed the max allowed number " 123 << " exceed the max allowed number "
125 << max_num_output_streams_; 124 << max_num_output_streams_;
126 return NULL; 125 return NULL;
127 } 126 }
128 127
129 AudioOutputStream* stream; 128 AudioOutputStream* stream;
130 switch (params.format()) { 129 switch (params.format()) {
131 case AudioParameters::AUDIO_PCM_LINEAR: 130 case AudioParameters::AUDIO_PCM_LINEAR:
132 DCHECK(AudioDeviceDescription::IsDefaultDevice(device_id)) 131 DCHECK(AudioDeviceDescription::IsDefaultDevice(device_id))
133 << "AUDIO_PCM_LINEAR supports only the default device."; 132 << "AUDIO_PCM_LINEAR supports only the default device.";
134 stream = MakeLinearOutputStream(params, log_callback); 133 stream = MakeLinearOutputStream(params);
135 break; 134 break;
136 case AudioParameters::AUDIO_PCM_LOW_LATENCY: 135 case AudioParameters::AUDIO_PCM_LOW_LATENCY:
137 stream = MakeLowLatencyOutputStream(params, device_id, log_callback); 136 stream = MakeLowLatencyOutputStream(params, device_id);
138 break; 137 break;
139 case AudioParameters::AUDIO_FAKE: 138 case AudioParameters::AUDIO_FAKE:
140 stream = FakeAudioOutputStream::MakeFakeStream(this, params); 139 stream = FakeAudioOutputStream::MakeFakeStream(this, params);
141 break; 140 break;
142 default: 141 default:
143 stream = NULL; 142 stream = NULL;
144 break; 143 break;
145 } 144 }
146 145
147 if (stream) { 146 if (stream) {
148 ++num_output_streams_; 147 ++num_output_streams_;
149 } 148 }
150 149
151 return stream; 150 return stream;
152 } 151 }
153 152
154 AudioInputStream* AudioManagerBase::MakeAudioInputStream( 153 AudioInputStream* AudioManagerBase::MakeAudioInputStream(
155 const AudioParameters& params, 154 const AudioParameters& params,
156 const std::string& device_id, 155 const std::string& device_id) {
157 const LogCallback& log_callback) {
158 DCHECK(GetTaskRunner()->BelongsToCurrentThread()); 156 DCHECK(GetTaskRunner()->BelongsToCurrentThread());
159 157
160 if (!params.IsValid() || (params.channels() > kMaxInputChannels) || 158 if (!params.IsValid() || (params.channels() > kMaxInputChannels) ||
161 device_id.empty()) { 159 device_id.empty()) {
162 DLOG(ERROR) << "Audio parameters are invalid for device " << device_id; 160 DLOG(ERROR) << "Audio parameters are invalid for device " << device_id;
163 return NULL; 161 return NULL;
164 } 162 }
165 163
166 if (num_input_streams_ >= max_num_input_streams_) { 164 if (num_input_streams_ >= max_num_input_streams_) {
167 DLOG(ERROR) << "Number of opened input audio streams " 165 DLOG(ERROR) << "Number of opened input audio streams "
168 << num_input_streams_ 166 << num_input_streams_
169 << " exceed the max allowed number " << max_num_input_streams_; 167 << " exceed the max allowed number " << max_num_input_streams_;
170 return NULL; 168 return NULL;
171 } 169 }
172 170
173 DVLOG(2) << "Creating a new AudioInputStream with buffer size = " 171 DVLOG(2) << "Creating a new AudioInputStream with buffer size = "
174 << params.frames_per_buffer(); 172 << params.frames_per_buffer();
175 173
176 AudioInputStream* stream; 174 AudioInputStream* stream;
177 switch (params.format()) { 175 switch (params.format()) {
178 case AudioParameters::AUDIO_PCM_LINEAR: 176 case AudioParameters::AUDIO_PCM_LINEAR:
179 stream = MakeLinearInputStream(params, device_id, log_callback); 177 stream = MakeLinearInputStream(params, device_id);
180 break; 178 break;
181 case AudioParameters::AUDIO_PCM_LOW_LATENCY: 179 case AudioParameters::AUDIO_PCM_LOW_LATENCY:
182 stream = MakeLowLatencyInputStream(params, device_id, log_callback); 180 stream = MakeLowLatencyInputStream(params, device_id);
183 break; 181 break;
184 case AudioParameters::AUDIO_FAKE: 182 case AudioParameters::AUDIO_FAKE:
185 stream = FakeAudioInputStream::MakeFakeStream(this, params); 183 stream = FakeAudioInputStream::MakeFakeStream(this, params);
186 break; 184 break;
187 default: 185 default:
188 stream = NULL; 186 stream = NULL;
189 break; 187 break;
190 } 188 }
191 189
192 if (stream) { 190 if (stream) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 357
360 return 0; 358 return 0;
361 } 359 }
362 360
363 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( 361 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog(
364 AudioLogFactory::AudioComponent component) { 362 AudioLogFactory::AudioComponent component) {
365 return audio_log_factory_->CreateAudioLog(component); 363 return audio_log_factory_->CreateAudioLog(component);
366 } 364 }
367 365
368 } // namespace media 366 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_manager_base.h ('k') | media/audio/audio_output_dispatcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698