Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1385)

Unified Diff: webrtc/modules/video_coding/frame_buffer2.cc

Issue 2522493002: Now run EndToEndTest with the WebRTC-NewVideoJitterBuffer experiment. (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2.h ('k') | webrtc/modules/video_coding/frame_object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/frame_buffer2.cc
diff --git a/webrtc/modules/video_coding/frame_buffer2.cc b/webrtc/modules/video_coding/frame_buffer2.cc
index e02e5b6071c14bcb72567d0a43600ae6959b68c3..bf1760ec279052482152c602ec3b6e0d21db7653 100644
--- a/webrtc/modules/video_coding/frame_buffer2.cc
+++ b/webrtc/modules/video_coding/frame_buffer2.cc
@@ -19,6 +19,7 @@
#include "webrtc/modules/video_coding/jitter_estimator.h"
#include "webrtc/modules/video_coding/timing.h"
#include "webrtc/system_wrappers/include/clock.h"
+#include "webrtc/system_wrappers/include/metrics.h"
namespace webrtc {
namespace video_coding {
@@ -44,7 +45,13 @@ FrameBuffer::FrameBuffer(Clock* clock,
num_frames_history_(0),
num_frames_buffered_(0),
stopped_(false),
- protection_mode_(kProtectionNack) {}
+ protection_mode_(kProtectionNack),
+ num_total_frames_(0),
+ num_key_frames_(0) {}
+
+FrameBuffer::~FrameBuffer() {
+ UpdateHistograms();
+}
FrameBuffer::ReturnReason FrameBuffer::NextFrame(
int64_t max_wait_time_ms,
@@ -155,6 +162,10 @@ int FrameBuffer::InsertFrame(std::unique_ptr<FrameObject> frame) {
rtc::CritScope lock(&crit_);
RTC_DCHECK(frame);
+ ++num_total_frames_;
+ if (frame->num_references == 0)
+ ++num_key_frames_;
+
FrameKey key(frame->picture_id, frame->spatial_layer);
int last_continuous_picture_id =
last_continuous_frame_it_ == frames_.end()
@@ -353,5 +364,16 @@ bool FrameBuffer::UpdateFrameInfoWithIncomingFrame(const FrameObject& frame,
return true;
}
+void FrameBuffer::UpdateHistograms() const {
+ rtc::CritScope lock(&crit_);
+ if (num_total_frames_ > 0) {
+ int key_frames_permille = (static_cast<float>(num_key_frames_) * 1000.0f /
+ static_cast<float>(num_total_frames_) +
+ 0.5f);
+ RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.KeyFramesReceivedInPermille",
+ key_frames_permille);
+ }
+}
+
} // namespace video_coding
} // namespace webrtc
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2.h ('k') | webrtc/modules/video_coding/frame_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698