mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Move SampleStatsCounter to public API
Bug: None Change-Id: I8956f6febbb1caf71e951d212d57746fe1ec5eb2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184506 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32142}
This commit is contained in:
parent
979c13f565
commit
9d77762023
25 changed files with 126 additions and 56 deletions
1
BUILD.gn
1
BUILD.gn
|
@ -532,6 +532,7 @@ if (rtc_include_tests) {
|
||||||
"api:rtc_api_unittests",
|
"api:rtc_api_unittests",
|
||||||
"api/audio/test:audio_api_unittests",
|
"api/audio/test:audio_api_unittests",
|
||||||
"api/audio_codecs/test:audio_codecs_api_unittests",
|
"api/audio_codecs/test:audio_codecs_api_unittests",
|
||||||
|
"api/numerics:numerics_unittests",
|
||||||
"api/transport:stun_unittest",
|
"api/transport:stun_unittest",
|
||||||
"api/video/test:rtc_api_video_unittests",
|
"api/video/test:rtc_api_video_unittests",
|
||||||
"api/video_codecs/test:video_codecs_api_unittests",
|
"api/video_codecs/test:video_codecs_api_unittests",
|
||||||
|
|
41
api/numerics/BUILD.gn
Normal file
41
api/numerics/BUILD.gn
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# Copyright (c) 2020 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.
|
||||||
|
|
||||||
|
import("../../webrtc.gni")
|
||||||
|
|
||||||
|
rtc_library("numerics") {
|
||||||
|
visibility = [ "*" ]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"samples_stats_counter.cc",
|
||||||
|
"samples_stats_counter.h",
|
||||||
|
]
|
||||||
|
deps = [
|
||||||
|
"..:array_view",
|
||||||
|
"../../rtc_base:checks",
|
||||||
|
"../../rtc_base:rtc_numerics",
|
||||||
|
"../../rtc_base:timeutils",
|
||||||
|
"../units:timestamp",
|
||||||
|
]
|
||||||
|
absl_deps = [ "//third_party/abseil-cpp/absl/algorithm:container" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rtc_include_tests) {
|
||||||
|
rtc_library("numerics_unittests") {
|
||||||
|
visibility = [ "*" ]
|
||||||
|
testonly = true
|
||||||
|
|
||||||
|
sources = [ "samples_stats_counter_unittest.cc" ]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
":numerics",
|
||||||
|
"../../test:test_support",
|
||||||
|
]
|
||||||
|
absl_deps = [ "//third_party/abseil-cpp/absl/algorithm:container" ]
|
||||||
|
}
|
||||||
|
}
|
6
api/numerics/DEPS
Normal file
6
api/numerics/DEPS
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
specific_include_rules = {
|
||||||
|
# Some internal headers are allowed even in API headers:
|
||||||
|
"samples_stats_counter\.h": [
|
||||||
|
"+rtc_base/numerics/running_statistics.h",
|
||||||
|
]
|
||||||
|
}
|
|
@ -8,8 +8,9 @@
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rtc_base/numerics/samples_stats_counter.h"
|
#include "api/numerics/samples_stats_counter.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "absl/algorithm/container.h"
|
#include "absl/algorithm/container.h"
|
|
@ -8,8 +8,8 @@
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RTC_BASE_NUMERICS_SAMPLES_STATS_COUNTER_H_
|
#ifndef API_NUMERICS_SAMPLES_STATS_COUNTER_H_
|
||||||
#define RTC_BASE_NUMERICS_SAMPLES_STATS_COUNTER_H_
|
#define API_NUMERICS_SAMPLES_STATS_COUNTER_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class SamplesStatsCounter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RunningStatistics<double> stats_;
|
webrtc_impl::RunningStatistics<double> stats_;
|
||||||
std::vector<StatsSample> samples_;
|
std::vector<StatsSample> samples_;
|
||||||
bool sorted_ = false;
|
bool sorted_ = false;
|
||||||
};
|
};
|
||||||
|
@ -116,4 +116,4 @@ SamplesStatsCounter operator/(const SamplesStatsCounter& counter, double value);
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // RTC_BASE_NUMERICS_SAMPLES_STATS_COUNTER_H_
|
#endif // API_NUMERICS_SAMPLES_STATS_COUNTER_H_
|
|
@ -8,7 +8,7 @@
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rtc_base/numerics/samples_stats_counter.h"
|
#include "api/numerics/samples_stats_counter.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
@ -789,6 +789,7 @@ if (rtc_include_tests) {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"../../api:videocodec_test_fixture_api",
|
"../../api:videocodec_test_fixture_api",
|
||||||
|
"../../api/numerics",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_numerics",
|
"../../rtc_base:rtc_numerics",
|
||||||
"../../rtc_base:stringutils",
|
"../../rtc_base:stringutils",
|
||||||
|
|
|
@ -179,20 +179,20 @@ VideoStatistics VideoCodecTestStatsImpl::SliceAndCalcVideoStatistic(
|
||||||
VideoStatistics video_stat;
|
VideoStatistics video_stat;
|
||||||
|
|
||||||
float buffer_level_bits = 0.0f;
|
float buffer_level_bits = 0.0f;
|
||||||
RunningStatistics<float> buffer_level_sec;
|
webrtc_impl::RunningStatistics<float> buffer_level_sec;
|
||||||
|
|
||||||
RunningStatistics<size_t> key_frame_size_bytes;
|
webrtc_impl::RunningStatistics<size_t> key_frame_size_bytes;
|
||||||
RunningStatistics<size_t> delta_frame_size_bytes;
|
webrtc_impl::RunningStatistics<size_t> delta_frame_size_bytes;
|
||||||
|
|
||||||
RunningStatistics<size_t> frame_encoding_time_us;
|
webrtc_impl::RunningStatistics<size_t> frame_encoding_time_us;
|
||||||
RunningStatistics<size_t> frame_decoding_time_us;
|
webrtc_impl::RunningStatistics<size_t> frame_decoding_time_us;
|
||||||
|
|
||||||
RunningStatistics<float> psnr_y;
|
webrtc_impl::RunningStatistics<float> psnr_y;
|
||||||
RunningStatistics<float> psnr_u;
|
webrtc_impl::RunningStatistics<float> psnr_u;
|
||||||
RunningStatistics<float> psnr_v;
|
webrtc_impl::RunningStatistics<float> psnr_v;
|
||||||
RunningStatistics<float> psnr;
|
webrtc_impl::RunningStatistics<float> psnr;
|
||||||
RunningStatistics<float> ssim;
|
webrtc_impl::RunningStatistics<float> ssim;
|
||||||
RunningStatistics<int> qp;
|
webrtc_impl::RunningStatistics<int> qp;
|
||||||
|
|
||||||
size_t rtp_timestamp_first_frame = 0;
|
size_t rtp_timestamp_first_frame = 0;
|
||||||
size_t rtp_timestamp_prev_frame = 0;
|
size_t rtp_timestamp_prev_frame = 0;
|
||||||
|
@ -329,10 +329,10 @@ VideoStatistics VideoCodecTestStatsImpl::SliceAndCalcVideoStatistic(
|
||||||
? 1000000.0f / mean_decode_time_us
|
? 1000000.0f / mean_decode_time_us
|
||||||
: std::numeric_limits<float>::max();
|
: std::numeric_limits<float>::max();
|
||||||
|
|
||||||
auto MaxDelaySec =
|
auto MaxDelaySec = [target_bitrate_kbps](
|
||||||
[target_bitrate_kbps](const RunningStatistics<size_t>& stats) {
|
const webrtc_impl::RunningStatistics<size_t>& stats) {
|
||||||
return 8 * stats.GetMax().value_or(0) / 1000 / target_bitrate_kbps;
|
return 8 * stats.GetMax().value_or(0) / 1000 / target_bitrate_kbps;
|
||||||
};
|
};
|
||||||
|
|
||||||
video_stat.avg_delay_sec = buffer_level_sec.GetMean().value_or(0);
|
video_stat.avg_delay_sec = buffer_level_sec.GetMean().value_or(0);
|
||||||
video_stat.max_key_frame_delay_sec = MaxDelaySec(key_frame_size_bytes);
|
video_stat.max_key_frame_delay_sec = MaxDelaySec(key_frame_size_bytes);
|
||||||
|
|
|
@ -204,8 +204,8 @@ rtc_library("platform_thread") {
|
||||||
visibility = [
|
visibility = [
|
||||||
":rtc_base_approved",
|
":rtc_base_approved",
|
||||||
":rtc_task_queue_libevent",
|
":rtc_task_queue_libevent",
|
||||||
":rtc_task_queue_win",
|
|
||||||
":rtc_task_queue_stdlib",
|
":rtc_task_queue_stdlib",
|
||||||
|
":rtc_task_queue_win",
|
||||||
"synchronization:mutex",
|
"synchronization:mutex",
|
||||||
"synchronization:sequence_checker",
|
"synchronization:sequence_checker",
|
||||||
]
|
]
|
||||||
|
@ -587,8 +587,6 @@ rtc_library("rtc_numerics") {
|
||||||
sources = [
|
sources = [
|
||||||
"numerics/event_based_exponential_moving_average.cc",
|
"numerics/event_based_exponential_moving_average.cc",
|
||||||
"numerics/event_based_exponential_moving_average.h",
|
"numerics/event_based_exponential_moving_average.h",
|
||||||
"numerics/event_rate_counter.cc",
|
|
||||||
"numerics/event_rate_counter.h",
|
|
||||||
"numerics/exp_filter.cc",
|
"numerics/exp_filter.cc",
|
||||||
"numerics/exp_filter.h",
|
"numerics/exp_filter.h",
|
||||||
"numerics/math_utils.h",
|
"numerics/math_utils.h",
|
||||||
|
@ -597,25 +595,30 @@ rtc_library("rtc_numerics") {
|
||||||
"numerics/moving_median_filter.h",
|
"numerics/moving_median_filter.h",
|
||||||
"numerics/percentile_filter.h",
|
"numerics/percentile_filter.h",
|
||||||
"numerics/running_statistics.h",
|
"numerics/running_statistics.h",
|
||||||
"numerics/sample_stats.cc",
|
|
||||||
"numerics/sample_stats.h",
|
|
||||||
"numerics/samples_stats_counter.cc",
|
|
||||||
"numerics/samples_stats_counter.h",
|
|
||||||
"numerics/sequence_number_util.h",
|
"numerics/sequence_number_util.h",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
":checks",
|
":checks",
|
||||||
|
":macromagic",
|
||||||
":rtc_base_approved",
|
":rtc_base_approved",
|
||||||
":safe_compare",
|
]
|
||||||
"../api:array_view",
|
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
rtc_library("rtc_stats_counters") {
|
||||||
|
sources = [
|
||||||
|
"numerics/event_rate_counter.cc",
|
||||||
|
"numerics/event_rate_counter.h",
|
||||||
|
"numerics/sample_stats.cc",
|
||||||
|
"numerics/sample_stats.h",
|
||||||
|
]
|
||||||
|
deps = [
|
||||||
|
"../api/numerics",
|
||||||
"../api/units:data_rate",
|
"../api/units:data_rate",
|
||||||
"../api/units:time_delta",
|
"../api/units:time_delta",
|
||||||
"../api/units:timestamp",
|
"../api/units:timestamp",
|
||||||
]
|
]
|
||||||
absl_deps = [
|
absl_deps = []
|
||||||
"//third_party/abseil-cpp/absl/algorithm:container",
|
|
||||||
"//third_party/abseil-cpp/absl/types:optional",
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
config("rtc_json_suppressions") {
|
config("rtc_json_suppressions") {
|
||||||
|
@ -804,6 +807,7 @@ rtc_library("rtc_base") {
|
||||||
"../api:array_view",
|
"../api:array_view",
|
||||||
"../api:function_view",
|
"../api:function_view",
|
||||||
"../api:scoped_refptr",
|
"../api:scoped_refptr",
|
||||||
|
"../api/numerics",
|
||||||
"../api/task_queue",
|
"../api/task_queue",
|
||||||
"../system_wrappers:field_trial",
|
"../system_wrappers:field_trial",
|
||||||
"network:sent_packet",
|
"network:sent_packet",
|
||||||
|
@ -942,7 +946,6 @@ rtc_library("rtc_base") {
|
||||||
"callback.h",
|
"callback.h",
|
||||||
"log_sinks.cc",
|
"log_sinks.cc",
|
||||||
"log_sinks.h",
|
"log_sinks.h",
|
||||||
"numerics/math_utils.h",
|
|
||||||
"rolling_accumulator.h",
|
"rolling_accumulator.h",
|
||||||
"ssl_roots.h",
|
"ssl_roots.h",
|
||||||
]
|
]
|
||||||
|
@ -1270,6 +1273,7 @@ if (rtc_include_tests) {
|
||||||
":rtc_base",
|
":rtc_base",
|
||||||
":rtc_base_approved",
|
":rtc_base_approved",
|
||||||
":rtc_base_tests_utils",
|
":rtc_base_tests_utils",
|
||||||
|
":rtc_numerics",
|
||||||
":rtc_task_queue",
|
":rtc_task_queue",
|
||||||
":safe_compare",
|
":safe_compare",
|
||||||
":safe_minmax",
|
":safe_minmax",
|
||||||
|
@ -1278,6 +1282,7 @@ if (rtc_include_tests) {
|
||||||
":testclient",
|
":testclient",
|
||||||
"../api:array_view",
|
"../api:array_view",
|
||||||
"../api:scoped_refptr",
|
"../api:scoped_refptr",
|
||||||
|
"../api/numerics",
|
||||||
"../api/units:time_delta",
|
"../api/units:time_delta",
|
||||||
"../system_wrappers",
|
"../system_wrappers",
|
||||||
"../test:fileutils",
|
"../test:fileutils",
|
||||||
|
@ -1351,7 +1356,6 @@ if (rtc_include_tests) {
|
||||||
"numerics/moving_median_filter_unittest.cc",
|
"numerics/moving_median_filter_unittest.cc",
|
||||||
"numerics/percentile_filter_unittest.cc",
|
"numerics/percentile_filter_unittest.cc",
|
||||||
"numerics/running_statistics_unittest.cc",
|
"numerics/running_statistics_unittest.cc",
|
||||||
"numerics/samples_stats_counter_unittest.cc",
|
|
||||||
"numerics/sequence_number_util_unittest.cc",
|
"numerics/sequence_number_util_unittest.cc",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
|
|
|
@ -8,14 +8,16 @@
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RTC_BASE_NUMERICS_MATH_UTILS_H_
|
#ifndef API_NUMERICS_MATH_UTILS_H_
|
||||||
#define RTC_BASE_NUMERICS_MATH_UTILS_H_
|
#define API_NUMERICS_MATH_UTILS_H_
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
|
|
||||||
|
namespace webrtc {
|
||||||
|
namespace webrtc_impl {
|
||||||
// Given two numbers |x| and |y| such that x >= y, computes the difference
|
// Given two numbers |x| and |y| such that x >= y, computes the difference
|
||||||
// x - y without causing undefined behavior due to signed overflow.
|
// x - y without causing undefined behavior due to signed overflow.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -67,4 +69,7 @@ constexpr T minus_infinity_or_min() {
|
||||||
return std::numeric_limits<T>::min();
|
return std::numeric_limits<T>::min();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // RTC_BASE_NUMERICS_MATH_UTILS_H_
|
} // namespace webrtc_impl
|
||||||
|
} // namespace webrtc
|
||||||
|
|
||||||
|
#endif // API_NUMERICS_MATH_UTILS_H_
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RTC_BASE_NUMERICS_RUNNING_STATISTICS_H_
|
#ifndef API_NUMERICS_RUNNING_STATISTICS_H_
|
||||||
#define RTC_BASE_NUMERICS_RUNNING_STATISTICS_H_
|
#define API_NUMERICS_RUNNING_STATISTICS_H_
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
#include "rtc_base/numerics/math_utils.h"
|
#include "rtc_base/numerics/math_utils.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
namespace webrtc_impl {
|
||||||
|
|
||||||
// tl;dr: Robust and efficient online computation of statistics,
|
// tl;dr: Robust and efficient online computation of statistics,
|
||||||
// using Welford's method for variance. [1]
|
// using Welford's method for variance. [1]
|
||||||
|
@ -154,6 +155,7 @@ class RunningStatistics {
|
||||||
double cumul_ = 0; // Variance * size_, sometimes noted m2.
|
double cumul_ = 0; // Variance * size_, sometimes noted m2.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace webrtc_impl
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
#endif // RTC_BASE_NUMERICS_RUNNING_STATISTICS_H_
|
#endif // API_NUMERICS_RUNNING_STATISTICS_H_
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
// Tests were copied from samples_stats_counter_unittest.cc.
|
// Tests were copied from samples_stats_counter_unittest.cc.
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
namespace webrtc_impl {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
RunningStatistics<double> CreateStatsFilledWithIntsFrom1ToN(int n) {
|
RunningStatistics<double> CreateStatsFilledWithIntsFrom1ToN(int n) {
|
||||||
|
@ -55,8 +56,6 @@ class RunningStatisticsTest : public ::testing::TestWithParam<int> {};
|
||||||
|
|
||||||
constexpr int SIZE_FOR_MERGE = 5;
|
constexpr int SIZE_FOR_MERGE = 5;
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
TEST(RunningStatistics, FullSimpleTest) {
|
TEST(RunningStatistics, FullSimpleTest) {
|
||||||
auto stats = CreateStatsFilledWithIntsFrom1ToN(100);
|
auto stats = CreateStatsFilledWithIntsFrom1ToN(100);
|
||||||
|
|
||||||
|
@ -192,4 +191,6 @@ INSTANTIATE_TEST_SUITE_P(RunningStatisticsTests,
|
||||||
RunningStatisticsTest,
|
RunningStatisticsTest,
|
||||||
::testing::Range(0, SIZE_FOR_MERGE + 1));
|
::testing::Range(0, SIZE_FOR_MERGE + 1));
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
} // namespace webrtc_impl
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
#ifndef RTC_BASE_NUMERICS_SAMPLE_STATS_H_
|
#ifndef RTC_BASE_NUMERICS_SAMPLE_STATS_H_
|
||||||
#define RTC_BASE_NUMERICS_SAMPLE_STATS_H_
|
#define RTC_BASE_NUMERICS_SAMPLE_STATS_H_
|
||||||
|
|
||||||
|
#include "api/numerics/samples_stats_counter.h"
|
||||||
#include "api/units/data_rate.h"
|
#include "api/units/data_rate.h"
|
||||||
#include "api/units/time_delta.h"
|
#include "api/units/time_delta.h"
|
||||||
#include "api/units/timestamp.h"
|
#include "api/units/timestamp.h"
|
||||||
#include "rtc_base/numerics/samples_stats_counter.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -120,7 +120,7 @@ void BucketTestSignedInterval(unsigned int bucket_count,
|
||||||
|
|
||||||
ASSERT_GE(high, low);
|
ASSERT_GE(high, low);
|
||||||
ASSERT_GE(bucket_count, 2u);
|
ASSERT_GE(bucket_count, 2u);
|
||||||
uint32_t interval = unsigned_difference<int32_t>(high, low) + 1;
|
uint32_t interval = webrtc_impl::unsigned_difference<int32_t>(high, low) + 1;
|
||||||
uint32_t numbers_per_bucket;
|
uint32_t numbers_per_bucket;
|
||||||
if (interval == 0) {
|
if (interval == 0) {
|
||||||
// The computation high - low + 1 should be 2^32 but overflowed
|
// The computation high - low + 1 should be 2^32 but overflowed
|
||||||
|
@ -136,7 +136,8 @@ void BucketTestSignedInterval(unsigned int bucket_count,
|
||||||
int32_t sample = prng->Rand(low, high);
|
int32_t sample = prng->Rand(low, high);
|
||||||
EXPECT_LE(low, sample);
|
EXPECT_LE(low, sample);
|
||||||
EXPECT_GE(high, sample);
|
EXPECT_GE(high, sample);
|
||||||
buckets[unsigned_difference<int32_t>(sample, low) / numbers_per_bucket]++;
|
buckets[webrtc_impl::unsigned_difference<int32_t>(sample, low) /
|
||||||
|
numbers_per_bucket]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < bucket_count; i++) {
|
for (unsigned int i = 0; i < bucket_count; i++) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ class RollingAccumulator {
|
||||||
size_t count() const { return static_cast<size_t>(stats_.Size()); }
|
size_t count() const { return static_cast<size_t>(stats_.Size()); }
|
||||||
|
|
||||||
void Reset() {
|
void Reset() {
|
||||||
stats_ = webrtc::RunningStatistics<T>();
|
stats_ = webrtc::webrtc_impl::RunningStatistics<T>();
|
||||||
next_index_ = 0U;
|
next_index_ = 0U;
|
||||||
max_ = T();
|
max_ = T();
|
||||||
max_stale_ = false;
|
max_stale_ = false;
|
||||||
|
@ -129,7 +129,7 @@ class RollingAccumulator {
|
||||||
double ComputeVariance() const { return stats_.GetVariance().value_or(0); }
|
double ComputeVariance() const { return stats_.GetVariance().value_or(0); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
webrtc::RunningStatistics<T> stats_;
|
webrtc::webrtc_impl::RunningStatistics<T> stats_;
|
||||||
size_t next_index_;
|
size_t next_index_;
|
||||||
mutable T max_;
|
mutable T max_;
|
||||||
mutable bool max_stale_;
|
mutable bool max_stale_;
|
||||||
|
|
|
@ -35,8 +35,8 @@ group("test") {
|
||||||
|
|
||||||
rtc_library("frame_generator_impl") {
|
rtc_library("frame_generator_impl") {
|
||||||
visibility = [
|
visibility = [
|
||||||
"../api:create_frame_generator",
|
|
||||||
":*",
|
":*",
|
||||||
|
"../api:create_frame_generator",
|
||||||
]
|
]
|
||||||
testonly = true
|
testonly = true
|
||||||
sources = [
|
sources = [
|
||||||
|
@ -246,6 +246,7 @@ rtc_library("perf_test") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"../api:array_view",
|
"../api:array_view",
|
||||||
|
"../api/numerics",
|
||||||
"../rtc_base:checks",
|
"../rtc_base:checks",
|
||||||
"../rtc_base:criticalsection",
|
"../rtc_base:criticalsection",
|
||||||
"../rtc_base:logging",
|
"../rtc_base:logging",
|
||||||
|
|
|
@ -567,6 +567,7 @@ if (!build_with_chromium) {
|
||||||
"../../../api:rtc_stats_api",
|
"../../../api:rtc_stats_api",
|
||||||
"../../../api:stats_observer_interface",
|
"../../../api:stats_observer_interface",
|
||||||
"../../../api:track_id_stream_info_map",
|
"../../../api:track_id_stream_info_map",
|
||||||
|
"../../../api/numerics",
|
||||||
"../../../api/units:time_delta",
|
"../../../api/units:time_delta",
|
||||||
"../../../api/units:timestamp",
|
"../../../api/units:timestamp",
|
||||||
"../../../rtc_base:criticalsection",
|
"../../../rtc_base:criticalsection",
|
||||||
|
@ -610,6 +611,7 @@ if (!build_with_chromium) {
|
||||||
"../../../api:peer_connection_quality_test_fixture_api",
|
"../../../api:peer_connection_quality_test_fixture_api",
|
||||||
"../../../api:rtc_stats_api",
|
"../../../api:rtc_stats_api",
|
||||||
"../../../api:track_id_stream_info_map",
|
"../../../api:track_id_stream_info_map",
|
||||||
|
"../../../api/numerics",
|
||||||
"../../../api/units:data_rate",
|
"../../../api/units:data_rate",
|
||||||
"../../../api/units:data_size",
|
"../../../api/units:data_size",
|
||||||
"../../../api/units:time_delta",
|
"../../../api/units:time_delta",
|
||||||
|
@ -635,6 +637,7 @@ if (!build_with_chromium) {
|
||||||
"../..:perf_test",
|
"../..:perf_test",
|
||||||
"../../../api:array_view",
|
"../../../api:array_view",
|
||||||
"../../../api:video_quality_analyzer_api",
|
"../../../api:video_quality_analyzer_api",
|
||||||
|
"../../../api/numerics",
|
||||||
"../../../api/units:time_delta",
|
"../../../api/units:time_delta",
|
||||||
"../../../api/units:timestamp",
|
"../../../api/units:timestamp",
|
||||||
"../../../api/video:encoded_image",
|
"../../../api/video:encoded_image",
|
||||||
|
@ -717,6 +720,7 @@ if (!build_with_chromium) {
|
||||||
"../../../api:peer_connection_quality_test_fixture_api",
|
"../../../api:peer_connection_quality_test_fixture_api",
|
||||||
"../../../api:rtc_stats_api",
|
"../../../api:rtc_stats_api",
|
||||||
"../../../api:track_id_stream_info_map",
|
"../../../api:track_id_stream_info_map",
|
||||||
|
"../../../api/numerics",
|
||||||
"../../../api/units:timestamp",
|
"../../../api/units:timestamp",
|
||||||
"../../../rtc_base:criticalsection",
|
"../../../rtc_base:criticalsection",
|
||||||
"../../../rtc_base:rtc_event",
|
"../../../rtc_base:rtc_event",
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "absl/strings/string_view.h"
|
#include "absl/strings/string_view.h"
|
||||||
|
#include "api/numerics/samples_stats_counter.h"
|
||||||
#include "api/test/audio_quality_analyzer_interface.h"
|
#include "api/test/audio_quality_analyzer_interface.h"
|
||||||
#include "api/test/track_id_stream_info_map.h"
|
#include "api/test/track_id_stream_info_map.h"
|
||||||
#include "api/units/time_delta.h"
|
#include "api/units/time_delta.h"
|
||||||
#include "rtc_base/numerics/samples_stats_counter.h"
|
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/synchronization/mutex.h"
|
||||||
#include "test/testsupport/perf_test.h"
|
#include "test/testsupport/perf_test.h"
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/array_view.h"
|
#include "api/array_view.h"
|
||||||
|
#include "api/numerics/samples_stats_counter.h"
|
||||||
#include "api/test/video_quality_analyzer_interface.h"
|
#include "api/test/video_quality_analyzer_interface.h"
|
||||||
#include "api/units/timestamp.h"
|
#include "api/units/timestamp.h"
|
||||||
#include "api/video/encoded_image.h"
|
#include "api/video/encoded_image.h"
|
||||||
#include "api/video/video_frame.h"
|
#include "api/video/video_frame.h"
|
||||||
#include "rtc_base/event.h"
|
#include "rtc_base/event.h"
|
||||||
#include "rtc_base/numerics/samples_stats_counter.h"
|
|
||||||
#include "rtc_base/platform_thread.h"
|
#include "rtc_base/platform_thread.h"
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/synchronization/mutex.h"
|
||||||
#include "system_wrappers/include/clock.h"
|
#include "system_wrappers/include/clock.h"
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "absl/strings/string_view.h"
|
#include "absl/strings/string_view.h"
|
||||||
|
#include "api/numerics/samples_stats_counter.h"
|
||||||
#include "api/test/peerconnection_quality_test_fixture.h"
|
#include "api/test/peerconnection_quality_test_fixture.h"
|
||||||
#include "api/test/track_id_stream_info_map.h"
|
#include "api/test/track_id_stream_info_map.h"
|
||||||
#include "api/units/data_size.h"
|
#include "api/units/data_size.h"
|
||||||
#include "api/units/timestamp.h"
|
#include "api/units/timestamp.h"
|
||||||
#include "rtc_base/numerics/samples_stats_counter.h"
|
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/synchronization/mutex.h"
|
||||||
#include "test/testsupport/perf_test.h"
|
#include "test/testsupport/perf_test.h"
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@
|
||||||
|
|
||||||
#include "absl/strings/string_view.h"
|
#include "absl/strings/string_view.h"
|
||||||
#include "absl/types/optional.h"
|
#include "absl/types/optional.h"
|
||||||
|
#include "api/numerics/samples_stats_counter.h"
|
||||||
#include "api/test/peerconnection_quality_test_fixture.h"
|
#include "api/test/peerconnection_quality_test_fixture.h"
|
||||||
#include "api/test/track_id_stream_info_map.h"
|
#include "api/test/track_id_stream_info_map.h"
|
||||||
#include "api/units/timestamp.h"
|
#include "api/units/timestamp.h"
|
||||||
#include "rtc_base/numerics/samples_stats_counter.h"
|
|
||||||
#include "rtc_base/synchronization/mutex.h"
|
#include "rtc_base/synchronization/mutex.h"
|
||||||
#include "test/testsupport/perf_test.h"
|
#include "test/testsupport/perf_test.h"
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,7 @@ if (rtc_include_tests) {
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../rtc_base:rtc_base_tests_utils",
|
"../../rtc_base:rtc_base_tests_utils",
|
||||||
"../../rtc_base:rtc_numerics",
|
"../../rtc_base:rtc_numerics",
|
||||||
|
"../../rtc_base:rtc_stats_counters",
|
||||||
"../../rtc_base:rtc_task_queue",
|
"../../rtc_base:rtc_task_queue",
|
||||||
"../../rtc_base:safe_minmax",
|
"../../rtc_base:safe_minmax",
|
||||||
"../../rtc_base:task_queue_for_test",
|
"../../rtc_base:task_queue_for_test",
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/array_view.h"
|
#include "api/array_view.h"
|
||||||
#include "rtc_base/numerics/samples_stats_counter.h"
|
#include "api/numerics/samples_stats_counter.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
|
@ -298,6 +298,7 @@ if (rtc_include_tests) {
|
||||||
"../api:rtc_event_log_output_file",
|
"../api:rtc_event_log_output_file",
|
||||||
"../api:test_dependency_factory",
|
"../api:test_dependency_factory",
|
||||||
"../api:video_quality_test_fixture_api",
|
"../api:video_quality_test_fixture_api",
|
||||||
|
"../api/numerics",
|
||||||
"../api/rtc_event_log:rtc_event_log_factory",
|
"../api/rtc_event_log:rtc_event_log_factory",
|
||||||
"../api/task_queue",
|
"../api/task_queue",
|
||||||
"../api/task_queue:default_task_queue_factory",
|
"../api/task_queue:default_task_queue_factory",
|
||||||
|
|
|
@ -35,7 +35,7 @@ class VideoAnalyzer : public PacketReceiver,
|
||||||
public Transport,
|
public Transport,
|
||||||
public rtc::VideoSinkInterface<VideoFrame> {
|
public rtc::VideoSinkInterface<VideoFrame> {
|
||||||
public:
|
public:
|
||||||
using Statistics = RunningStatistics<double>;
|
using Statistics = webrtc_impl::RunningStatistics<double>;
|
||||||
|
|
||||||
VideoAnalyzer(test::LayerFilteringTransport* transport,
|
VideoAnalyzer(test::LayerFilteringTransport* transport,
|
||||||
const std::string& test_label,
|
const std::string& test_label,
|
||||||
|
|
Loading…
Reference in a new issue