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

Side by Side Diff: extensions/shell/browser/shell_audio_controller_chromeos.cc

Issue 596603002: Supports multiple active input/output audio nodes in CrasAudioHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused function. Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/shell/browser/shell_audio_controller_chromeos.h" 5 #include "extensions/shell/browser/shell_audio_controller_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chromeos/audio/audio_device.h" 9 #include "chromeos/audio/audio_device.h"
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 uint64 best_input = 0, best_output = 0; 109 uint64 best_input = 0, best_output = 0;
110 for (chromeos::AudioDeviceList::const_reverse_iterator it = devices.rbegin(); 110 for (chromeos::AudioDeviceList::const_reverse_iterator it = devices.rbegin();
111 it != devices.rend() && (!best_input || !best_output); ++it) { 111 it != devices.rend() && (!best_input || !best_output); ++it) {
112 // TODO(derat): Need to check |plugged_time|? 112 // TODO(derat): Need to check |plugged_time|?
113 if (it->is_input && !best_input) 113 if (it->is_input && !best_input)
114 best_input = it->id; 114 best_input = it->id;
115 else if (!it->is_input && !best_output) 115 else if (!it->is_input && !best_output)
116 best_output = it->id; 116 best_output = it->id;
117 } 117 }
118 118
119 if (best_input && best_input != handler->GetActiveInputNode()) { 119 if (best_input && best_input != handler->GetPrimaryActiveInputNode()) {
120 const chromeos::AudioDevice* device = GetDevice(devices, best_input); 120 const chromeos::AudioDevice* device = GetDevice(devices, best_input);
121 DCHECK(device); 121 DCHECK(device);
122 VLOG(1) << "Activating input device: " << device->ToString(); 122 VLOG(1) << "Activating input device: " << device->ToString();
123 handler->SwitchToDevice(*device); 123 handler->SwitchToDevice(*device);
124 } 124 }
125 if (best_output && best_output != handler->GetActiveOutputNode()) { 125 if (best_output && best_output != handler->GetPrimaryActiveOutputNode()) {
126 const chromeos::AudioDevice* device = GetDevice(devices, best_output); 126 const chromeos::AudioDevice* device = GetDevice(devices, best_output);
127 DCHECK(device); 127 DCHECK(device);
128 VLOG(1) << "Activating output device: " << device->ToString(); 128 VLOG(1) << "Activating output device: " << device->ToString();
129 handler->SwitchToDevice(*device); 129 handler->SwitchToDevice(*device);
130 } 130 }
131 } 131 }
132 132
133 } // namespace extensions 133 } // namespace extensions
OLDNEW
« no previous file with comments | « chromeos/audio/cras_audio_handler_unittest.cc ('k') | extensions/shell/browser/shell_audio_controller_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698