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

Unified Diff: chromeos/dbus/audio_node.cc

Issue 2510093003: Handle audio node stable device ID change (Closed)
Patch Set: fix a typo 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
« no previous file with comments | « chromeos/dbus/audio_node.h ('k') | chromeos/dbus/cras_audio_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/audio_node.cc
diff --git a/chromeos/dbus/audio_node.cc b/chromeos/dbus/audio_node.cc
index b159cf3d42f03f19f007700ea11f346fae633cca..1685a4358f4f61d1ad1c131ea71ee22e1dc30817 100644
--- a/chromeos/dbus/audio_node.cc
+++ b/chromeos/dbus/audio_node.cc
@@ -12,16 +12,13 @@
namespace chromeos {
-AudioNode::AudioNode()
- : is_input(false),
- id(0),
- active(false),
- plugged_time(0) {
-}
+AudioNode::AudioNode() {}
AudioNode::AudioNode(bool is_input,
uint64_t id,
- uint64_t stable_device_id,
+ bool has_v2_stable_device_id,
+ uint64_t stable_device_id_v1,
+ uint64_t stable_device_id_v2,
std::string device_name,
std::string type,
std::string name,
@@ -29,7 +26,9 @@ AudioNode::AudioNode(bool is_input,
uint64_t plugged_time)
: is_input(is_input),
id(id),
- stable_device_id(stable_device_id),
+ has_v2_stable_device_id(has_v2_stable_device_id),
+ stable_device_id_v1(stable_device_id_v1),
+ stable_device_id_v2(stable_device_id_v2),
device_name(device_name),
type(type),
name(name),
@@ -48,8 +47,12 @@ std::string AudioNode::ToString() const {
base::StringAppendF(&result,
"id = 0x%" PRIx64 " ",
id);
- base::StringAppendF(&result, "stable_device_id = 0x%" PRIx64 " ",
- stable_device_id);
+ base::StringAppendF(&result, "stable_device_id_version = %d",
+ StableDeviceIdVersion());
+ base::StringAppendF(&result, "stable_device_id_v1 = 0x%" PRIx64 " ",
+ stable_device_id_v1);
+ base::StringAppendF(&result, "stable_device_id_v2 = 0x%" PRIx64 " ",
+ stable_device_id_v2);
base::StringAppendF(&result, "device_name = %s ", device_name.c_str());
base::StringAppendF(&result,
"type = %s ",
@@ -67,4 +70,12 @@ std::string AudioNode::ToString() const {
return result;
}
+int AudioNode::StableDeviceIdVersion() const {
+ return has_v2_stable_device_id ? 2 : 1;
+}
+
+uint64_t AudioNode::StableDeviceId() const {
+ return has_v2_stable_device_id ? stable_device_id_v2 : stable_device_id_v1;
+}
+
} // namespace chromeos
« no previous file with comments | « chromeos/dbus/audio_node.h ('k') | chromeos/dbus/cras_audio_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698