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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 const std::string& device_id) { | 338 const std::string& device_id) { |
339 NOTREACHED(); | 339 NOTREACHED(); |
340 return AudioParameters(); | 340 return AudioParameters(); |
341 } | 341 } |
342 | 342 |
343 std::string AudioManagerBase::GetAssociatedOutputDeviceID( | 343 std::string AudioManagerBase::GetAssociatedOutputDeviceID( |
344 const std::string& input_device_id) { | 344 const std::string& input_device_id) { |
345 return ""; | 345 return ""; |
346 } | 346 } |
347 | 347 |
348 std::string AudioManagerBase::GetGroupIDOutput( | |
349 const std::string& output_device_id) { | |
350 if (output_device_id == AudioDeviceDescription::kDefaultDeviceId) { | |
351 std::string real_device_id = GetDefaultOutputDeviceID(); | |
352 if (!real_device_id.empty()) { | |
353 return real_device_id; | |
354 } | |
355 } | |
356 return output_device_id; | |
357 } | |
358 | |
359 std::string AudioManagerBase::GetGroupIDInput( | |
360 const std::string& input_device_id) { | |
361 std::string output_device_id = GetAssociatedOutputDeviceID(input_device_id); | |
362 if (output_device_id.empty()) { | |
363 // Some characters are added to avoid accidentally | |
364 // giving the input the same group id as an output. | |
365 return input_device_id + "input"; | |
366 } | |
367 return GetGroupIDOutput(output_device_id); | |
368 } | |
369 | |
370 std::string AudioManagerBase::GetDefaultOutputDeviceID() { | 348 std::string AudioManagerBase::GetDefaultOutputDeviceID() { |
371 return ""; | 349 return ""; |
372 } | 350 } |
373 | 351 |
374 int AudioManagerBase::GetUserBufferSize() { | 352 int AudioManagerBase::GetUserBufferSize() { |
375 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 353 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
376 int buffer_size = 0; | 354 int buffer_size = 0; |
377 std::string buffer_size_str(cmd_line->GetSwitchValueASCII( | 355 std::string buffer_size_str(cmd_line->GetSwitchValueASCII( |
378 switches::kAudioBufferSize)); | 356 switches::kAudioBufferSize)); |
379 if (base::StringToInt(buffer_size_str, &buffer_size) && buffer_size > 0) | 357 if (base::StringToInt(buffer_size_str, &buffer_size) && buffer_size > 0) |
380 return buffer_size; | 358 return buffer_size; |
381 | 359 |
382 return 0; | 360 return 0; |
383 } | 361 } |
384 | 362 |
385 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( | 363 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( |
386 AudioLogFactory::AudioComponent component) { | 364 AudioLogFactory::AudioComponent component) { |
387 return audio_log_factory_->CreateAudioLog(component); | 365 return audio_log_factory_->CreateAudioLog(component); |
388 } | 366 } |
389 | 367 |
390 } // namespace media | 368 } // namespace media |
OLD | NEW |