Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 AudioDeviceNames device_names; | |
| 108 GetAudioInputDeviceNames(&device_names); | |
|
Guido Urdaneta
2016/12/08 15:53:37
Should this have a CHECK(GetTaskRunner()->BelongTo
o1ka
2016/12/09 14:56:30
Done.
| |
| 109 | |
| 110 for (const media::AudioDeviceName& name : device_names) { | |
| 111 device_descriptions->emplace_back(name.device_name, name.unique_id, | |
| 112 GetGroupIDInput(name.unique_id)); | |
| 113 } | |
| 114 } | |
| 115 void AudioManagerBase::GetAudioOutputDeviceDescriptions( | |
| 116 AudioDeviceDescriptions* device_descriptions) { | |
| 117 AudioDeviceNames device_names; | |
| 118 GetAudioOutputDeviceNames(&device_names); | |
| 119 | |
| 120 for (const media::AudioDeviceName& name : device_names) { | |
| 121 device_descriptions->emplace_back(name.device_name, name.unique_id, | |
| 122 GetGroupIDOutput(name.unique_id)); | |
| 123 } | |
| 124 } | |
| 125 | |
| 105 AudioOutputStream* AudioManagerBase::MakeAudioOutputStream( | 126 AudioOutputStream* AudioManagerBase::MakeAudioOutputStream( |
| 106 const AudioParameters& params, | 127 const AudioParameters& params, |
| 107 const std::string& device_id, | 128 const std::string& device_id, |
| 108 const LogCallback& log_callback) { | 129 const LogCallback& log_callback) { |
| 109 CHECK(GetTaskRunner()->BelongsToCurrentThread()); | 130 CHECK(GetTaskRunner()->BelongsToCurrentThread()); |
| 110 | 131 |
| 111 if (!params.IsValid()) { | 132 if (!params.IsValid()) { |
| 112 DLOG(ERROR) << "Audio parameters are invalid"; | 133 DLOG(ERROR) << "Audio parameters are invalid"; |
| 113 return NULL; | 134 return NULL; |
| 114 } | 135 } |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 // giving the input the same group id as an output. | 409 // giving the input the same group id as an output. |
| 389 return input_device_id + "input"; | 410 return input_device_id + "input"; |
| 390 } | 411 } |
| 391 return GetGroupIDOutput(output_device_id); | 412 return GetGroupIDOutput(output_device_id); |
| 392 } | 413 } |
| 393 | 414 |
| 394 std::string AudioManagerBase::GetDefaultOutputDeviceID() { | 415 std::string AudioManagerBase::GetDefaultOutputDeviceID() { |
| 395 return ""; | 416 return ""; |
| 396 } | 417 } |
| 397 | 418 |
| 419 // static | |
| 398 int AudioManagerBase::GetUserBufferSize() { | 420 int AudioManagerBase::GetUserBufferSize() { |
| 399 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 421 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 400 int buffer_size = 0; | 422 int buffer_size = 0; |
| 401 std::string buffer_size_str(cmd_line->GetSwitchValueASCII( | 423 std::string buffer_size_str(cmd_line->GetSwitchValueASCII( |
| 402 switches::kAudioBufferSize)); | 424 switches::kAudioBufferSize)); |
| 403 if (base::StringToInt(buffer_size_str, &buffer_size) && buffer_size > 0) | 425 if (base::StringToInt(buffer_size_str, &buffer_size) && buffer_size > 0) |
| 404 return buffer_size; | 426 return buffer_size; |
| 405 | 427 |
| 406 return 0; | 428 return 0; |
| 407 } | 429 } |
| 408 | 430 |
| 409 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( | 431 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( |
| 410 AudioLogFactory::AudioComponent component) { | 432 AudioLogFactory::AudioComponent component) { |
| 411 return audio_log_factory_->CreateAudioLog(component); | 433 return audio_log_factory_->CreateAudioLog(component); |
| 412 } | 434 } |
| 413 | 435 |
| 414 } // namespace media | 436 } // namespace media |
| OLD | NEW |