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

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

Issue 2326623003: Make SystemMonitor report all audio device changes instead of just audio capture. (Closed)
Patch Set: 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
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 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 1275
1276 if (!active_node_id || hotplug_nodes.empty() || hotplug_nodes.size() > 1) { 1276 if (!active_node_id || hotplug_nodes.empty() || hotplug_nodes.size() > 1) {
1277 HandleNonHotplugNodesChange(is_input, hotplug_nodes, has_device_change, 1277 HandleNonHotplugNodesChange(is_input, hotplug_nodes, has_device_change,
1278 has_device_removed, active_device_removed); 1278 has_device_removed, active_device_removed);
1279 } else { 1279 } else {
1280 // Typical user hotplug case. 1280 // Typical user hotplug case.
1281 HandleHotPlugDevice(hotplug_nodes.top(), devices_pq); 1281 HandleHotPlugDevice(hotplug_nodes.top(), devices_pq);
1282 } 1282 }
1283 1283
1284 // content::MediaStreamManager listens to 1284 // content::MediaStreamManager listens to
1285 // base::SystemMonitor::DevicesChangedObserver for audio capture devices, 1285 // base::SystemMonitor::DevicesChangedObserver for audio devices,
1286 // and updates EnumerateDevices when OnDevicesChanged is called. 1286 // and updates EnumerateDevices when OnDevicesChanged is called.
1287 if (is_input) { 1287 base::SystemMonitor* monitor = base::SystemMonitor::Get();
1288 base::SystemMonitor* monitor = base::SystemMonitor::Get(); 1288 // In some unittest, |monitor| might be nullptr.
1289 // In some unittest, |monitor| might be nullptr. 1289 if (!monitor)
1290 if (!monitor) 1290 return;
1291 return; 1291 monitor->ProcessDevicesChanged(
1292 monitor->ProcessDevicesChanged( 1292 base::SystemMonitor::DeviceType::DEVTYPE_AUDIO);
1293 base::SystemMonitor::DeviceType::DEVTYPE_AUDIO_CAPTURE);
1294 }
1295 } 1293 }
1296 1294
1297 void CrasAudioHandler::HandleGetNodes(const chromeos::AudioNodeList& node_list, 1295 void CrasAudioHandler::HandleGetNodes(const chromeos::AudioNodeList& node_list,
1298 bool success) { 1296 bool success) {
1299 if (!success) { 1297 if (!success) {
1300 LOG_IF(ERROR, log_errors_) << "Failed to retrieve audio nodes data"; 1298 LOG_IF(ERROR, log_errors_) << "Failed to retrieve audio nodes data";
1301 return; 1299 return;
1302 } 1300 }
1303 1301
1304 UpdateDevicesAndSwitchActive(node_list); 1302 UpdateDevicesAndSwitchActive(node_list);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 hdmi_rediscover_grace_period_duration_in_ms_), 1394 hdmi_rediscover_grace_period_duration_in_ms_),
1397 this, &CrasAudioHandler::UpdateAudioAfterHDMIRediscoverGracePeriod); 1395 this, &CrasAudioHandler::UpdateAudioAfterHDMIRediscoverGracePeriod);
1398 } 1396 }
1399 1397
1400 void CrasAudioHandler::SetHDMIRediscoverGracePeriodForTesting( 1398 void CrasAudioHandler::SetHDMIRediscoverGracePeriodForTesting(
1401 int duration_in_ms) { 1399 int duration_in_ms) {
1402 hdmi_rediscover_grace_period_duration_in_ms_ = duration_in_ms; 1400 hdmi_rediscover_grace_period_duration_in_ms_ = duration_in_ms;
1403 } 1401 }
1404 1402
1405 } // namespace chromeos 1403 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698