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

Unified Diff: chromeos/audio/cras_audio_handler.cc

Issue 2155503002: Fix dynamic plugging/unplugging audio devices may not update audio input source (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: check nullptr Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/audio/cras_audio_handler.cc
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
index 64e4271b3d1bb3c714861f07f9ffaf90c4fa383f..5f95db5939208864af4745c25cd51856dc545266 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -14,6 +14,7 @@
#include "base/bind_helpers.h"
#include "base/logging.h"
#include "base/sys_info.h"
+#include "base/system_monitor/system_monitor.h"
#include "chromeos/audio/audio_devices_pref_handler_stub.h"
#include "chromeos/dbus/dbus_thread_manager.h"
@@ -1242,6 +1243,18 @@ void CrasAudioHandler::HandleAudioDeviceChange(
// Typical user hotplug case.
HandleHotPlugDevice(hotplug_nodes.top(), devices_pq);
}
+
+ // content::MediaStreamManager listens to
+ // base::SystemMonitor::DevicesChangedObserver for audio capture devices,
+ // and updates EnumerateDevices when OnDevicesChanged is called.
+ if (is_input) {
+ base::SystemMonitor* monitor = base::SystemMonitor::Get();
+ // In some unittest, |monitor| might be nullptr.
+ if (!monitor)
+ return;
+ monitor->ProcessDevicesChanged(
+ base::SystemMonitor::DeviceType::DEVTYPE_AUDIO_CAPTURE);
+ }
}
void CrasAudioHandler::HandleGetNodes(const chromeos::AudioNodeList& node_list,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698