Move sample_counter.h to webrtc namespace

Bug: webrtc:42232595
Change-Id: I774efbe2bbe5d29e7eac500acf1fa4c99ebc74a8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/378041
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43936}
This commit is contained in:
Evan Shrubsole 2025-02-20 07:42:28 +00:00 committed by WebRTC LUCI CQ
parent 8175444111
commit d650f3c6de
5 changed files with 27 additions and 20 deletions

View File

@ -17,7 +17,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/numerics/safe_conversions.h"
namespace rtc {
namespace webrtc {
SampleCounter::SampleCounter() = default;
SampleCounter::~SampleCounter() = default;
@ -117,4 +117,4 @@ void SampleCounterWithVariance::Reset() {
*this = {};
}
} // namespace rtc
} // namespace webrtc

View File

@ -15,7 +15,7 @@
#include <optional>
namespace rtc {
namespace webrtc {
// Simple utility class for counting basic statistics (max./avg./variance) on
// stream of samples.
@ -56,5 +56,12 @@ class SampleCounterWithVariance : public SampleCounter {
int64_t sum_squared_ = 0;
};
} // 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::SampleCounter;
using ::webrtc::SampleCounterWithVariance;
} // namespace rtc
#endif // RTC_BASE_NUMERICS_SAMPLE_COUNTER_H_

View File

@ -18,7 +18,7 @@
using ::testing::Eq;
namespace rtc {
namespace webrtc {
TEST(SampleCounterTest, ProcessesNoSamples) {
constexpr int kMinSamples = 1;
@ -82,4 +82,4 @@ TEST(SampleCounterTest, AggregatesTwoCounters) {
EXPECT_THAT(counter1.Variance(kMinSamples), Eq(2));
}
} // namespace rtc
} // namespace webrtc

View File

@ -129,7 +129,7 @@ class ReceiveStatisticsProxy : public VideoStreamBufferControllerStatsObserver,
private:
struct QpCounters {
rtc::SampleCounter vp8;
SampleCounter vp8;
};
struct ContentSpecificStats {
@ -138,13 +138,13 @@ class ReceiveStatisticsProxy : public VideoStreamBufferControllerStatsObserver,
void Add(const ContentSpecificStats& other);
rtc::SampleCounter e2e_delay_counter;
rtc::SampleCounter interframe_delay_counter;
SampleCounter e2e_delay_counter;
SampleCounter interframe_delay_counter;
int64_t flow_duration_ms = 0;
int64_t total_media_bytes = 0;
rtc::SampleCounter received_width;
rtc::SampleCounter received_height;
rtc::SampleCounter qp_counter;
SampleCounter received_width;
SampleCounter received_height;
SampleCounter qp_counter;
FrameCounts frame_counts;
rtc::HistogramPercentileCounter interframe_delay_percentiles;
webrtc_impl::RunningStatistics<double> corruption_score;
@ -168,12 +168,12 @@ class ReceiveStatisticsProxy : public VideoStreamBufferControllerStatsObserver,
RateStatistics renders_fps_estimator_ RTC_GUARDED_BY(main_thread_);
rtc::RateTracker render_fps_tracker_ RTC_GUARDED_BY(main_thread_);
rtc::RateTracker render_pixel_tracker_ RTC_GUARDED_BY(main_thread_);
rtc::SampleCounter sync_offset_counter_ RTC_GUARDED_BY(main_thread_);
rtc::SampleCounter decode_time_counter_ RTC_GUARDED_BY(main_thread_);
rtc::SampleCounter jitter_delay_counter_ RTC_GUARDED_BY(main_thread_);
rtc::SampleCounter target_delay_counter_ RTC_GUARDED_BY(main_thread_);
rtc::SampleCounter current_delay_counter_ RTC_GUARDED_BY(main_thread_);
rtc::SampleCounter oneway_delay_counter_ RTC_GUARDED_BY(main_thread_);
SampleCounter sync_offset_counter_ RTC_GUARDED_BY(main_thread_);
SampleCounter decode_time_counter_ RTC_GUARDED_BY(main_thread_);
SampleCounter jitter_delay_counter_ RTC_GUARDED_BY(main_thread_);
SampleCounter target_delay_counter_ RTC_GUARDED_BY(main_thread_);
SampleCounter current_delay_counter_ RTC_GUARDED_BY(main_thread_);
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_

View File

@ -76,10 +76,10 @@ class VideoQualityObserver {
double sum_squared_interframe_delays_secs_;
// An inter-frame delay is counted as a freeze if it's significantly longer
// than average inter-frame delay.
rtc::SampleCounter freezes_durations_;
rtc::SampleCounter pauses_durations_;
SampleCounter freezes_durations_;
SampleCounter pauses_durations_;
// Time between freezes.
rtc::SampleCounter smooth_playback_durations_;
SampleCounter smooth_playback_durations_;
// Counters for time spent in different resolutions. Time between each two
// Consecutive frames is counted to bin corresponding to the first frame
// resolution.