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

Unified Diff: chrome/browser/extensions/api/audio/audio_service_chromeos.cc

Issue 460113003: Add ability to active multiple devices via the audio API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « chrome/browser/extensions/api/audio/OWNERS ('k') | chromeos/dbus/OWNERS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/audio/audio_service_chromeos.cc
diff --git a/chrome/browser/extensions/api/audio/audio_service_chromeos.cc b/chrome/browser/extensions/api/audio/audio_service_chromeos.cc
index 91a0cd8880425ad149e50d1e4af9b8d7ae3ca256..51039118f5e2fbd0ee93d2e2fe97ce3ac0920e1c 100644
--- a/chrome/browser/extensions/api/audio/audio_service_chromeos.cc
+++ b/chrome/browser/extensions/api/audio/audio_service_chromeos.cc
@@ -9,6 +9,8 @@
#include "base/strings/string_number_conversions.h"
#include "chromeos/audio/audio_device.h"
#include "chromeos/audio/cras_audio_handler.h"
+#include "chromeos/dbus/cras_audio_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
@@ -138,6 +140,7 @@ void AudioServiceImpl::SetActiveDevices(const DeviceIdList& device_list) {
bool input_device_set = false;
bool output_device_set = false;
+ std::string active_input_node_ids, active_output_node_ids;
for (size_t i = 0; i < device_list.size(); ++i) {
chromeos::AudioDevice device;
bool found = FindDevice(GetIdFromStr(device_list[i]), &device);
@@ -145,12 +148,29 @@ void AudioServiceImpl::SetActiveDevices(const DeviceIdList& device_list) {
if (device.is_input && !input_device_set) {
cras_audio_handler_->SwitchToDevice(device);
input_device_set = true;
+ active_input_node_ids.push_back(device.id);
jennyz 2014/08/12 18:37:54 Yes, hychao's comment later is right, this line sh
} else if (!device.is_input && !output_device_set) {
cras_audio_handler_->SwitchToDevice(device);
output_device_set = true;
+ active_output_node_ids.push_back(device.id);
hychao 2014/08/12 10:47:40 The push_back calls should be pulled out from if/e
}
}
}
+
+ // Once we have set our devices to active and all the inactive ones have been
+ // set correctly to inactive, go through our active devices again and set
hychao 2014/08/12 10:47:40 I don't see where we deactivate the old active inp
+ // them to active using the AddActiveNode API. This is an ugly hack till
+ // http://crbug.com/402072 is fixed.
+ for (size_t i = 0; i < active_input_node_ids.size(); ++i) {
+ chromeos::DBusThreadManager::Get()
+ ->GetCrasAudioClient()
+ ->AddActiveInputNode(active_input_node_ids[i]);
+ }
+ for (size_t i = 0; i < active_output_node_ids.size(); ++i) {
+ chromeos::DBusThreadManager::Get()
+ ->GetCrasAudioClient()
+ ->AddActiveOutputNode(active_output_node_ids[i]);
+ }
}
bool AudioServiceImpl::SetDeviceProperties(const std::string& device_id,
« no previous file with comments | « chrome/browser/extensions/api/audio/OWNERS ('k') | chromeos/dbus/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698