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: extensions/browser/api/audio/audio_service_chromeos.cc

Issue 2585413002: Update audio api to use v2 stable device ID (Closed)
Patch Set: Created 4 years 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
Index: extensions/browser/api/audio/audio_service_chromeos.cc
diff --git a/extensions/browser/api/audio/audio_service_chromeos.cc b/extensions/browser/api/audio/audio_service_chromeos.cc
index 181900aab57dd8c48f4f3a61802b3be7fd1239aa..8366f7b9c29ab746aaf005a43352e35f769b53b8 100644
--- a/extensions/browser/api/audio/audio_service_chromeos.cc
+++ b/extensions/browser/api/audio/audio_service_chromeos.cc
@@ -23,10 +23,7 @@ using api::audio::OutputDeviceInfo;
using api::audio::InputDeviceInfo;
using api::audio::AudioDeviceInfo;
-uint64_t GetStableDeviceId(const chromeos::AudioDevice& device) {
- // TODO(tbarzic): Update audio API to expose new stable device ID version.
- // For now, for the sake of backward compatibility, use deprecated version.
- // http://crbug.com/673392
+uint64_t GetV1StableDeviceId(const chromeos::AudioDevice& device) {
if (device.stable_device_id_version == 1)
return device.stable_device_id;
if (device.stable_device_id_version == 2)
@@ -280,8 +277,11 @@ void AudioServiceImpl::NotifyDevicesChanged() {
? cras_audio_handler_->GetOutputVolumePercentForDevice(
devices[i].id)
: cras_audio_handler_->GetInputGainPercentForDevice(devices[i].id);
+ info.stable_id = devices[i].stable_device_id_version == 2
+ ? base::Uint64ToString(devices[i].stable_device_id)
+ : "";
info.stable_device_id.reset(
- new std::string(base::Uint64ToString(GetStableDeviceId(devices[i]))));
+ new std::string(base::Uint64ToString(GetV1StableDeviceId(devices[i]))));
devices_info_list.push_back(std::move(info));
}

Powered by Google App Engine
This is Rietveld 408576698