Add missing method definition for StatsReport::Value::id_val()
Also add a preprocessor definition to avoid redefinition in downstream projects.
Bug: webrtc:15241
Change-Id: Ic55d98c3d3a69b9b19195ee78f03af6e38fdd0e2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/308601
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Commit-Queue: Sameer Vijaykar <samvi@google.com>
Cr-Commit-Position: refs/heads/main@{#40289}
diff --git a/api/legacy_stats_types.cc b/api/legacy_stats_types.cc
index 278ac81..01eee2c 100644
--- a/api/legacy_stats_types.cc
+++ b/api/legacy_stats_types.cc
@@ -362,6 +362,11 @@
return value_.bool_;
}
+const StatsReport::Id& StatsReport::Value::id_val() const {
+ RTC_DCHECK_EQ(type_, kId);
+ return *value_.id_;
+}
+
const char* StatsReport::Value::display_name() const {
switch (name) {
case kStatsValueNameAecDivergentFilterFraction:
diff --git a/api/legacy_stats_types.h b/api/legacy_stats_types.h
index e49cb6d..5cd3801 100644
--- a/api/legacy_stats_types.h
+++ b/api/legacy_stats_types.h
@@ -333,6 +333,12 @@
bool bool_val() const;
const Id& id_val() const;
+// TODO(bugs.webrtc.org/15241): remove this definition once downstream
+// definitions of StatsReport::Value::id_val() have been deleted.
+#ifndef WEBRTC_DEFINES_STATSREPORT_VALUE_ID_VAL
+#define WEBRTC_DEFINES_STATSREPORT_VALUE_ID_VAL
+#endif // WEBRTC_DEFINES_STATSREPORT_VALUE_ID_VAL
+
// Returns the string representation of `name`.
const char* display_name() const;