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

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

Issue 2563653002: Replace AudioManager::GetAudio*DeviceNames with AudioManager::GetAudio*DeviceDescriptions (Closed)
Patch Set: nit fixes 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
« no previous file with comments | « media/audio/audio_manager_base.h ('k') | media/audio/audio_manager_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/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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // All the output streams should have been deleted. 95 // All the output streams should have been deleted.
96 CHECK_EQ(0, num_output_streams_); 96 CHECK_EQ(0, num_output_streams_);
97 // All the input streams should have been deleted. 97 // All the input streams should have been deleted.
98 CHECK(input_streams_.empty()); 98 CHECK(input_streams_.empty());
99 } 99 }
100 100
101 base::string16 AudioManagerBase::GetAudioInputDeviceModel() { 101 base::string16 AudioManagerBase::GetAudioInputDeviceModel() {
102 return base::string16(); 102 return base::string16();
103 } 103 }
104 104
105 void AudioManagerBase::GetAudioInputDeviceDescriptions(
106 AudioDeviceDescriptions* device_descriptions) {
107 CHECK(GetTaskRunner()->BelongsToCurrentThread());
108 AudioDeviceNames device_names;
109 GetAudioInputDeviceNames(&device_names);
110
111 for (const media::AudioDeviceName& name : device_names) {
112 device_descriptions->emplace_back(name.device_name, name.unique_id,
113 GetGroupIDInput(name.unique_id));
114 }
115 }
116
117 void AudioManagerBase::GetAudioOutputDeviceDescriptions(
118 AudioDeviceDescriptions* device_descriptions) {
119 CHECK(GetTaskRunner()->BelongsToCurrentThread());
120 AudioDeviceNames device_names;
121 GetAudioOutputDeviceNames(&device_names);
122
123 for (const media::AudioDeviceName& name : device_names) {
124 device_descriptions->emplace_back(name.device_name, name.unique_id,
125 GetGroupIDOutput(name.unique_id));
126 }
127 }
128
105 AudioOutputStream* AudioManagerBase::MakeAudioOutputStream( 129 AudioOutputStream* AudioManagerBase::MakeAudioOutputStream(
106 const AudioParameters& params, 130 const AudioParameters& params,
107 const std::string& device_id, 131 const std::string& device_id,
108 const LogCallback& log_callback) { 132 const LogCallback& log_callback) {
109 CHECK(GetTaskRunner()->BelongsToCurrentThread()); 133 CHECK(GetTaskRunner()->BelongsToCurrentThread());
110 134
111 if (!params.IsValid()) { 135 if (!params.IsValid()) {
112 DLOG(ERROR) << "Audio parameters are invalid"; 136 DLOG(ERROR) << "Audio parameters are invalid";
113 return NULL; 137 return NULL;
114 } 138 }
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 // giving the input the same group id as an output. 412 // giving the input the same group id as an output.
389 return input_device_id + "input"; 413 return input_device_id + "input";
390 } 414 }
391 return GetGroupIDOutput(output_device_id); 415 return GetGroupIDOutput(output_device_id);
392 } 416 }
393 417
394 std::string AudioManagerBase::GetDefaultOutputDeviceID() { 418 std::string AudioManagerBase::GetDefaultOutputDeviceID() {
395 return ""; 419 return "";
396 } 420 }
397 421
422 // static
398 int AudioManagerBase::GetUserBufferSize() { 423 int AudioManagerBase::GetUserBufferSize() {
399 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 424 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
400 int buffer_size = 0; 425 int buffer_size = 0;
401 std::string buffer_size_str(cmd_line->GetSwitchValueASCII( 426 std::string buffer_size_str(cmd_line->GetSwitchValueASCII(
402 switches::kAudioBufferSize)); 427 switches::kAudioBufferSize));
403 if (base::StringToInt(buffer_size_str, &buffer_size) && buffer_size > 0) 428 if (base::StringToInt(buffer_size_str, &buffer_size) && buffer_size > 0)
404 return buffer_size; 429 return buffer_size;
405 430
406 return 0; 431 return 0;
407 } 432 }
408 433
409 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( 434 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog(
410 AudioLogFactory::AudioComponent component) { 435 AudioLogFactory::AudioComponent component) {
411 return audio_log_factory_->CreateAudioLog(component); 436 return audio_log_factory_->CreateAudioLog(component);
412 } 437 }
413 438
414 } // namespace media 439 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_manager_base.h ('k') | media/audio/audio_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698