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

Side by Side Diff: media/audio/win/audio_manager_win.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/win/audio_manager_win.h ('k') | media/audio/win/audio_output_win_unittest.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/win/audio_manager_win.h" 5 #include "media/audio/win/audio_manager_win.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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 << "GetAssociatedOutputDeviceID is not supported on this OS"; 328 << "GetAssociatedOutputDeviceID is not supported on this OS";
329 return std::string(); 329 return std::string();
330 } 330 }
331 return CoreAudioUtil::GetMatchingOutputDeviceID(input_device_id); 331 return CoreAudioUtil::GetMatchingOutputDeviceID(input_device_id);
332 } 332 }
333 333
334 // Factory for the implementations of AudioOutputStream for AUDIO_PCM_LINEAR 334 // Factory for the implementations of AudioOutputStream for AUDIO_PCM_LINEAR
335 // mode. 335 // mode.
336 // - PCMWaveOutAudioOutputStream: Based on the waveOut API. 336 // - PCMWaveOutAudioOutputStream: Based on the waveOut API.
337 AudioOutputStream* AudioManagerWin::MakeLinearOutputStream( 337 AudioOutputStream* AudioManagerWin::MakeLinearOutputStream(
338 const AudioParameters& params, 338 const AudioParameters& params) {
339 const LogCallback& log_callback) {
340 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); 339 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
341 if (params.channels() > kWinMaxChannels) 340 if (params.channels() > kWinMaxChannels)
342 return NULL; 341 return NULL;
343 342
344 return new PCMWaveOutAudioOutputStream(this, 343 return new PCMWaveOutAudioOutputStream(this,
345 params, 344 params,
346 NumberOfWaveOutBuffers(), 345 NumberOfWaveOutBuffers(),
347 WAVE_MAPPER); 346 WAVE_MAPPER);
348 } 347 }
349 348
350 // Factory for the implementations of AudioOutputStream for 349 // Factory for the implementations of AudioOutputStream for
351 // AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most 350 // AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most
352 // windows user's needs. 351 // windows user's needs.
353 // - PCMWaveOutAudioOutputStream: Based on the waveOut API. 352 // - PCMWaveOutAudioOutputStream: Based on the waveOut API.
354 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API. 353 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API.
355 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream( 354 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream(
356 const AudioParameters& params, 355 const AudioParameters& params,
357 const std::string& device_id, 356 const std::string& device_id) {
358 const LogCallback& log_callback) {
359 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); 357 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
360 if (params.channels() > kWinMaxChannels) 358 if (params.channels() > kWinMaxChannels)
361 return NULL; 359 return NULL;
362 360
363 if (!core_audio_supported()) { 361 if (!core_audio_supported()) {
364 // Fall back to Windows Wave implementation on Windows XP or lower. 362 // Fall back to Windows Wave implementation on Windows XP or lower.
365 DLOG_IF(ERROR, !device_id.empty() && 363 DLOG_IF(ERROR, !device_id.empty() &&
366 device_id != AudioDeviceDescription::kDefaultDeviceId) 364 device_id != AudioDeviceDescription::kDefaultDeviceId)
367 << "Opening by device id not supported by PCMWaveOutAudioOutputStream"; 365 << "Opening by device id not supported by PCMWaveOutAudioOutputStream";
368 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; 366 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista.";
(...skipping 10 matching lines...) Expand all
379 this, 377 this,
380 communications || device_id == AudioDeviceDescription::kDefaultDeviceId 378 communications || device_id == AudioDeviceDescription::kDefaultDeviceId
381 ? std::string() 379 ? std::string()
382 : device_id, 380 : device_id,
383 params, communications ? eCommunications : eConsole); 381 params, communications ? eCommunications : eConsole);
384 } 382 }
385 383
386 // Factory for the implementations of AudioInputStream for AUDIO_PCM_LINEAR 384 // Factory for the implementations of AudioInputStream for AUDIO_PCM_LINEAR
387 // mode. 385 // mode.
388 AudioInputStream* AudioManagerWin::MakeLinearInputStream( 386 AudioInputStream* AudioManagerWin::MakeLinearInputStream(
389 const AudioParameters& params, 387 const AudioParameters& params, const std::string& device_id) {
390 const std::string& device_id,
391 const LogCallback& log_callback) {
392 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); 388 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
393 return CreatePCMWaveInAudioInputStream(params, device_id); 389 return CreatePCMWaveInAudioInputStream(params, device_id);
394 } 390 }
395 391
396 // Factory for the implementations of AudioInputStream for 392 // Factory for the implementations of AudioInputStream for
397 // AUDIO_PCM_LOW_LATENCY mode. 393 // AUDIO_PCM_LOW_LATENCY mode.
398 AudioInputStream* AudioManagerWin::MakeLowLatencyInputStream( 394 AudioInputStream* AudioManagerWin::MakeLowLatencyInputStream(
399 const AudioParameters& params, 395 const AudioParameters& params, const std::string& device_id) {
400 const std::string& device_id,
401 const LogCallback& log_callback) {
402 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); 396 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
403 DVLOG(1) << "MakeLowLatencyInputStream: " << device_id; 397 DVLOG(1) << "MakeLowLatencyInputStream: " << device_id;
404 AudioInputStream* stream = NULL; 398 AudioInputStream* stream = NULL;
405 UMA_HISTOGRAM_BOOLEAN("Media.WindowsCoreAudioInput", core_audio_supported()); 399 UMA_HISTOGRAM_BOOLEAN("Media.WindowsCoreAudioInput", core_audio_supported());
406 if (!core_audio_supported()) { 400 if (!core_audio_supported()) {
407 // Fall back to Windows Wave implementation on Windows XP or lower. 401 // Fall back to Windows Wave implementation on Windows XP or lower.
408 DVLOG(1) << "Using WaveIn since WASAPI requires at least Vista."; 402 DVLOG(1) << "Using WaveIn since WASAPI requires at least Vista.";
409 stream = CreatePCMWaveInAudioInputStream(params, device_id); 403 stream = CreatePCMWaveInAudioInputStream(params, device_id);
410 } else { 404 } else {
411 stream = new WASAPIAudioInputStream(this, params, device_id); 405 stream = new WASAPIAudioInputStream(this, params, device_id);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 ScopedAudioManagerPtr CreateAudioManager( 536 ScopedAudioManagerPtr CreateAudioManager(
543 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 537 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
544 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 538 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
545 AudioLogFactory* audio_log_factory) { 539 AudioLogFactory* audio_log_factory) {
546 return ScopedAudioManagerPtr( 540 return ScopedAudioManagerPtr(
547 new AudioManagerWin(std::move(task_runner), std::move(worker_task_runner), 541 new AudioManagerWin(std::move(task_runner), std::move(worker_task_runner),
548 audio_log_factory)); 542 audio_log_factory));
549 } 543 }
550 544
551 } // namespace media 545 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_manager_win.h ('k') | media/audio/win/audio_output_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698