Calculate JitterBufferDelayInMs in the new jitter buffer.
JitterBufferDelayInMs is used for the WebRTC-NewVideoJitterBuffer finch
experiment, and therefore needs to be calculated.
BUG=webrtc:5514
Review-Url: https://codereview.webrtc.org/2534093003
Cr-Commit-Position: refs/heads/master@{#15313}
diff --git a/webrtc/modules/video_coding/frame_buffer2.cc b/webrtc/modules/video_coding/frame_buffer2.cc
index bf1760e..279c613 100644
--- a/webrtc/modules/video_coding/frame_buffer2.cc
+++ b/webrtc/modules/video_coding/frame_buffer2.cc
@@ -45,9 +45,7 @@
num_frames_history_(0),
num_frames_buffered_(0),
stopped_(false),
- protection_mode_(kProtectionNack),
- num_total_frames_(0),
- num_key_frames_(0) {}
+ protection_mode_(kProtectionNack) {}
FrameBuffer::~FrameBuffer() {
UpdateHistograms();
@@ -133,6 +131,8 @@
timing_->UpdateCurrentDelay(frame->RenderTime(),
clock_->TimeInMilliseconds());
+ UpdateJitterDelay();
+
PropagateDecodability(next_frame_it->second);
AdvanceLastDecodedFrame(next_frame_it);
*frame_out = std::move(frame);
@@ -364,6 +364,16 @@
return true;
}
+void FrameBuffer::UpdateJitterDelay() {
+ int unused;
+ int delay;
+ timing_->GetTimings(&unused, &unused, &unused, &unused, &delay, &unused,
+ &unused);
+
+ accumulated_delay_ += delay;
+ ++accumulated_delay_samples_;
+}
+
void FrameBuffer::UpdateHistograms() const {
rtc::CritScope lock(&crit_);
if (num_total_frames_ > 0) {
@@ -373,6 +383,11 @@
RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.KeyFramesReceivedInPermille",
key_frames_permille);
}
+
+ if (accumulated_delay_samples_ > 0) {
+ RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.JitterBufferDelayInMs",
+ accumulated_delay_ / accumulated_delay_samples_);
+ }
}
} // namespace video_coding