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

Side by Side Diff: media/audio/win/audio_manager_win.cc

Issue 819203002: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/win/audio_low_latency_output_win.cc ('k') | media/audio/win/core_audio_util_win.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_io.h" 5 #include "media/audio/audio_io.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <objbase.h> // This has to be before initguid.h 8 #include <objbase.h> // This has to be before initguid.h
9 #include <initguid.h> 9 #include <initguid.h>
10 #include <mmsystem.h> 10 #include <mmsystem.h>
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 SetupDiSetDeviceInstallParams(device_info, device_data, 106 SetupDiSetDeviceInstallParams(device_info, device_data,
107 &old_device_install_params); 107 &old_device_install_params);
108 108
109 return device_and_driver_info; 109 return device_and_driver_info;
110 } 110 }
111 111
112 static int NumberOfWaveOutBuffers() { 112 static int NumberOfWaveOutBuffers() {
113 // Use the user provided buffer count if provided. 113 // Use the user provided buffer count if provided.
114 int buffers = 0; 114 int buffers = 0;
115 std::string buffers_str(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 115 std::string buffers_str(
116 switches::kWaveOutBuffers)); 116 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
117 switches::kWaveOutBuffers));
117 if (base::StringToInt(buffers_str, &buffers) && buffers > 0) { 118 if (base::StringToInt(buffers_str, &buffers) && buffers > 0) {
118 return buffers; 119 return buffers;
119 } 120 }
120 121
121 // Use 4 buffers for Vista, 3 for everyone else: 122 // Use 4 buffers for Vista, 3 for everyone else:
122 // - The entire Windows audio stack was rewritten for Windows Vista and wave 123 // - The entire Windows audio stack was rewritten for Windows Vista and wave
123 // out performance was degraded compared to XP. 124 // out performance was degraded compared to XP.
124 // - The regression was fixed in Windows 7 and most configurations will work 125 // - The regression was fixed in Windows 7 and most configurations will work
125 // with 2, but some (e.g., some Sound Blasters) still need 3. 126 // with 2, but some (e.g., some Sound Blasters) still need 3.
126 // - Some XP configurations (even multi-processor ones) also need 3. 127 // - Some XP configurations (even multi-processor ones) also need 3.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 program = L"sndvol32.exe"; 252 program = L"sndvol32.exe";
252 argument = "-R"; 253 argument = "-R";
253 } else { 254 } else {
254 program = L"control.exe"; 255 program = L"control.exe";
255 argument = "mmsys.cpl,,1"; 256 argument = "mmsys.cpl,,1";
256 } 257 }
257 258
258 base::FilePath path; 259 base::FilePath path;
259 PathService::Get(base::DIR_SYSTEM, &path); 260 PathService::Get(base::DIR_SYSTEM, &path);
260 path = path.Append(program); 261 path = path.Append(program);
261 CommandLine command_line(path); 262 base::CommandLine command_line(path);
262 command_line.AppendArg(argument); 263 command_line.AppendArg(argument);
263 base::LaunchProcess(command_line, base::LaunchOptions()); 264 base::LaunchProcess(command_line, base::LaunchOptions());
264 } 265 }
265 266
266 void AudioManagerWin::GetAudioDeviceNamesImpl( 267 void AudioManagerWin::GetAudioDeviceNamesImpl(
267 bool input, 268 bool input,
268 AudioDeviceNames* device_names) { 269 AudioDeviceNames* device_names) {
269 DCHECK(device_names->empty()); 270 DCHECK(device_names->empty());
270 // Enumerate all active audio-endpoint capture devices. 271 // Enumerate all active audio-endpoint capture devices.
271 if (enumeration_type() == kWaveEnumeration) { 272 if (enumeration_type() == kWaveEnumeration) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 return std::string(); 412 return std::string();
412 return CoreAudioUtil::GetDefaultOutputDeviceID(); 413 return CoreAudioUtil::GetDefaultOutputDeviceID();
413 } 414 }
414 415
415 AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters( 416 AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters(
416 const std::string& output_device_id, 417 const std::string& output_device_id,
417 const AudioParameters& input_params) { 418 const AudioParameters& input_params) {
418 DLOG_IF(ERROR, !core_audio_supported() && !output_device_id.empty()) 419 DLOG_IF(ERROR, !core_audio_supported() && !output_device_id.empty())
419 << "CoreAudio is required to open non-default devices."; 420 << "CoreAudio is required to open non-default devices.";
420 421
421 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 422 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
422 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; 423 ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
423 int sample_rate = 48000; 424 int sample_rate = 48000;
424 int buffer_size = kFallbackBufferSize; 425 int buffer_size = kFallbackBufferSize;
425 int bits_per_sample = 16; 426 int bits_per_sample = 16;
426 int effects = AudioParameters::NO_EFFECTS; 427 int effects = AudioParameters::NO_EFFECTS;
427 bool use_input_params = !core_audio_supported(); 428 bool use_input_params = !core_audio_supported();
428 if (core_audio_supported()) { 429 if (core_audio_supported()) {
429 if (cmd_line->HasSwitch(switches::kEnableExclusiveAudio)) { 430 if (cmd_line->HasSwitch(switches::kEnableExclusiveAudio)) {
430 // TODO(rtoy): tune these values for best possible WebAudio 431 // TODO(rtoy): tune these values for best possible WebAudio
431 // performance. WebRTC works well at 48kHz and a buffer size of 480 432 // performance. WebRTC works well at 48kHz and a buffer size of 480
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, 529 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers,
529 xp_device_id); 530 xp_device_id);
530 } 531 }
531 532
532 /// static 533 /// static
533 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { 534 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) {
534 return new AudioManagerWin(audio_log_factory); 535 return new AudioManagerWin(audio_log_factory);
535 } 536 }
536 537
537 } // namespace media 538 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.cc ('k') | media/audio/win/core_audio_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698