| Index: chromeos/audio/cras_audio_handler.cc
|
| diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
|
| index c3e7c2dafe2ef876611420e4c671a3bb05be331c..5cf17eebf937c0698d30bd8d772927efc0d092ff 100644
|
| --- a/chromeos/audio/cras_audio_handler.cc
|
| +++ b/chromeos/audio/cras_audio_handler.cc
|
| @@ -35,11 +35,12 @@ bool IsSameAudioDevice(const AudioDevice& a, const AudioDevice& b) {
|
| && a.device_name == b.device_name;
|
| }
|
|
|
| -bool IsInNodeList(uint64 node_id, const CrasAudioHandler::NodeIdList& id_list) {
|
| +bool IsInNodeList(uint64_t node_id,
|
| + const CrasAudioHandler::NodeIdList& id_list) {
|
| return std::find(id_list.begin(), id_list.end(), node_id) != id_list.end();
|
| }
|
|
|
| -bool IsNodeInTheList(uint64 node_id, const AudioNodeList& node_list) {
|
| +bool IsNodeInTheList(uint64_t node_id, const AudioNodeList& node_list) {
|
| for (size_t i = 0; i < node_list.size(); ++i) {
|
| if (node_id == node_list[i].id)
|
| return true;
|
| @@ -55,10 +56,14 @@ CrasAudioHandler::AudioObserver::AudioObserver() {
|
| CrasAudioHandler::AudioObserver::~AudioObserver() {
|
| }
|
|
|
| -void CrasAudioHandler::AudioObserver::OnOutputVolumeChanged() {
|
| +void CrasAudioHandler::AudioObserver::OnOutputNodeVolumeChanged(
|
| + uint64_t /* node_id */,
|
| + int /* volume */) {
|
| }
|
|
|
| -void CrasAudioHandler::AudioObserver::OnInputGainChanged() {
|
| +void CrasAudioHandler::AudioObserver::OnInputNodeGainChanged(
|
| + uint64_t /* node_id */,
|
| + int /* gain */) {
|
| }
|
|
|
| void CrasAudioHandler::AudioObserver::OnOutputMuteChanged() {
|
| @@ -124,7 +129,7 @@ bool CrasAudioHandler::IsOutputMuted() {
|
| return output_mute_on_;
|
| }
|
|
|
| -bool CrasAudioHandler::IsOutputMutedForDevice(uint64 device_id) {
|
| +bool CrasAudioHandler::IsOutputMutedForDevice(uint64_t device_id) {
|
| const AudioDevice* device = GetDeviceFromId(device_id);
|
| if (!device)
|
| return false;
|
| @@ -140,7 +145,7 @@ bool CrasAudioHandler::IsInputMuted() {
|
| return input_mute_on_;
|
| }
|
|
|
| -bool CrasAudioHandler::IsInputMutedForDevice(uint64 device_id) {
|
| +bool CrasAudioHandler::IsInputMutedForDevice(uint64_t device_id) {
|
| const AudioDevice* device = GetDeviceFromId(device_id);
|
| if (!device)
|
| return false;
|
| @@ -160,7 +165,7 @@ int CrasAudioHandler::GetOutputVolumePercent() {
|
| return output_volume_;
|
| }
|
|
|
| -int CrasAudioHandler::GetOutputVolumePercentForDevice(uint64 device_id) {
|
| +int CrasAudioHandler::GetOutputVolumePercentForDevice(uint64_t device_id) {
|
| if (device_id == active_output_node_id_) {
|
| return output_volume_;
|
| } else {
|
| @@ -173,7 +178,7 @@ int CrasAudioHandler::GetInputGainPercent() {
|
| return input_gain_;
|
| }
|
|
|
| -int CrasAudioHandler::GetInputGainPercentForDevice(uint64 device_id) {
|
| +int CrasAudioHandler::GetInputGainPercentForDevice(uint64_t device_id) {
|
| if (device_id == active_input_node_id_) {
|
| return input_gain_;
|
| } else {
|
| @@ -182,11 +187,11 @@ int CrasAudioHandler::GetInputGainPercentForDevice(uint64 device_id) {
|
| }
|
| }
|
|
|
| -uint64 CrasAudioHandler::GetPrimaryActiveOutputNode() const {
|
| +uint64_t CrasAudioHandler::GetPrimaryActiveOutputNode() const {
|
| return active_output_node_id_;
|
| }
|
|
|
| -uint64 CrasAudioHandler::GetPrimaryActiveInputNode() const {
|
| +uint64_t CrasAudioHandler::GetPrimaryActiveInputNode() const {
|
| return active_input_node_id_;
|
| }
|
|
|
| @@ -218,7 +223,7 @@ void CrasAudioHandler::SetKeyboardMicActive(bool active) {
|
| RemoveActiveNodeInternal(keyboard_mic->id, true);
|
| }
|
|
|
| -void CrasAudioHandler::AddActiveNode(uint64 node_id, bool notify) {
|
| +void CrasAudioHandler::AddActiveNode(uint64_t node_id, bool notify) {
|
| const AudioDevice* device = GetDeviceFromId(node_id);
|
| if (!device) {
|
| VLOG(1) << "AddActiveInputNode: Cannot find device id="
|
| @@ -378,21 +383,21 @@ void CrasAudioHandler::SetInputMute(bool mute_on) {
|
| FOR_EACH_OBSERVER(AudioObserver, observers_, OnInputMuteChanged());
|
| }
|
|
|
| -void CrasAudioHandler::SetActiveOutputNode(uint64 node_id, bool notify) {
|
| +void CrasAudioHandler::SetActiveOutputNode(uint64_t node_id, bool notify) {
|
| chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->
|
| SetActiveOutputNode(node_id);
|
| if (notify)
|
| NotifyActiveNodeChanged(false);
|
| }
|
|
|
| -void CrasAudioHandler::SetActiveInputNode(uint64 node_id, bool notify) {
|
| +void CrasAudioHandler::SetActiveInputNode(uint64_t node_id, bool notify) {
|
| chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->
|
| SetActiveInputNode(node_id);
|
| if (notify)
|
| NotifyActiveNodeChanged(true);
|
| }
|
|
|
| -void CrasAudioHandler::SetVolumeGainPercentForDevice(uint64 device_id,
|
| +void CrasAudioHandler::SetVolumeGainPercentForDevice(uint64_t device_id,
|
| int value) {
|
| const AudioDevice* device = GetDeviceFromId(device_id);
|
| if (!device)
|
| @@ -404,7 +409,7 @@ void CrasAudioHandler::SetVolumeGainPercentForDevice(uint64 device_id,
|
| SetOutputNodeVolumePercent(device_id, value);
|
| }
|
|
|
| -void CrasAudioHandler::SetMuteForDevice(uint64 device_id, bool mute_on) {
|
| +void CrasAudioHandler::SetMuteForDevice(uint64_t device_id, bool mute_on) {
|
| if (device_id == active_output_node_id_) {
|
| SetOutputMute(mute_on);
|
| return;
|
| @@ -482,7 +487,7 @@ void CrasAudioHandler::NodesChanged() {
|
| GetNodes();
|
| }
|
|
|
| -void CrasAudioHandler::ActiveOutputNodeChanged(uint64 node_id) {
|
| +void CrasAudioHandler::ActiveOutputNodeChanged(uint64_t node_id) {
|
| if (active_output_node_id_ == node_id)
|
| return;
|
|
|
| @@ -496,7 +501,7 @@ void CrasAudioHandler::ActiveOutputNodeChanged(uint64 node_id) {
|
| }
|
| }
|
|
|
| -void CrasAudioHandler::ActiveInputNodeChanged(uint64 node_id) {
|
| +void CrasAudioHandler::ActiveInputNodeChanged(uint64_t node_id) {
|
| if (active_input_node_id_ == node_id)
|
| return;
|
|
|
| @@ -520,7 +525,7 @@ void CrasAudioHandler::EmitLoginPromptVisibleCalled() {
|
| LogErrors();
|
| }
|
|
|
| -const AudioDevice* CrasAudioHandler::GetDeviceFromId(uint64 device_id) const {
|
| +const AudioDevice* CrasAudioHandler::GetDeviceFromId(uint64_t device_id) const {
|
| AudioDeviceMap::const_iterator it = audio_devices_.find(device_id);
|
| if (it == audio_devices_.end())
|
| return NULL;
|
| @@ -571,7 +576,7 @@ void CrasAudioHandler::SetupAudioOutputState() {
|
| }
|
|
|
| // This sets up the state of an additional active node.
|
| -void CrasAudioHandler::SetupAdditionalActiveAudioNodeState(uint64 node_id) {
|
| +void CrasAudioHandler::SetupAdditionalActiveAudioNodeState(uint64_t node_id) {
|
| const AudioDevice* device = GetDeviceFromId(node_id);
|
| if (!device) {
|
| VLOG(1) << "Can't set up audio state for unknown device id ="
|
| @@ -615,12 +620,12 @@ void CrasAudioHandler::ApplyAudioPolicy() {
|
| // media system.
|
| }
|
|
|
| -void CrasAudioHandler::SetOutputNodeVolume(uint64 node_id, int volume) {
|
| +void CrasAudioHandler::SetOutputNodeVolume(uint64_t node_id, int volume) {
|
| chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->
|
| SetOutputNodeVolume(node_id, volume);
|
| }
|
|
|
| -void CrasAudioHandler::SetOutputNodeVolumePercent(uint64 node_id,
|
| +void CrasAudioHandler::SetOutputNodeVolumePercent(uint64_t node_id,
|
| int volume_percent) {
|
| const AudioDevice* device = this->GetDeviceFromId(node_id);
|
| if (!device || device->is_input)
|
| @@ -636,7 +641,8 @@ void CrasAudioHandler::SetOutputNodeVolumePercent(uint64 node_id,
|
|
|
| if (device->active) {
|
| SetOutputNodeVolume(node_id, volume_percent);
|
| - FOR_EACH_OBSERVER(AudioObserver, observers_, OnOutputVolumeChanged());
|
| + FOR_EACH_OBSERVER(AudioObserver, observers_,
|
| + OnOutputNodeVolumeChanged(node_id, volume_percent));
|
| }
|
| }
|
|
|
| @@ -650,12 +656,12 @@ bool CrasAudioHandler::SetOutputMuteInternal(bool mute_on) {
|
| return true;
|
| }
|
|
|
| -void CrasAudioHandler::SetInputNodeGain(uint64 node_id, int gain) {
|
| +void CrasAudioHandler::SetInputNodeGain(uint64_t node_id, int gain) {
|
| chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->
|
| SetInputNodeGain(node_id, gain);
|
| }
|
|
|
| -void CrasAudioHandler::SetInputNodeGainPercent(uint64 node_id,
|
| +void CrasAudioHandler::SetInputNodeGainPercent(uint64_t node_id,
|
| int gain_percent) {
|
| const AudioDevice* device = GetDeviceFromId(node_id);
|
| if (!device || !device->is_input)
|
| @@ -670,7 +676,8 @@ void CrasAudioHandler::SetInputNodeGainPercent(uint64 node_id,
|
|
|
| if (device->active) {
|
| SetInputNodeGain(node_id, gain_percent);
|
| - FOR_EACH_OBSERVER(AudioObserver, observers_, OnInputGainChanged());
|
| + FOR_EACH_OBSERVER(AudioObserver, observers_,
|
| + OnInputNodeGainChanged(node_id, gain_percent));
|
| }
|
| }
|
|
|
| @@ -689,7 +696,7 @@ void CrasAudioHandler::GetNodes() {
|
| }
|
|
|
| bool CrasAudioHandler::ChangeActiveDevice(const AudioDevice& new_active_device,
|
| - uint64* current_active_node_id) {
|
| + uint64_t* current_active_node_id) {
|
| // If the device we want to switch to is already the current active device,
|
| // do nothing.
|
| if (new_active_device.active &&
|
| @@ -713,10 +720,9 @@ bool CrasAudioHandler::ChangeActiveDevice(const AudioDevice& new_active_device,
|
| return true;
|
| }
|
|
|
| -bool CrasAudioHandler::NonActiveDeviceUnplugged(
|
| - size_t old_devices_size,
|
| - size_t new_devices_size,
|
| - uint64 current_active_node) {
|
| +bool CrasAudioHandler::NonActiveDeviceUnplugged(size_t old_devices_size,
|
| + size_t new_devices_size,
|
| + uint64_t current_active_node) {
|
| return (new_devices_size < old_devices_size &&
|
| GetDeviceFromId(current_active_node));
|
| }
|
| @@ -909,7 +915,7 @@ void CrasAudioHandler::HandleGetNodesError(const std::string& error_name,
|
| << error_name << ": " << error_msg;
|
| }
|
|
|
| -void CrasAudioHandler::AddAdditionalActiveNode(uint64 node_id, bool notify) {
|
| +void CrasAudioHandler::AddAdditionalActiveNode(uint64_t node_id, bool notify) {
|
| const AudioDevice* device = GetDeviceFromId(node_id);
|
| if (!device) {
|
| VLOG(1) << "AddActiveInputNode: Cannot find device id="
|
| @@ -937,7 +943,7 @@ void CrasAudioHandler::AddAdditionalActiveNode(uint64 node_id, bool notify) {
|
| }
|
| }
|
|
|
| -void CrasAudioHandler::RemoveActiveNodeInternal(uint64 node_id, bool notify) {
|
| +void CrasAudioHandler::RemoveActiveNodeInternal(uint64_t node_id, bool notify) {
|
| const AudioDevice* device = GetDeviceFromId(node_id);
|
| if (!device) {
|
| VLOG(1) << "RemoveActiveInputNode: Cannot find device id="
|
|
|