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

Side by Side Diff: chromeos/audio/cras_audio_handler.cc

Issue 2812223005: Display current output device icon in the floating volume row when switching output devices (Closed)
Patch Set: Address nits. Created 3 years, 8 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 | « ash/system/brightness/tray_brightness.cc ('k') | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chromeos/audio/cras_audio_handler.h" 5 #include "chromeos/audio/cras_audio_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 while (!input_devices_pq_.empty()) 1310 while (!input_devices_pq_.empty())
1311 input_devices_pq_.pop(); 1311 input_devices_pq_.pop();
1312 while (!output_devices_pq_.empty()) 1312 while (!output_devices_pq_.empty())
1313 output_devices_pq_.pop(); 1313 output_devices_pq_.pop();
1314 1314
1315 size_t new_output_device_size = 0; 1315 size_t new_output_device_size = 0;
1316 size_t new_input_device_size = 0; 1316 size_t new_input_device_size = 0;
1317 for (size_t i = 0; i < nodes.size(); ++i) { 1317 for (size_t i = 0; i < nodes.size(); ++i) {
1318 AudioDevice device(nodes[i]); 1318 AudioDevice device(nodes[i]);
1319 audio_devices_[device.id] = device; 1319 audio_devices_[device.id] = device;
1320 if (!has_alternative_input_ && 1320 if (!has_alternative_input_ && device.is_input &&
1321 device.is_input &&
1322 device.type != AUDIO_TYPE_INTERNAL_MIC && 1321 device.type != AUDIO_TYPE_INTERNAL_MIC &&
1323 device.type != AUDIO_TYPE_KEYBOARD_MIC) { 1322 device.type != AUDIO_TYPE_KEYBOARD_MIC &&
1323 device.type != AUDIO_TYPE_HOTWORD &&
1324 device.type != AUDIO_TYPE_POST_MIX_LOOPBACK &&
1325 device.type != AUDIO_TYPE_POST_DSP_LOOPBACK) {
1324 has_alternative_input_ = true; 1326 has_alternative_input_ = true;
1325 } else if (!has_alternative_output_ && 1327 } else if (!has_alternative_output_ &&
1326 !device.is_input && 1328 !device.is_input &&
1327 device.type != AUDIO_TYPE_INTERNAL_SPEAKER) { 1329 device.type != AUDIO_TYPE_INTERNAL_SPEAKER) {
1328 has_alternative_output_ = true; 1330 has_alternative_output_ = true;
1329 } 1331 }
1330 1332
1331 if (device.is_input) { 1333 if (device.is_input) {
1332 input_devices_pq_.push(device); 1334 input_devices_pq_.push(device);
1333 ++new_input_device_size; 1335 ++new_input_device_size;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 bool CrasAudioHandler::HasExternalDevice(bool is_input) const { 1588 bool CrasAudioHandler::HasExternalDevice(bool is_input) const {
1587 for (const auto& item : audio_devices_) { 1589 for (const auto& item : audio_devices_) {
1588 const AudioDevice& device = item.second; 1590 const AudioDevice& device = item.second;
1589 if (is_input == device.is_input && device.IsExternalDevice()) 1591 if (is_input == device.is_input && device.IsExternalDevice())
1590 return true; 1592 return true;
1591 } 1593 }
1592 return false; 1594 return false;
1593 } 1595 }
1594 1596
1595 } // namespace chromeos 1597 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/system/brightness/tray_brightness.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698