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}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
60c67c6377
commit
2377226851
@ -223,6 +223,7 @@ if (rtc_include_tests && !build_with_chromium) {
|
||||
"rtp_rtcp:rtp_rtcp_unittests",
|
||||
"utility:utility_unittests",
|
||||
"video_coding:video_coding_unittests",
|
||||
"video_coding/timing:timing_unittests",
|
||||
"video_processing:video_processing_unittests",
|
||||
]
|
||||
|
||||
|
||||
@ -164,8 +164,6 @@ rtc_library("frame_helpers") {
|
||||
|
||||
rtc_library("timing") {
|
||||
sources = [
|
||||
"codec_timer.cc",
|
||||
"codec_timer.h",
|
||||
"timing.cc",
|
||||
"timing.h",
|
||||
]
|
||||
@ -180,29 +178,17 @@ rtc_library("timing") {
|
||||
"../../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_library("jitter_estimator") {
|
||||
"../../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 @@ rtc_library("video_coding") {
|
||||
":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 @@ rtc_library("video_coding") {
|
||||
"../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 @@ rtc_library("video_coding_legacy") {
|
||||
deps = [
|
||||
":codec_globals_headers",
|
||||
":encoded_frame",
|
||||
":inter_frame_delay",
|
||||
":jitter_estimator",
|
||||
":timing",
|
||||
":video_codec_interface",
|
||||
@ -436,6 +408,7 @@ rtc_library("video_coding_legacy") {
|
||||
"../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 @@ if (rtc_include_tests) {
|
||||
"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 @@ if (rtc_include_tests) {
|
||||
"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 @@ if (rtc_include_tests) {
|
||||
":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",
|
||||
|
||||
@ -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 @@ class FrameBuffer {
|
||||
|
||||
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_);
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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 @@ class VCMJitterBuffer {
|
||||
// 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).
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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 @@ class VCMJitterEstimator {
|
||||
// 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_;
|
||||
|
||||
@ -30,7 +30,7 @@ VCMTiming::VCMTiming(Clock* clock, const FieldTrialsView& field_trials)
|
||||
: 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 @@ VCMTiming::VCMTiming(Clock* clock, const FieldTrialsView& field_trials)
|
||||
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();
|
||||
|
||||
@ -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 @@ class VCMTiming {
|
||||
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.
|
||||
|
||||
61
modules/video_coding/timing/BUILD.gn
Normal file
61
modules/video_coding/timing/BUILD.gn
Normal file
@ -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" ]
|
||||
}
|
||||
@ -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 @@ const int64_t kTimeLimitMs = 10000;
|
||||
|
||||
} // 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 @@ void VCMCodecTimer::AddTiming(int64_t decode_time_ms, int64_t now_ms) {
|
||||
}
|
||||
|
||||
// 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
|
||||
@ -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 @@ class VCMCodecTimer {
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_CODEC_TIMER_H_
|
||||
#endif // MODULES_VIDEO_CODING_TIMING_CODEC_TIMER_H_
|
||||
@ -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 @@ namespace {
|
||||
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);
|
||||
@ -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 @@ class VCMInterFrameDelay {
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_INTER_FRAME_DELAY_H_
|
||||
#endif // MODULES_VIDEO_CODING_TIMING_INTER_FRAME_DELAY_H_
|
||||
@ -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::Eq;
|
||||
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, OldRtpTimestamp) {
|
||||
}
|
||||
|
||||
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, NegativeWrapAroundIsSameAsOldRtpTimestamp) {
|
||||
}
|
||||
|
||||
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, CorrectDelayForFrames) {
|
||||
}
|
||||
|
||||
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 @@ TEST(InterFrameDelayTest, MultipleWrapArounds) {
|
||||
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, MultipleWrapArounds) {
|
||||
}
|
||||
|
||||
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;
|
||||
@ -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 @@ constexpr double kDriftStdDev = 3.5;
|
||||
|
||||
} // namespace
|
||||
|
||||
VCMRttFilter::VCMRttFilter()
|
||||
RttFilter::RttFilter()
|
||||
: avg_rtt_(TimeDelta::Zero()),
|
||||
var_rtt_(0),
|
||||
max_rtt_(TimeDelta::Zero()),
|
||||
@ -40,7 +40,7 @@ VCMRttFilter::VCMRttFilter()
|
||||
Reset();
|
||||
}
|
||||
|
||||
void VCMRttFilter::Reset() {
|
||||
void RttFilter::Reset() {
|
||||
got_non_zero_update_ = false;
|
||||
avg_rtt_ = TimeDelta::Zero();
|
||||
var_rtt_ = 0;
|
||||
@ -50,7 +50,7 @@ void VCMRttFilter::Reset() {
|
||||
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 @@ void VCMRttFilter::Update(TimeDelta rtt) {
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ bool VCMRttFilter::JumpDetection(TimeDelta rtt) {
|
||||
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 @@ bool VCMRttFilter::DriftDetection(TimeDelta rtt) {
|
||||
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 @@ void VCMRttFilter::ShortRttFilter(const BufferList& buf) {
|
||||
avg_rtt_ = avg_rtt_ / static_cast<double>(buf.size());
|
||||
}
|
||||
|
||||
TimeDelta VCMRttFilter::Rtt() const {
|
||||
TimeDelta RttFilter::Rtt() const {
|
||||
return max_rtt_;
|
||||
}
|
||||
|
||||
@ -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 @@ class VCMRttFilter {
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // MODULES_VIDEO_CODING_RTT_FILTER_H_
|
||||
#endif // MODULES_VIDEO_CODING_TIMING_RTT_FILTER_H_
|
||||
@ -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 @@ TEST(RttFilterTest, RttIsCapped) {
|
||||
// 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, PositiveJumpDetection) {
|
||||
}
|
||||
|
||||
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, NegativeJumpDetection) {
|
||||
}
|
||||
|
||||
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 @@ TEST(RttFilterTest, JumpsResetByDirectionShift) {
|
||||
// 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.
|
||||
@ -103,13 +103,13 @@ rtc_library("video") {
|
||||
"../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 @@ rtc_library("frame_buffer_proxy") {
|
||||
"../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",
|
||||
|
||||
@ -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 @@ class FrameBuffer3Proxy : public FrameBufferProxy {
|
||||
|
||||
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_);
|
||||
|
||||
@ -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"
|
||||
|
||||
Reference in New Issue
Block a user