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

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

Issue 2273653002: Add groupid for media devices. Group audio devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Various small fixes. Created 4 years, 3 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/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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
348 std::string AudioManagerBase::GetDefaultOutputDeviceID() { 370 std::string AudioManagerBase::GetDefaultOutputDeviceID() {
349 return ""; 371 return "";
350 } 372 }
351 373
352 int AudioManagerBase::GetUserBufferSize() { 374 int AudioManagerBase::GetUserBufferSize() {
353 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 375 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
354 int buffer_size = 0; 376 int buffer_size = 0;
355 std::string buffer_size_str(cmd_line->GetSwitchValueASCII( 377 std::string buffer_size_str(cmd_line->GetSwitchValueASCII(
356 switches::kAudioBufferSize)); 378 switches::kAudioBufferSize));
357 if (base::StringToInt(buffer_size_str, &buffer_size) && buffer_size > 0) 379 if (base::StringToInt(buffer_size_str, &buffer_size) && buffer_size > 0)
358 return buffer_size; 380 return buffer_size;
359 381
360 return 0; 382 return 0;
361 } 383 }
362 384
363 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( 385 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog(
364 AudioLogFactory::AudioComponent component) { 386 AudioLogFactory::AudioComponent component) {
365 return audio_log_factory_->CreateAudioLog(component); 387 return audio_log_factory_->CreateAudioLog(component);
366 } 388 }
367 389
368 } // namespace media 390 } // 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