summaryrefslogtreecommitdiffstats
path: root/chromeos/audio
diff options
context:
space:
mode:
authorjennyz <jennyz@chromium.org>2015-03-30 16:37:39 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-30 23:38:24 +0000
commit170e7fbfa745726d13a84aa5d8edc4720f7ca0d4 (patch)
tree69735615f37e0d91b7c9db8887abf064d3eb1ec6 /chromeos/audio
parent5f3a341cd644f5689736951ad1e8588e03cf90b7 (diff)
downloadchromium_src-170e7fbfa745726d13a84aa5d8edc4720f7ca0d4.zip
chromium_src-170e7fbfa745726d13a84aa5d8edc4720f7ca0d4.tar.gz
chromium_src-170e7fbfa745726d13a84aa5d8edc4720f7ca0d4.tar.bz2
Add a new audio extension event OnMuteChanged.
This is the part of audio extension redesign efforts. The original audio extension only has one OnDeviceChanged event without any input arguments to notify all sorts of audio events, which is not efficient. The hotrod app has to query getInfo to get all sets of the devices with properties, comparing the old data to decide what change really happens and handles the change. Therefore, in the new design, we will add new events to accurately report what exact audio change occurs. Eventually, we will migrate to use the new events and retire the old OnDeviceChanged event. See details in design doc: https://docs.google.com/a/google.com/document/d/1YFFLwX4mcKJyuAsZB13GhDid0MEt0QguKX0AxgvBoko/edit?usp=sharing BUG=429312 TBR=mnissler Review URL: https://codereview.chromium.org/1033603006 Cr-Commit-Position: refs/heads/master@{#322907}
Diffstat (limited to 'chromeos/audio')
-rw-r--r--chromeos/audio/cras_audio_handler.cc10
-rw-r--r--chromeos/audio/cras_audio_handler.h4
-rw-r--r--chromeos/audio/cras_audio_handler_unittest.cc8
3 files changed, 14 insertions, 8 deletions
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
index 5cf17ee..52af951 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -66,10 +66,10 @@ void CrasAudioHandler::AudioObserver::OnInputNodeGainChanged(
int /* gain */) {
}
-void CrasAudioHandler::AudioObserver::OnOutputMuteChanged() {
+void CrasAudioHandler::AudioObserver::OnOutputMuteChanged(bool /* mute_on */) {
}
-void CrasAudioHandler::AudioObserver::OnInputMuteChanged() {
+void CrasAudioHandler::AudioObserver::OnInputMuteChanged(bool /* mute_on */) {
}
void CrasAudioHandler::AudioObserver::OnAudioNodesChanged() {
@@ -367,7 +367,8 @@ void CrasAudioHandler::SetOutputMute(bool mute_on) {
}
}
- FOR_EACH_OBSERVER(AudioObserver, observers_, OnOutputMuteChanged());
+ FOR_EACH_OBSERVER(AudioObserver, observers_,
+ OnOutputMuteChanged(output_mute_on_));
}
void CrasAudioHandler::AdjustOutputVolumeToAudibleLevel() {
@@ -380,7 +381,8 @@ void CrasAudioHandler::AdjustOutputVolumeToAudibleLevel() {
void CrasAudioHandler::SetInputMute(bool mute_on) {
SetInputMuteInternal(mute_on);
- FOR_EACH_OBSERVER(AudioObserver, observers_, OnInputMuteChanged());
+ FOR_EACH_OBSERVER(AudioObserver, observers_,
+ OnInputMuteChanged(input_mute_on_));
}
void CrasAudioHandler::SetActiveOutputNode(uint64_t node_id, bool notify) {
diff --git a/chromeos/audio/cras_audio_handler.h b/chromeos/audio/cras_audio_handler.h
index 081e20d..e16ab84 100644
--- a/chromeos/audio/cras_audio_handler.h
+++ b/chromeos/audio/cras_audio_handler.h
@@ -40,13 +40,13 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer,
virtual void OnOutputNodeVolumeChanged(uint64_t node_id, int volume);
// Called when output mute state changed.
- virtual void OnOutputMuteChanged();
+ virtual void OnOutputMuteChanged(bool mute_on);
// Called when active input node's gain changed.
virtual void OnInputNodeGainChanged(uint64_t node_id, int gain);
// Called when input mute state changed.
- virtual void OnInputMuteChanged();
+ virtual void OnInputMuteChanged(bool mute_on);
// Called when audio nodes changed.
virtual void OnAudioNodesChanged();
diff --git a/chromeos/audio/cras_audio_handler_unittest.cc b/chromeos/audio/cras_audio_handler_unittest.cc
index ac9493c..72eaaf3 100644
--- a/chromeos/audio/cras_audio_handler_unittest.cc
+++ b/chromeos/audio/cras_audio_handler_unittest.cc
@@ -247,9 +247,13 @@ class TestObserver : public chromeos::CrasAudioHandler::AudioObserver {
void OnAudioNodesChanged() override { ++audio_nodes_changed_count_; }
- void OnOutputMuteChanged() override { ++output_mute_changed_count_; }
+ void OnOutputMuteChanged(bool /* mute_on */) override {
+ ++output_mute_changed_count_;
+ }
- void OnInputMuteChanged() override { ++input_mute_changed_count_; }
+ void OnInputMuteChanged(bool /* mute_on */) override {
+ ++input_mute_changed_count_;
+ }
void OnOutputNodeVolumeChanged(uint64 /* node_id */,
int /* volume */) override {