Move priority implementation to cc file
follow-up from
https://webrtc-review.googlesource.com/c/src/+/382120
where IWYU failed on that header-only target.
BUG=webrtc:42226242
Change-Id: I8555e62e5324db8f3f0554879f61fdffdc053419
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/386061
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#44515}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 70c3af2..3e4bd77 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -525,12 +525,16 @@
sources = [ "rtp_transceiver_direction.h" ]
}
-rtc_source_set("priority") {
+rtc_library("priority") {
visibility = [ "*" ]
- sources = [ "priority.h" ]
+ sources = [
+ "priority.cc",
+ "priority.h",
+ ]
deps = [
"../rtc_base:checks",
"../rtc_base:strong_alias",
+ "../rtc_base/system:rtc_export",
]
}
diff --git a/api/priority.cc b/api/priority.cc
new file mode 100644
index 0000000..3ae4fd5
--- /dev/null
+++ b/api/priority.cc
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2025 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "api/priority.h"
+
+#include "rtc_base/checks.h"
+
+namespace webrtc {
+
+PriorityValue::PriorityValue(Priority priority) {
+ switch (priority) {
+ case Priority::kVeryLow:
+ value_ = 128;
+ break;
+ case Priority::kLow:
+ value_ = 256;
+ break;
+ case Priority::kMedium:
+ value_ = 512;
+ break;
+ case Priority::kHigh:
+ value_ = 1024;
+ break;
+ default:
+ RTC_CHECK_NOTREACHED();
+ }
+}
+
+} // namespace webrtc
diff --git a/api/priority.h b/api/priority.h
index 2735c2c..bb2f881 100644
--- a/api/priority.h
+++ b/api/priority.h
@@ -13,8 +13,8 @@
#include <stdint.h>
-#include "rtc_base/checks.h"
#include "rtc_base/strong_alias.h"
+#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@@ -26,28 +26,10 @@
kHigh,
};
-class PriorityValue
+class RTC_EXPORT PriorityValue
: public webrtc::StrongAlias<class PriorityValueTag, uint16_t> {
public:
- explicit PriorityValue(Priority priority) {
- switch (priority) {
- case Priority::kVeryLow:
- value_ = 128;
- break;
- case Priority::kLow:
- value_ = 256;
- break;
- case Priority::kMedium:
- value_ = 512;
- break;
- case Priority::kHigh:
- value_ = 1024;
- break;
- default:
- RTC_CHECK_NOTREACHED();
- }
- }
-
+ explicit PriorityValue(Priority priority);
explicit PriorityValue(uint16_t priority) : StrongAlias(priority) {}
};