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

Unified Diff: chromeos/audio/cras_audio_handler.cc

Issue 1952983002: Listen for OutputNodeVolumeChanged signal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « chromeos/audio/cras_audio_handler.h ('k') | chromeos/dbus/cras_audio_client.h » ('j') | 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 d008d8657792756c4f5995417fb8770780c47cf5..1be1bd2b30062f99a7b5f79db15061a6ab3d43ad 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -562,6 +562,25 @@ void CrasAudioHandler::NodesChanged() {
GetNodes();
}
+void CrasAudioHandler::OutputNodeVolumeChanged(uint64_t node_id, int volume) {
+ const AudioDevice* device = this->GetDeviceFromId(node_id);
+ int old_volume;
+
+ if (!device || device->is_input)
+ return;
+
+ // If this callback is triggered by a response to previous set volume command,
+ // do nothing.
+ old_volume =
+ static_cast<int>(audio_pref_handler_->GetOutputVolumeValue(device));
+ if (old_volume == volume)
+ return;
+
+ // Otherwise another app or the hardware itself just changed volume, update
+ // the new volume value.
+ SetOutputNodeVolumePercent(node_id, volume);
jennyz 2016/05/06 18:11:08 This will have a glitch for the multiple active no
hychao 2016/05/12 08:06:27 Done.
+}
+
void CrasAudioHandler::ActiveOutputNodeChanged(uint64_t node_id) {
if (active_output_node_id_ == node_id)
return;
« no previous file with comments | « chromeos/audio/cras_audio_handler.h ('k') | chromeos/dbus/cras_audio_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698