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

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: Fix unimplemented method 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 75a391d576dc3e3b9115c6e0364b61915c073516..a6586bd742e074315df0dd69a113135595021f27 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -592,6 +592,28 @@ void CrasAudioHandler::NodesChanged() {
GetNodes();
}
+void CrasAudioHandler::OutputNodeVolumeChanged(uint64_t node_id, int volume) {
+ const AudioDevice* device = this->GetDeviceFromId(node_id);
+ int old_volume;
+
+ // If this is not an active output node, ignore this event. Because when this
+ // node set to active, it will be applied with the volume value stored in
+ // preference.
+ if (!device || !device->active || 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 to all active output nodes.
+ SetOutputVolumePercent(volume);
+}
+
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