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

Side by Side Diff: content/browser/renderer_host/media/audio_input_device_manager.cc

Issue 2968673002: Making AudioInputDeviceManager to return UnavailableDeviceParameters when there are no physical inp… (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | no next file » | 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 "content/browser/renderer_host/media/audio_input_device_manager.h" 5 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 base::TimeTicks start_time, 164 base::TimeTicks start_time,
165 const media::AudioParameters& input_params, 165 const media::AudioParameters& input_params,
166 const media::AudioParameters& matched_output_params, 166 const media::AudioParameters& matched_output_params,
167 const std::string& matched_output_device_id) { 167 const std::string& matched_output_device_id) {
168 DCHECK_CURRENTLY_ON(BrowserThread::IO); 168 DCHECK_CURRENTLY_ON(BrowserThread::IO);
169 DCHECK(GetDevice(session_id) == devices_.end()); 169 DCHECK(GetDevice(session_id) == devices_.end());
170 170
171 UMA_HISTOGRAM_TIMES("Media.AudioInputDeviceManager.OpenOnDeviceThreadTime", 171 UMA_HISTOGRAM_TIMES("Media.AudioInputDeviceManager.OpenOnDeviceThreadTime",
172 base::TimeTicks::Now() - start_time); 172 base::TimeTicks::Now() - start_time);
173 173
174 media::AudioParameters valid_input_params =
175 input_params.IsValid()
176 ? input_params
177 : media::AudioParameters::UnavailableDeviceParams();
178
174 StreamDeviceInfo info(device.type, device.name, device.id); 179 StreamDeviceInfo info(device.type, device.name, device.id);
175 info.session_id = session_id; 180 info.session_id = session_id;
176 info.device.input.sample_rate = input_params.sample_rate(); 181 info.device.input.sample_rate = valid_input_params.sample_rate();
177 info.device.input.channel_layout = input_params.channel_layout(); 182 info.device.input.channel_layout = valid_input_params.channel_layout();
178 info.device.input.frames_per_buffer = input_params.frames_per_buffer(); 183 info.device.input.frames_per_buffer = valid_input_params.frames_per_buffer();
179 info.device.input.effects = input_params.effects(); 184 info.device.input.effects = valid_input_params.effects();
180 info.device.input.mic_positions = input_params.mic_positions(); 185 info.device.input.mic_positions = valid_input_params.mic_positions();
181 info.device.matched_output_device_id = matched_output_device_id; 186 info.device.matched_output_device_id = matched_output_device_id;
182 info.device.matched_output.sample_rate = matched_output_params.sample_rate(); 187 info.device.matched_output.sample_rate = matched_output_params.sample_rate();
183 info.device.matched_output.channel_layout = 188 info.device.matched_output.channel_layout =
184 matched_output_params.channel_layout(); 189 matched_output_params.channel_layout();
185 info.device.matched_output.frames_per_buffer = 190 info.device.matched_output.frames_per_buffer =
186 matched_output_params.frames_per_buffer(); 191 matched_output_params.frames_per_buffer();
187 info.device.matched_output.effects = matched_output_params.effects(); 192 info.device.matched_output.effects = matched_output_params.effects();
188 193
189 devices_.push_back(info); 194 devices_.push_back(info);
190 195
(...skipping 22 matching lines...) Expand all
213 218
214 #if defined(OS_CHROMEOS) 219 #if defined(OS_CHROMEOS)
215 void AudioInputDeviceManager::SetKeyboardMicStreamActiveOnUIThread( 220 void AudioInputDeviceManager::SetKeyboardMicStreamActiveOnUIThread(
216 bool active) { 221 bool active) {
217 DCHECK_CURRENTLY_ON(BrowserThread::UI); 222 DCHECK_CURRENTLY_ON(BrowserThread::UI);
218 chromeos::CrasAudioHandler::Get()->SetKeyboardMicActive(active); 223 chromeos::CrasAudioHandler::Get()->SetKeyboardMicActive(active);
219 } 224 }
220 #endif 225 #endif
221 226
222 } // namespace content 227 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698