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

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

Issue 2538793002: Log audio system used to WebRTC log. (Closed)
Patch Set: Code review. Created 4 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
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // some time to return we won't lose audio. More buffers while recording are 60 // some time to return we won't lose audio. More buffers while recording are
61 // ok because they don't introduce any delay in recording, unlike in playback 61 // ok because they don't introduce any delay in recording, unlike in playback
62 // where you first need to fill in that number of buffers before starting to 62 // where you first need to fill in that number of buffers before starting to
63 // play. 63 // play.
64 static const int kNumInputBuffers = 3; 64 static const int kNumInputBuffers = 3;
65 65
66 // Buffer size to use for input and output stream when a proper size can't be 66 // Buffer size to use for input and output stream when a proper size can't be
67 // determined from the system 67 // determined from the system
68 static const int kFallbackBufferSize = 2048; 68 static const int kFallbackBufferSize = 2048;
69 69
70 namespace {
71 const char kAudioManagerName[] = "Windows";
72 }
73
70 static int GetVersionPartAsInt(DWORDLONG num) { 74 static int GetVersionPartAsInt(DWORDLONG num) {
71 return static_cast<int>(num & 0xffff); 75 return static_cast<int>(num & 0xffff);
72 } 76 }
73 77
74 // Returns a string containing the given device's description and installed 78 // Returns a string containing the given device's description and installed
75 // driver version. 79 // driver version.
76 static base::string16 GetDeviceAndDriverInfo(HDEVINFO device_info, 80 static base::string16 GetDeviceAndDriverInfo(HDEVINFO device_info,
77 SP_DEVINFO_DATA* device_data) { 81 SP_DEVINFO_DATA* device_data) {
78 // Save the old install params setting and set a flag for the 82 // Save the old install params setting and set a flag for the
79 // SetupDiBuildDriverInfoList below to return only the installed drivers. 83 // SetupDiBuildDriverInfoList below to return only the installed drivers.
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 std::string AudioManagerWin::GetAssociatedOutputDeviceID( 328 std::string AudioManagerWin::GetAssociatedOutputDeviceID(
325 const std::string& input_device_id) { 329 const std::string& input_device_id) {
326 if (!core_audio_supported()) { 330 if (!core_audio_supported()) {
327 NOTIMPLEMENTED() 331 NOTIMPLEMENTED()
328 << "GetAssociatedOutputDeviceID is not supported on this OS"; 332 << "GetAssociatedOutputDeviceID is not supported on this OS";
329 return std::string(); 333 return std::string();
330 } 334 }
331 return CoreAudioUtil::GetMatchingOutputDeviceID(input_device_id); 335 return CoreAudioUtil::GetMatchingOutputDeviceID(input_device_id);
332 } 336 }
333 337
338 const char* AudioManagerWin::GetName() {
339 return kAudioManagerName;
340 }
341
334 // Factory for the implementations of AudioOutputStream for AUDIO_PCM_LINEAR 342 // Factory for the implementations of AudioOutputStream for AUDIO_PCM_LINEAR
335 // mode. 343 // mode.
336 // - PCMWaveOutAudioOutputStream: Based on the waveOut API. 344 // - PCMWaveOutAudioOutputStream: Based on the waveOut API.
337 AudioOutputStream* AudioManagerWin::MakeLinearOutputStream( 345 AudioOutputStream* AudioManagerWin::MakeLinearOutputStream(
338 const AudioParameters& params, 346 const AudioParameters& params,
339 const LogCallback& log_callback) { 347 const LogCallback& log_callback) {
340 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); 348 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
341 if (params.channels() > kWinMaxChannels) 349 if (params.channels() > kWinMaxChannels)
342 return NULL; 350 return NULL;
343 351
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 ScopedAudioManagerPtr CreateAudioManager( 550 ScopedAudioManagerPtr CreateAudioManager(
543 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 551 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
544 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 552 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
545 AudioLogFactory* audio_log_factory) { 553 AudioLogFactory* audio_log_factory) {
546 return ScopedAudioManagerPtr( 554 return ScopedAudioManagerPtr(
547 new AudioManagerWin(std::move(task_runner), std::move(worker_task_runner), 555 new AudioManagerWin(std::move(task_runner), std::move(worker_task_runner),
548 audio_log_factory)); 556 audio_log_factory));
549 } 557 }
550 558
551 } // namespace media 559 } // namespace media
OLDNEW
« chromecast/media/audio/cast_audio_manager.cc ('K') | « media/audio/win/audio_manager_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698