| Index: chromeos/audio/cras_audio_handler.cc
|
| diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
|
| index fc0a2eb844ce9544474b0af81e63ca2d906ca5c1..6edab8dc59941c16bbcff319e776e15ec57077c5 100644
|
| --- a/chromeos/audio/cras_audio_handler.cc
|
| +++ b/chromeos/audio/cras_audio_handler.cc
|
| @@ -10,7 +10,7 @@
|
| #include "base/bind.h"
|
| #include "base/bind_helpers.h"
|
| #include "base/logging.h"
|
| -#include "chromeos/audio/audio_pref_handler.h"
|
| +#include "chromeos/audio/audio_devices_pref_handler.h"
|
| #include "chromeos/audio/mock_cras_audio_handler.h"
|
| #include "chromeos/dbus/dbus_thread_manager.h"
|
|
|
| @@ -58,7 +58,7 @@ void CrasAudioHandler::AudioObserver::OnActiveInputNodeChanged() {
|
|
|
| // static
|
| void CrasAudioHandler::Initialize(
|
| - scoped_refptr<AudioPrefHandler> audio_pref_handler) {
|
| + scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler) {
|
| CHECK(!g_cras_audio_handler);
|
| g_cras_audio_handler = new CrasAudioHandler(audio_pref_handler);
|
| }
|
| @@ -128,7 +128,6 @@ bool CrasAudioHandler::GetActiveOutputDevice(AudioDevice* device) const {
|
| return true;
|
| }
|
| }
|
| - NOTREACHED() << "Can't find active output audio device";
|
| return false;
|
| }
|
|
|
| @@ -157,7 +156,7 @@ void CrasAudioHandler::AdjustOutputVolumeByPercent(int adjust_by_percent) {
|
|
|
| void CrasAudioHandler::SetOutputMute(bool mute_on) {
|
| if (output_mute_locked_) {
|
| - NOTREACHED() << "Output mute has been locked";
|
| + LOG(WARNING) << "Tried to set volume with output mute locked";
|
| return;
|
| }
|
|
|
| @@ -175,7 +174,7 @@ void CrasAudioHandler::SetOutputMute(bool mute_on) {
|
|
|
| void CrasAudioHandler::SetInputMute(bool mute_on) {
|
| if (input_mute_locked_) {
|
| - NOTREACHED() << "Input mute has been locked";
|
| + LOG(WARNING) << "Tried to set gain with input mute locked";
|
| return;
|
| }
|
|
|
| @@ -194,7 +193,7 @@ void CrasAudioHandler::SetActiveInputNode(uint64 node_id) {
|
| }
|
|
|
| CrasAudioHandler::CrasAudioHandler(
|
| - scoped_refptr<AudioPrefHandler> audio_pref_handler)
|
| + scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler)
|
| : audio_pref_handler_(audio_pref_handler),
|
| weak_ptr_factory_(this),
|
| output_mute_on_(false),
|
| @@ -216,7 +215,7 @@ CrasAudioHandler::CrasAudioHandler(
|
| return;
|
| chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->AddObserver(this);
|
| audio_pref_handler_->AddAudioPrefObserver(this);
|
| - SetupInitialAudioState();
|
| + GetNodes();
|
| }
|
|
|
| CrasAudioHandler::~CrasAudioHandler() {
|
| @@ -232,7 +231,7 @@ CrasAudioHandler::~CrasAudioHandler() {
|
| }
|
|
|
| void CrasAudioHandler::AudioClientRestarted() {
|
| - SetupInitialAudioState();
|
| + GetNodes();
|
| }
|
|
|
| void CrasAudioHandler::OutputVolumeChanged(int volume) {
|
| @@ -271,7 +270,7 @@ void CrasAudioHandler::ActiveOutputNodeChanged(uint64 node_id) {
|
| return;
|
|
|
| active_output_node_id_ = node_id;
|
| - GetNodes();
|
| + SetupAudioState();
|
| FOR_EACH_OBSERVER(AudioObserver, observers_, OnActiveOutputNodeChanged());
|
| }
|
|
|
| @@ -280,7 +279,6 @@ void CrasAudioHandler::ActiveInputNodeChanged(uint64 node_id) {
|
| return;
|
|
|
| active_input_node_id_ = node_id;
|
| - GetNodes();
|
| FOR_EACH_OBSERVER(AudioObserver, observers_, OnActiveInputNodeChanged());
|
| }
|
|
|
| @@ -288,7 +286,7 @@ void CrasAudioHandler::OnAudioPolicyPrefChanged() {
|
| ApplyAudioPolicy();
|
| }
|
|
|
| -void CrasAudioHandler::SetupInitialAudioState() {
|
| +void CrasAudioHandler::SetupAudioState() {
|
| ApplyAudioPolicy();
|
|
|
| // Set the initial audio state to the ones read from audio prefs.
|
| @@ -296,9 +294,6 @@ void CrasAudioHandler::SetupInitialAudioState() {
|
| output_volume_ = audio_pref_handler_->GetOutputVolumeValue();
|
| SetOutputVolumeInternal(output_volume_);
|
| SetOutputMute(output_mute_on_);
|
| -
|
| - // Get the initial audio data.
|
| - GetNodes();
|
| }
|
|
|
| void CrasAudioHandler::ApplyAudioPolicy() {
|
| @@ -359,6 +354,7 @@ void CrasAudioHandler::HandleGetNodes(const chromeos::AudioNodeList& node_list,
|
| }
|
| }
|
|
|
| + SetupAudioState();
|
| FOR_EACH_OBSERVER(AudioObserver, observers_, OnAudioNodesChanged());
|
| }
|
|
|
|
|