Move moving_max_counter.h to webrtc namespace
Bug: webrtc:42232595
Change-Id: I35cb08d2e84f50b06c2fa0a4bdaad017831a8f58
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/380882
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#44101}
diff --git a/rtc_base/numerics/moving_max_counter.h b/rtc_base/numerics/moving_max_counter.h
index f35d360..3c46d57 100644
--- a/rtc_base/numerics/moving_max_counter.h
+++ b/rtc_base/numerics/moving_max_counter.h
@@ -20,7 +20,7 @@
#include "rtc_base/checks.h"
-namespace rtc {
+namespace webrtc {
// Implements moving max: can add samples to it and calculate maximum over some
// fixed moving window.
@@ -113,6 +113,12 @@
samples_.erase(samples_.begin(), it);
}
+} // namespace webrtc
+
+// Re-export symbols from the webrtc namespace for backwards compatibility.
+// TODO(bugs.webrtc.org/4222596): Remove once all references are updated.
+namespace rtc {
+using ::webrtc::MovingMaxCounter;
} // namespace rtc
#endif // RTC_BASE_NUMERICS_MOVING_MAX_COUNTER_H_
diff --git a/rtc_base/numerics/moving_max_counter_unittest.cc b/rtc_base/numerics/moving_max_counter_unittest.cc
index 0e3195f..f8f84c1 100644
--- a/rtc_base/numerics/moving_max_counter_unittest.cc
+++ b/rtc_base/numerics/moving_max_counter_unittest.cc
@@ -13,7 +13,7 @@
#include "test/gtest.h"
TEST(MovingMaxCounter, ReportsMaximumInTheWindow) {
- rtc::MovingMaxCounter<int> counter(100);
+ webrtc::MovingMaxCounter<int> counter(100);
counter.Add(1, 1);
EXPECT_EQ(counter.Max(1), 1);
counter.Add(2, 30);
@@ -27,7 +27,7 @@
}
TEST(MovingMaxCounter, IgnoresOldElements) {
- rtc::MovingMaxCounter<int> counter(100);
+ webrtc::MovingMaxCounter<int> counter(100);
counter.Add(1, 1);
counter.Add(2, 30);
counter.Add(100, 60);
@@ -39,14 +39,14 @@
}
TEST(MovingMaxCounter, HandlesEmptyWindow) {
- rtc::MovingMaxCounter<int> counter(100);
+ webrtc::MovingMaxCounter<int> counter(100);
counter.Add(123, 1);
EXPECT_TRUE(counter.Max(101).has_value());
EXPECT_FALSE(counter.Max(102).has_value());
}
TEST(MovingMaxCounter, HandlesSamplesWithEqualTimestamps) {
- rtc::MovingMaxCounter<int> counter(100);
+ webrtc::MovingMaxCounter<int> counter(100);
counter.Add(2, 30);
EXPECT_EQ(counter.Max(30), 2);
counter.Add(5, 30);
diff --git a/video/receive_statistics_proxy.h b/video/receive_statistics_proxy.h
index ff06bfb..0800e84 100644
--- a/video/receive_statistics_proxy.h
+++ b/video/receive_statistics_proxy.h
@@ -176,7 +176,7 @@
SampleCounter oneway_delay_counter_ RTC_GUARDED_BY(main_thread_);
std::unique_ptr<VideoQualityObserver> video_quality_observer_
RTC_GUARDED_BY(main_thread_);
- mutable rtc::MovingMaxCounter<int> interframe_delay_max_moving_
+ mutable MovingMaxCounter<int> interframe_delay_max_moving_
RTC_GUARDED_BY(main_thread_);
std::map<VideoContentType, ContentSpecificStats> content_specific_stats_
RTC_GUARDED_BY(main_thread_);
@@ -196,7 +196,7 @@
int64_t sum_missed_render_deadline_ms_ RTC_GUARDED_BY(main_thread_);
// Mutable because calling Max() on MovingMaxCounter is not const. Yet it is
// called from const GetStats().
- mutable rtc::MovingMaxCounter<TimingFrameInfo> timing_frame_info_counter_
+ mutable MovingMaxCounter<TimingFrameInfo> timing_frame_info_counter_
RTC_GUARDED_BY(main_thread_);
std::optional<int> num_unique_frames_ RTC_GUARDED_BY(main_thread_);
std::optional<int64_t> last_estimated_playout_ntp_timestamp_ms_