Move ownership of VCMJitterEstimator to FrameBuffer

Bug: webrtc:7408
Change-Id: I8b33ead80abff1e84ae0b223e108266f71f03e2f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/134180
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27823}
This commit is contained in:
Niels Möller
2019-04-30 09:16:36 +02:00
committed by Commit Bot
parent b93c4e622f
commit d9c2d94620
8 changed files with 12 additions and 28 deletions

View File

@ -49,13 +49,12 @@ constexpr int64_t kLogNonDecodedIntervalMs = 5000;
} // namespace
FrameBuffer::FrameBuffer(Clock* clock,
VCMJitterEstimator* jitter_estimator,
VCMTiming* timing,
VCMReceiveStatisticsCallback* stats_callback)
: decoded_frames_history_(kMaxFramesHistory),
clock_(clock),
callback_queue_(nullptr),
jitter_estimator_(jitter_estimator),
jitter_estimator_(clock),
timing_(timing),
inter_frame_delay_(clock_->TimeInMilliseconds()),
stopped_(false),
@ -266,7 +265,7 @@ EncodedFrame* FrameBuffer::GetNextFrame() {
int64_t receive_time_ms = first_frame->ReceivedTime();
// Gracefully handle bad RTP timestamps and render time issues.
if (HasBadRenderTiming(*first_frame, now_ms)) {
jitter_estimator_->Reset();
jitter_estimator_.Reset();
timing_->Reset();
render_time_ms = timing_->RenderTimeMs(first_frame->Timestamp(), now_ms);
}
@ -295,7 +294,7 @@ EncodedFrame* FrameBuffer::GetNextFrame() {
if (inter_frame_delay_.CalculateDelay(first_frame->Timestamp(),
&frame_delay, receive_time_ms)) {
jitter_estimator_->UpdateEstimate(frame_delay, superframe_size);
jitter_estimator_.UpdateEstimate(frame_delay, superframe_size);
}
float rtt_mult = protection_mode_ == kProtectionNackFEC ? 0.0 : 1.0;
@ -306,11 +305,11 @@ EncodedFrame* FrameBuffer::GetNextFrame() {
jitter_est_cap_ms = 300.0;
}
timing_->SetJitterDelay(
jitter_estimator_->GetJitterEstimate(rtt_mult, jitter_est_cap_ms));
jitter_estimator_.GetJitterEstimate(rtt_mult, jitter_est_cap_ms));
timing_->UpdateCurrentDelay(render_time_ms, now_ms);
} else {
if (RttMultExperiment::RttMultEnabled() || add_rtt_to_playout_delay_)
jitter_estimator_->FrameNacked();
jitter_estimator_.FrameNacked();
}
UpdateJitterDelay();
@ -378,7 +377,7 @@ void FrameBuffer::Clear() {
void FrameBuffer::UpdateRtt(int64_t rtt_ms) {
rtc::CritScope lock(&crit_);
jitter_estimator_->UpdateRtt(rtt_ms);
jitter_estimator_.UpdateRtt(rtt_ms);
}
bool FrameBuffer::ValidReferences(const EncodedFrame& frame) const {

View File

@ -21,6 +21,7 @@
#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/utility/decoded_frames_history.h"
#include "rtc_base/constructor_magic.h"
#include "rtc_base/critical_section.h"
@ -45,7 +46,6 @@ class FrameBuffer {
enum ReturnReason { kFrameFound, kTimeout, kStopped };
FrameBuffer(Clock* clock,
VCMJitterEstimator* jitter_estimator,
VCMTiming* timing,
VCMReceiveStatisticsCallback* stats_callback);
@ -182,7 +182,7 @@ class FrameBuffer {
bool keyframe_required_ RTC_GUARDED_BY(crit_);
rtc::Event new_continuous_frame_event_;
VCMJitterEstimator* const jitter_estimator_ RTC_GUARDED_BY(crit_);
VCMJitterEstimator jitter_estimator_ RTC_GUARDED_BY(crit_);
VCMTiming* const timing_ RTC_GUARDED_BY(crit_);
VCMInterFrameDelay inter_frame_delay_ RTC_GUARDED_BY(crit_);
absl::optional<VideoLayerFrameId> last_continuous_frame_

View File

@ -138,9 +138,7 @@ class TestFrameBuffer2 : public ::testing::Test {
: trial_("WebRTC-AddRttToPlayoutDelay/Enabled/"),
clock_(0),
timing_(&clock_),
jitter_estimator_(&clock_),
buffer_(new FrameBuffer(&clock_,
&jitter_estimator_,
&timing_,
&stats_callback_)),
rand_(0x34678213),
@ -266,7 +264,6 @@ class TestFrameBuffer2 : public ::testing::Test {
test::ScopedFieldTrials trial_;
SimulatedClock clock_;
VCMTimingFake timing_;
VCMJitterEstimator jitter_estimator_;
std::unique_ptr<FrameBuffer> buffer_;
std::vector<std::unique_ptr<EncodedFrame>> frames_;
Random rand_;
@ -306,8 +303,7 @@ TEST_F(TestFrameBuffer2, OneSuperFrame) {
TEST_F(TestFrameBuffer2, ZeroPlayoutDelay) {
VCMTiming timing(&clock_);
buffer_.reset(
new FrameBuffer(&clock_, &jitter_estimator_, &timing, &stats_callback_));
buffer_.reset(new FrameBuffer(&clock_, &timing, &stats_callback_));
const PlayoutDelay kPlayoutDelayMs = {0, 0};
std::unique_ptr<FrameObjectFake> test_frame(new FrameObjectFake());
test_frame->id.picture_id = 0;