Start moving timing helper classes into timing/ sub-folder.
Putting these classes in a sub folder increases
structure and clarifies that they are used as
helper classes. Affected classes in this change:
* CodecTimer
* InterFrameDelay
* RttFilter
VCMTiming will be moved in a separate CL.
Additional changes:
* Remove VCM prefix from class names.
* Introduce granular BUILD.gn targets.
* Update some includes.
Bug: webrtc:14111
Change-Id: Ia75128aa955a819033b97d4784cb61904de7230b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262960
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36975}
diff --git a/modules/BUILD.gn b/modules/BUILD.gn
index d24bf64..fd408ab 100644
--- a/modules/BUILD.gn
+++ b/modules/BUILD.gn
@@ -223,6 +223,7 @@
"rtp_rtcp:rtp_rtcp_unittests",
"utility:utility_unittests",
"video_coding:video_coding_unittests",
+ "video_coding/timing:timing_unittests",
"video_processing:video_processing_unittests",
]
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index 63fa98e..e6c4ed5 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -164,8 +164,6 @@
rtc_library("timing") {
sources = [
- "codec_timer.cc",
- "codec_timer.h",
"timing.cc",
"timing.h",
]
@@ -180,29 +178,17 @@
"../../rtc_base/synchronization:mutex",
"../../rtc_base/time:timestamp_extrapolator",
"../../system_wrappers",
+ "timing:codec_timer",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
-rtc_library("rtt_filter") {
- sources = [
- "rtt_filter.cc",
- "rtt_filter.h",
- ]
- deps = [ "../../api/units:time_delta" ]
- absl_deps = [
- "//third_party/abseil-cpp/absl/algorithm:container",
- "//third_party/abseil-cpp/absl/container:inlined_vector",
- ]
-}
-
rtc_library("jitter_estimator") {
sources = [
"jitter_estimator.cc",
"jitter_estimator.h",
]
deps = [
- ":rtt_filter",
"../../api:field_trials_view",
"../../api/units:data_size",
"../../api/units:frequency",
@@ -212,20 +198,7 @@
"../../rtc_base:safe_conversions",
"../../rtc_base/experiments:jitter_upper_bound_experiment",
"../../system_wrappers",
- ]
- absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
-}
-
-rtc_library("inter_frame_delay") {
- sources = [
- "inter_frame_delay.cc",
- "inter_frame_delay.h",
- ]
- deps = [
- "..:module_api_public",
- "../../api/units:frequency",
- "../../api/units:time_delta",
- "../../api/units:timestamp",
+ "timing:rtt_filter",
]
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
@@ -277,9 +250,7 @@
":codec_globals_headers",
":encoded_frame",
":frame_helpers",
- ":inter_frame_delay",
":jitter_estimator",
- ":rtt_filter",
":timing",
":video_codec_interface",
":video_coding_utility",
@@ -346,6 +317,8 @@
"../rtp_rtcp:rtp_video_header",
"codecs/av1:av1_svc_config",
"svc:scalability_mode_util",
+ "timing:inter_frame_delay",
+ "timing:rtt_filter",
]
absl_deps = [
"//third_party/abseil-cpp/absl/base:core_headers",
@@ -402,7 +375,6 @@
deps = [
":codec_globals_headers",
":encoded_frame",
- ":inter_frame_delay",
":jitter_estimator",
":timing",
":video_codec_interface",
@@ -436,6 +408,7 @@
"../rtp_rtcp:rtp_rtcp_format",
"../rtp_rtcp:rtp_video_header",
"../utility",
+ "timing:inter_frame_delay",
]
absl_deps = [
"//third_party/abseil-cpp/absl/memory",
@@ -1157,7 +1130,6 @@
"h264_sprop_parameter_sets_unittest.cc",
"h264_sps_pps_tracker_unittest.cc",
"histogram_unittest.cc",
- "inter_frame_delay_unittest.cc",
"jitter_buffer_unittest.cc",
"jitter_estimator_tests.cc",
"loss_notification_controller_unittest.cc",
@@ -1168,7 +1140,6 @@
"rtp_frame_reference_finder_unittest.cc",
"rtp_vp8_ref_finder_unittest.cc",
"rtp_vp9_ref_finder_unittest.cc",
- "rtt_filter_unittest.cc",
"session_info_unittest.cc",
"test/stream_generator.cc",
"test/stream_generator.h",
@@ -1200,11 +1171,9 @@
":encoded_frame",
":frame_dependencies_calculator",
":h264_packet_buffer",
- ":inter_frame_delay",
":jitter_estimator",
":nack_requester",
":packet_buffer",
- ":rtt_filter",
":simulcast_test_fixture_impl",
":timing",
":video_codec_interface",
diff --git a/modules/video_coding/frame_buffer2.h b/modules/video_coding/frame_buffer2.h
index 48aceab..9b74d65 100644
--- a/modules/video_coding/frame_buffer2.h
+++ b/modules/video_coding/frame_buffer2.h
@@ -22,8 +22,8 @@
#include "api/sequence_checker.h"
#include "api/video/encoded_frame.h"
#include "modules/video_coding/include/video_coding_defines.h"
-#include "modules/video_coding/inter_frame_delay.h"
#include "modules/video_coding/jitter_estimator.h"
+#include "modules/video_coding/timing/inter_frame_delay.h"
#include "modules/video_coding/utility/decoded_frames_history.h"
#include "rtc_base/event.h"
#include "rtc_base/experiments/field_trial_parser.h"
@@ -174,7 +174,7 @@
VCMJitterEstimator jitter_estimator_ RTC_GUARDED_BY(mutex_);
VCMTiming* const timing_ RTC_GUARDED_BY(mutex_);
- VCMInterFrameDelay inter_frame_delay_ RTC_GUARDED_BY(mutex_);
+ InterFrameDelay inter_frame_delay_ RTC_GUARDED_BY(mutex_);
absl::optional<int64_t> last_continuous_frame_ RTC_GUARDED_BY(mutex_);
std::vector<FrameMap::iterator> frames_to_decode_ RTC_GUARDED_BY(mutex_);
bool stopped_ RTC_GUARDED_BY(mutex_);
diff --git a/modules/video_coding/jitter_buffer.cc b/modules/video_coding/jitter_buffer.cc
index 6464b8c..e138a99c 100644
--- a/modules/video_coding/jitter_buffer.cc
+++ b/modules/video_coding/jitter_buffer.cc
@@ -16,11 +16,11 @@
#include "api/units/timestamp.h"
#include "modules/video_coding/frame_buffer.h"
#include "modules/video_coding/include/video_coding.h"
-#include "modules/video_coding/inter_frame_delay.h"
#include "modules/video_coding/internal_defines.h"
#include "modules/video_coding/jitter_buffer_common.h"
#include "modules/video_coding/jitter_estimator.h"
#include "modules/video_coding/packet.h"
+#include "modules/video_coding/timing/inter_frame_delay.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/clock.h"
diff --git a/modules/video_coding/jitter_buffer.h b/modules/video_coding/jitter_buffer.h
index 72feffd..e31c775 100644
--- a/modules/video_coding/jitter_buffer.h
+++ b/modules/video_coding/jitter_buffer.h
@@ -24,9 +24,9 @@
#include "modules/video_coding/event_wrapper.h"
#include "modules/video_coding/include/video_coding.h"
#include "modules/video_coding/include/video_coding_defines.h"
-#include "modules/video_coding/inter_frame_delay.h"
#include "modules/video_coding/jitter_buffer_common.h"
#include "modules/video_coding/jitter_estimator.h"
+#include "modules/video_coding/timing/inter_frame_delay.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/thread_annotations.h"
@@ -254,7 +254,7 @@
// Filter for estimating jitter.
VCMJitterEstimator jitter_estimate_;
// Calculates network delays used for jitter calculations.
- VCMInterFrameDelay inter_frame_delay_;
+ InterFrameDelay inter_frame_delay_;
VCMJitterSample waiting_for_completion_;
// Holds the internal NACK list (the missing sequence numbers).
diff --git a/modules/video_coding/jitter_estimator.cc b/modules/video_coding/jitter_estimator.cc
index acc36a9..393d42d 100644
--- a/modules/video_coding/jitter_estimator.cc
+++ b/modules/video_coding/jitter_estimator.cc
@@ -22,7 +22,7 @@
#include "api/units/frequency.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
-#include "modules/video_coding/rtt_filter.h"
+#include "modules/video_coding/timing/rtt_filter.h"
#include "rtc_base/experiments/jitter_upper_bound_experiment.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "system_wrappers/include/clock.h"
diff --git a/modules/video_coding/jitter_estimator.h b/modules/video_coding/jitter_estimator.h
index 20d318a..90a2753 100644
--- a/modules/video_coding/jitter_estimator.h
+++ b/modules/video_coding/jitter_estimator.h
@@ -17,7 +17,7 @@
#include "api/units/frequency.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
-#include "modules/video_coding/rtt_filter.h"
+#include "modules/video_coding/timing/rtt_filter.h"
#include "rtc_base/rolling_accumulator.h"
namespace webrtc {
@@ -152,7 +152,7 @@
// Keeps track of the number of nacks received, but never goes above
// kNackLimit.
uint32_t nack_count_;
- VCMRttFilter rtt_filter_;
+ RttFilter rtt_filter_;
// Tracks frame rates in microseconds.
rtc::RollingAccumulator<uint64_t> fps_counter_;
diff --git a/modules/video_coding/timing.cc b/modules/video_coding/timing.cc
index f45d620..af421c7 100644
--- a/modules/video_coding/timing.cc
+++ b/modules/video_coding/timing.cc
@@ -30,7 +30,7 @@
: clock_(clock),
ts_extrapolator_(
std::make_unique<TimestampExtrapolator>(clock_->CurrentTime())),
- codec_timer_(std::make_unique<VCMCodecTimer>()),
+ codec_timer_(std::make_unique<CodecTimer>()),
render_delay_(kDefaultRenderDelay),
min_playout_delay_(TimeDelta::Zero()),
max_playout_delay_(TimeDelta::Seconds(10)),
@@ -48,7 +48,7 @@
void VCMTiming::Reset() {
MutexLock lock(&mutex_);
ts_extrapolator_->Reset(clock_->CurrentTime());
- codec_timer_ = std::make_unique<VCMCodecTimer>();
+ codec_timer_ = std::make_unique<CodecTimer>();
render_delay_ = kDefaultRenderDelay;
min_playout_delay_ = TimeDelta::Zero();
jitter_delay_ = TimeDelta::Zero();
diff --git a/modules/video_coding/timing.h b/modules/video_coding/timing.h
index 41a6f87..8c09451 100644
--- a/modules/video_coding/timing.h
+++ b/modules/video_coding/timing.h
@@ -17,7 +17,7 @@
#include "api/field_trials_view.h"
#include "api/units/time_delta.h"
#include "api/video/video_timing.h"
-#include "modules/video_coding/codec_timer.h"
+#include "modules/video_coding/timing/codec_timer.h"
#include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/thread_annotations.h"
@@ -126,7 +126,7 @@
Clock* const clock_;
const std::unique_ptr<TimestampExtrapolator> ts_extrapolator_
RTC_PT_GUARDED_BY(mutex_);
- std::unique_ptr<VCMCodecTimer> codec_timer_ RTC_GUARDED_BY(mutex_)
+ std::unique_ptr<CodecTimer> codec_timer_ RTC_GUARDED_BY(mutex_)
RTC_PT_GUARDED_BY(mutex_);
TimeDelta render_delay_ RTC_GUARDED_BY(mutex_);
// Best-effort playout delay range for frames from capture to render.
diff --git a/modules/video_coding/timing/BUILD.gn b/modules/video_coding/timing/BUILD.gn
new file mode 100644
index 0000000..0f7317d
--- /dev/null
+++ b/modules/video_coding/timing/BUILD.gn
@@ -0,0 +1,61 @@
+# Copyright (c) 2022 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("codec_timer") {
+ sources = [
+ "codec_timer.cc",
+ "codec_timer.h",
+ ]
+ deps = [ "../../../rtc_base:rtc_numerics" ]
+}
+
+rtc_library("inter_frame_delay") {
+ sources = [
+ "inter_frame_delay.cc",
+ "inter_frame_delay.h",
+ ]
+ deps = [
+ "../..:module_api_public",
+ "../../../api/units:frequency",
+ "../../../api/units:time_delta",
+ "../../../api/units:timestamp",
+ ]
+ absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+}
+
+rtc_library("rtt_filter") {
+ sources = [
+ "rtt_filter.cc",
+ "rtt_filter.h",
+ ]
+ deps = [ "../../../api/units:time_delta" ]
+ absl_deps = [
+ "//third_party/abseil-cpp/absl/algorithm:container",
+ "//third_party/abseil-cpp/absl/container:inlined_vector",
+ ]
+}
+
+rtc_library("timing_unittests") {
+ testonly = true
+ sources = [
+ "inter_frame_delay_unittest.cc",
+ "rtt_filter_unittest.cc",
+ ]
+ deps = [
+ ":inter_frame_delay",
+ ":rtt_filter",
+ "../../../api/units:frequency",
+ "../../../api/units:time_delta",
+ "../../../api/units:timestamp",
+ "../../../system_wrappers:system_wrappers",
+ "../../../test:test_support",
+ ]
+ absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
+}
diff --git a/modules/video_coding/codec_timer.cc b/modules/video_coding/timing/codec_timer.cc
similarity index 78%
rename from modules/video_coding/codec_timer.cc
rename to modules/video_coding/timing/codec_timer.cc
index b051957..f57d42d 100644
--- a/modules/video_coding/codec_timer.cc
+++ b/modules/video_coding/timing/codec_timer.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "modules/video_coding/codec_timer.h"
+#include "modules/video_coding/timing/codec_timer.h"
#include <cstdint>
@@ -25,11 +25,10 @@
} // anonymous namespace
-VCMCodecTimer::VCMCodecTimer()
- : ignored_sample_count_(0), filter_(kPercentile) {}
-VCMCodecTimer::~VCMCodecTimer() = default;
+CodecTimer::CodecTimer() : ignored_sample_count_(0), filter_(kPercentile) {}
+CodecTimer::~CodecTimer() = default;
-void VCMCodecTimer::AddTiming(int64_t decode_time_ms, int64_t now_ms) {
+void CodecTimer::AddTiming(int64_t decode_time_ms, int64_t now_ms) {
// Ignore the first `kIgnoredSampleCount` samples.
if (ignored_sample_count_ < kIgnoredSampleCount) {
++ignored_sample_count_;
@@ -49,11 +48,11 @@
}
// Get the 95th percentile observed decode time within a time window.
-int64_t VCMCodecTimer::RequiredDecodeTimeMs() const {
+int64_t CodecTimer::RequiredDecodeTimeMs() const {
return filter_.GetPercentileValue();
}
-VCMCodecTimer::Sample::Sample(int64_t decode_time_ms, int64_t sample_time_ms)
+CodecTimer::Sample::Sample(int64_t decode_time_ms, int64_t sample_time_ms)
: decode_time_ms(decode_time_ms), sample_time_ms(sample_time_ms) {}
} // namespace webrtc
diff --git a/modules/video_coding/codec_timer.h b/modules/video_coding/timing/codec_timer.h
similarity index 85%
rename from modules/video_coding/codec_timer.h
rename to modules/video_coding/timing/codec_timer.h
index 2948b82..9f12d82 100644
--- a/modules/video_coding/codec_timer.h
+++ b/modules/video_coding/timing/codec_timer.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef MODULES_VIDEO_CODING_CODEC_TIMER_H_
-#define MODULES_VIDEO_CODING_CODEC_TIMER_H_
+#ifndef MODULES_VIDEO_CODING_TIMING_CODEC_TIMER_H_
+#define MODULES_VIDEO_CODING_TIMING_CODEC_TIMER_H_
#include <queue>
@@ -17,10 +17,10 @@
namespace webrtc {
-class VCMCodecTimer {
+class CodecTimer {
public:
- VCMCodecTimer();
- ~VCMCodecTimer();
+ CodecTimer();
+ ~CodecTimer();
// Add a new decode time to the filter.
void AddTiming(int64_t new_decode_time_ms, int64_t now_ms);
@@ -47,4 +47,4 @@
} // namespace webrtc
-#endif // MODULES_VIDEO_CODING_CODEC_TIMER_H_
+#endif // MODULES_VIDEO_CODING_TIMING_CODEC_TIMER_H_
diff --git a/modules/video_coding/inter_frame_delay.cc b/modules/video_coding/timing/inter_frame_delay.cc
similarity index 91%
rename from modules/video_coding/inter_frame_delay.cc
rename to modules/video_coding/timing/inter_frame_delay.cc
index 8cdb664..bed9f87 100644
--- a/modules/video_coding/inter_frame_delay.cc
+++ b/modules/video_coding/timing/inter_frame_delay.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "modules/video_coding/inter_frame_delay.h"
+#include "modules/video_coding/timing/inter_frame_delay.h"
#include "absl/types/optional.h"
#include "api/units/frequency.h"
@@ -21,19 +21,19 @@
constexpr Frequency k90kHz = Frequency::KiloHertz(90);
}
-VCMInterFrameDelay::VCMInterFrameDelay() {
+InterFrameDelay::InterFrameDelay() {
Reset();
}
// Resets the delay estimate.
-void VCMInterFrameDelay::Reset() {
+void InterFrameDelay::Reset() {
prev_wall_clock_ = absl::nullopt;
prev_rtp_timestamp_unwrapped_ = 0;
}
// Calculates the delay of a frame with the given timestamp.
// This method is called when the frame is complete.
-absl::optional<TimeDelta> VCMInterFrameDelay::CalculateDelay(
+absl::optional<TimeDelta> InterFrameDelay::CalculateDelay(
uint32_t rtp_timestamp,
Timestamp now) {
int64_t rtp_timestamp_unwrapped = unwrapper_.Unwrap(rtp_timestamp);
diff --git a/modules/video_coding/inter_frame_delay.h b/modules/video_coding/timing/inter_frame_delay.h
similarity index 84%
rename from modules/video_coding/inter_frame_delay.h
rename to modules/video_coding/timing/inter_frame_delay.h
index e0fee6b..579a488 100644
--- a/modules/video_coding/inter_frame_delay.h
+++ b/modules/video_coding/timing/inter_frame_delay.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef MODULES_VIDEO_CODING_INTER_FRAME_DELAY_H_
-#define MODULES_VIDEO_CODING_INTER_FRAME_DELAY_H_
+#ifndef MODULES_VIDEO_CODING_TIMING_INTER_FRAME_DELAY_H_
+#define MODULES_VIDEO_CODING_TIMING_INTER_FRAME_DELAY_H_
#include <stdint.h>
@@ -20,9 +20,9 @@
namespace webrtc {
-class VCMInterFrameDelay {
+class InterFrameDelay {
public:
- VCMInterFrameDelay();
+ InterFrameDelay();
// Resets the estimate. Zeros are given as parameters.
void Reset();
@@ -43,4 +43,4 @@
} // namespace webrtc
-#endif // MODULES_VIDEO_CODING_INTER_FRAME_DELAY_H_
+#endif // MODULES_VIDEO_CODING_TIMING_INTER_FRAME_DELAY_H_
diff --git a/modules/video_coding/inter_frame_delay_unittest.cc b/modules/video_coding/timing/inter_frame_delay_unittest.cc
similarity index 95%
rename from modules/video_coding/inter_frame_delay_unittest.cc
rename to modules/video_coding/timing/inter_frame_delay_unittest.cc
index a338ba9..183b378 100644
--- a/modules/video_coding/inter_frame_delay_unittest.cc
+++ b/modules/video_coding/timing/inter_frame_delay_unittest.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "modules/video_coding/inter_frame_delay.h"
+#include "modules/video_coding/timing/inter_frame_delay.h"
#include <limits>
@@ -37,7 +37,7 @@
using ::testing::Optional;
TEST(InterFrameDelayTest, OldRtpTimestamp) {
- VCMInterFrameDelay inter_frame_delay;
+ InterFrameDelay inter_frame_delay;
EXPECT_THAT(inter_frame_delay.CalculateDelay(180000, kStartTime),
Optional(TimeDelta::Zero()));
EXPECT_THAT(inter_frame_delay.CalculateDelay(90000, kStartTime),
@@ -45,7 +45,7 @@
}
TEST(InterFrameDelayTest, NegativeWrapAroundIsSameAsOldRtpTimestamp) {
- VCMInterFrameDelay inter_frame_delay;
+ InterFrameDelay inter_frame_delay;
uint32_t rtp = 1500;
EXPECT_THAT(inter_frame_delay.CalculateDelay(rtp, kStartTime),
Optional(TimeDelta::Zero()));
@@ -56,7 +56,7 @@
}
TEST(InterFrameDelayTest, CorrectDelayForFrames) {
- VCMInterFrameDelay inter_frame_delay;
+ InterFrameDelay inter_frame_delay;
// Use a fake clock to simplify time keeping.
SimulatedClock clock(kStartTime);
@@ -99,7 +99,7 @@
}
TEST(InterFrameDelayTest, PositiveWrapAround) {
- VCMInterFrameDelay inter_frame_delay;
+ InterFrameDelay inter_frame_delay;
// Use a fake clock to simplify time keeping.
SimulatedClock clock(kStartTime);
@@ -123,7 +123,7 @@
constexpr uint32_t kHalfRtp = std::numeric_limits<uint32_t>::max() / 2;
constexpr TimeDelta kWrapAroundDelay = kHalfRtp / k90Khz;
- VCMInterFrameDelay inter_frame_delay;
+ InterFrameDelay inter_frame_delay;
// Use a fake clock to simplify time keeping.
SimulatedClock clock(kStartTime);
uint32_t rtp = 0;
@@ -165,7 +165,7 @@
}
TEST(InterFrameDelayTest, NegativeWrapAroundAfterPositiveWrapAround) {
- VCMInterFrameDelay inter_frame_delay;
+ InterFrameDelay inter_frame_delay;
// Use a fake clock to simplify time keeping.
SimulatedClock clock(kStartTime);
uint32_t rtp = std::numeric_limits<uint32_t>::max() - 1500;
diff --git a/modules/video_coding/rtt_filter.cc b/modules/video_coding/timing/rtt_filter.cc
similarity index 92%
rename from modules/video_coding/rtt_filter.cc
rename to modules/video_coding/timing/rtt_filter.cc
index eaf3b2b..6962224 100644
--- a/modules/video_coding/rtt_filter.cc
+++ b/modules/video_coding/timing/rtt_filter.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "modules/video_coding/rtt_filter.h"
+#include "modules/video_coding/timing/rtt_filter.h"
#include <math.h>
#include <stdlib.h>
@@ -31,7 +31,7 @@
} // namespace
-VCMRttFilter::VCMRttFilter()
+RttFilter::RttFilter()
: avg_rtt_(TimeDelta::Zero()),
var_rtt_(0),
max_rtt_(TimeDelta::Zero()),
@@ -40,7 +40,7 @@
Reset();
}
-void VCMRttFilter::Reset() {
+void RttFilter::Reset() {
got_non_zero_update_ = false;
avg_rtt_ = TimeDelta::Zero();
var_rtt_ = 0;
@@ -50,7 +50,7 @@
absl::c_fill(drift_buf_, TimeDelta::Zero());
}
-void VCMRttFilter::Update(TimeDelta rtt) {
+void RttFilter::Update(TimeDelta rtt) {
if (!got_non_zero_update_) {
if (rtt.IsZero()) {
return;
@@ -87,7 +87,7 @@
}
}
-bool VCMRttFilter::JumpDetection(TimeDelta rtt) {
+bool RttFilter::JumpDetection(TimeDelta rtt) {
TimeDelta diff_from_avg = avg_rtt_ - rtt;
// Unit of var_rtt_ is ms^2.
TimeDelta jump_threshold = TimeDelta::Millis(kJumpStddev * sqrt(var_rtt_));
@@ -121,7 +121,7 @@
return true;
}
-bool VCMRttFilter::DriftDetection(TimeDelta rtt) {
+bool RttFilter::DriftDetection(TimeDelta rtt) {
// Unit of sqrt of var_rtt_ is ms.
TimeDelta drift_threshold = TimeDelta::Millis(kDriftStdDev * sqrt(var_rtt_));
if (max_rtt_ - avg_rtt_ > drift_threshold) {
@@ -141,7 +141,7 @@
return true;
}
-void VCMRttFilter::ShortRttFilter(const BufferList& buf) {
+void RttFilter::ShortRttFilter(const BufferList& buf) {
RTC_DCHECK_EQ(buf.size(), kMaxDriftJumpCount);
max_rtt_ = TimeDelta::Zero();
avg_rtt_ = TimeDelta::Zero();
@@ -154,7 +154,7 @@
avg_rtt_ = avg_rtt_ / static_cast<double>(buf.size());
}
-TimeDelta VCMRttFilter::Rtt() const {
+TimeDelta RttFilter::Rtt() const {
return max_rtt_;
}
diff --git a/modules/video_coding/rtt_filter.h b/modules/video_coding/timing/rtt_filter.h
similarity index 87%
rename from modules/video_coding/rtt_filter.h
rename to modules/video_coding/timing/rtt_filter.h
index a611aaf..b8700b2 100644
--- a/modules/video_coding/rtt_filter.h
+++ b/modules/video_coding/timing/rtt_filter.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef MODULES_VIDEO_CODING_RTT_FILTER_H_
-#define MODULES_VIDEO_CODING_RTT_FILTER_H_
+#ifndef MODULES_VIDEO_CODING_TIMING_RTT_FILTER_H_
+#define MODULES_VIDEO_CODING_TIMING_RTT_FILTER_H_
#include <stdint.h>
@@ -18,11 +18,11 @@
namespace webrtc {
-class VCMRttFilter {
+class RttFilter {
public:
- VCMRttFilter();
- VCMRttFilter(const VCMRttFilter&) = delete;
- VCMRttFilter& operator=(const VCMRttFilter&) = delete;
+ RttFilter();
+ RttFilter(const RttFilter&) = delete;
+ RttFilter& operator=(const RttFilter&) = delete;
// Resets the filter.
void Reset();
@@ -66,4 +66,4 @@
} // namespace webrtc
-#endif // MODULES_VIDEO_CODING_RTT_FILTER_H_
+#endif // MODULES_VIDEO_CODING_TIMING_RTT_FILTER_H_
diff --git a/modules/video_coding/rtt_filter_unittest.cc b/modules/video_coding/timing/rtt_filter_unittest.cc
similarity index 94%
rename from modules/video_coding/rtt_filter_unittest.cc
rename to modules/video_coding/timing/rtt_filter_unittest.cc
index 15d7d66..05502e6 100644
--- a/modules/video_coding/rtt_filter_unittest.cc
+++ b/modules/video_coding/timing/rtt_filter_unittest.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "modules/video_coding/rtt_filter.h"
+#include "modules/video_coding/timing/rtt_filter.h"
#include "api/units/time_delta.h"
#include "test/gmock.h"
@@ -17,7 +17,7 @@
namespace webrtc {
TEST(RttFilterTest, RttIsCapped) {
- VCMRttFilter rtt_filter;
+ RttFilter rtt_filter;
rtt_filter.Update(TimeDelta::Seconds(500));
EXPECT_EQ(rtt_filter.Rtt(), TimeDelta::Seconds(3));
@@ -27,7 +27,7 @@
// then this is considered a jump. After more than 5 data points at the new
// level, the RTT is reset to the new level.
TEST(RttFilterTest, PositiveJumpDetection) {
- VCMRttFilter rtt_filter;
+ RttFilter rtt_filter;
rtt_filter.Update(TimeDelta::Millis(200));
rtt_filter.Update(TimeDelta::Millis(200));
@@ -46,7 +46,7 @@
}
TEST(RttFilterTest, NegativeJumpDetection) {
- VCMRttFilter rtt_filter;
+ RttFilter rtt_filter;
for (int i = 0; i < 10; ++i)
rtt_filter.Update(TimeDelta::Millis(1500));
@@ -64,7 +64,7 @@
}
TEST(RttFilterTest, JumpsResetByDirectionShift) {
- VCMRttFilter rtt_filter;
+ RttFilter rtt_filter;
for (int i = 0; i < 10; ++i)
rtt_filter.Update(TimeDelta::Millis(1500));
@@ -85,7 +85,7 @@
// then a drift is detected, and a short filter is applied to find a new max
// rtt.
TEST(RttFilterTest, DriftDetection) {
- VCMRttFilter rtt_filter;
+ RttFilter rtt_filter;
// Descend RTT by 30ms and settle at 700ms RTT. A drift is detected after rtt
// of 700ms is reported around 50 times for these targets.
diff --git a/video/BUILD.gn b/video/BUILD.gn
index f1adefa..1e462bb 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -103,13 +103,13 @@
"../modules/video_coding",
"../modules/video_coding:codec_globals_headers",
"../modules/video_coding:frame_helpers",
- "../modules/video_coding:inter_frame_delay",
"../modules/video_coding:jitter_estimator",
"../modules/video_coding:nack_requester",
"../modules/video_coding:packet_buffer",
"../modules/video_coding:timing",
"../modules/video_coding:video_codec_interface",
"../modules/video_coding:video_coding_utility",
+ "../modules/video_coding/timing:inter_frame_delay",
"../modules/video_processing",
"../rtc_base:atomicops",
"../rtc_base:checks",
@@ -351,6 +351,7 @@
"../modules/video_coding:frame_helpers",
"../modules/video_coding:timing",
"../modules/video_coding:video_codec_interface",
+ "../modules/video_coding/timing:inter_frame_delay",
"../rtc_base:checks",
"../rtc_base:logging",
"../rtc_base:macromagic",
diff --git a/video/frame_buffer_proxy.cc b/video/frame_buffer_proxy.cc
index 29eeef6..fb8d173 100644
--- a/video/frame_buffer_proxy.cc
+++ b/video/frame_buffer_proxy.cc
@@ -23,6 +23,7 @@
#include "api/video/video_content_type.h"
#include "modules/video_coding/frame_buffer2.h"
#include "modules/video_coding/frame_helpers.h"
+#include "modules/video_coding/timing/inter_frame_delay.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/thread_annotations.h"
@@ -501,8 +502,7 @@
VCMJitterEstimator jitter_estimator_
RTC_GUARDED_BY(&worker_sequence_checker_);
- VCMInterFrameDelay inter_frame_delay_
- RTC_GUARDED_BY(&worker_sequence_checker_);
+ InterFrameDelay inter_frame_delay_ RTC_GUARDED_BY(&worker_sequence_checker_);
bool keyframe_required_ RTC_GUARDED_BY(&worker_sequence_checker_) = false;
std::unique_ptr<FrameBuffer> buffer_
RTC_GUARDED_BY(&worker_sequence_checker_);
diff --git a/video/video_receive_stream2.cc b/video/video_receive_stream2.cc
index a6a5f3f..40abc13 100644
--- a/video/video_receive_stream2.cc
+++ b/video/video_receive_stream2.cc
@@ -46,7 +46,6 @@
#include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/include/video_coding_defines.h"
#include "modules/video_coding/include/video_error_codes.h"
-#include "modules/video_coding/inter_frame_delay.h"
#include "modules/video_coding/jitter_estimator.h"
#include "modules/video_coding/timing.h"
#include "modules/video_coding/utility/vp8_header_parser.h"