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

Unified Diff: webrtc/video/send_statistics_proxy.cc

Issue 1374673003: Move sent key frame stats to send_statistics_proxy class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 months 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/video/send_statistics_proxy.h ('k') | webrtc/video_engine/vie_encoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/send_statistics_proxy.cc
diff --git a/webrtc/video/send_statistics_proxy.cc b/webrtc/video/send_statistics_proxy.cc
index a95ade5d83cbd45abbf8bf700a4a04d410330373..84c755e9c8de221e22d3f91dae3785d64fadbd60 100644
--- a/webrtc/video/send_statistics_proxy.cc
+++ b/webrtc/video/send_statistics_proxy.cc
@@ -64,6 +64,12 @@ void SendStatisticsProxy::UpdateHistograms() {
int encode_ms = encode_time_counter_.Avg(kMinRequiredSamples);
if (encode_ms != -1)
RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.EncodeTimeInMs", encode_ms);
+
+ int key_frames_permille = key_frame_counter_.Permille(kMinRequiredSamples);
+ if (key_frames_permille != -1) {
+ RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.KeyFramesSentInPermille",
+ key_frames_permille);
+ }
}
void SendStatisticsProxy::OnOutgoingRate(uint32_t framerate, uint32_t bitrate) {
@@ -162,6 +168,9 @@ void SendStatisticsProxy::OnSendEncodedImage(
stats->height = encoded_image._encodedHeight;
update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds();
+ if (encoded_image._length > 0)
pbos-webrtc 2015/09/28 12:10:34 Can we make sure that ._length == 0 frames never r
åsapersson 2015/09/28 13:14:26 Used in upcoming bw stats CL. Changed check to be
+ key_frame_counter_.Add(encoded_image._frameType == kKeyFrame);
+
// TODO(asapersson): This is incorrect if simulcast layers are encoded on
// different threads and there is no guarantee that one frame of all layers
// are encoded before the next start.
@@ -273,4 +282,24 @@ int SendStatisticsProxy::SampleCounter::Avg(int min_required_samples) const {
return sum / num_samples;
}
+void SendStatisticsProxy::BoolSampleCounter::Add(bool sample) {
+ if (sample)
+ ++sum;
+ ++num_samples;
+}
+
+int SendStatisticsProxy::BoolSampleCounter::Percent(
pbos-webrtc 2015/09/28 12:10:34 Base on same function and call ThatFunction(min_re
åsapersson 2015/09/28 13:14:26 Done.
+ int min_required_samples) const {
+ if (num_samples < min_required_samples || num_samples == 0)
+ return -1;
+ return static_cast<int>((sum * 100.0f / num_samples) + 0.5f);
+}
+
+int SendStatisticsProxy::BoolSampleCounter::Permille(
+ int min_required_samples) const {
+ if (num_samples < min_required_samples || num_samples == 0)
+ return -1;
+ return static_cast<int>((sum * 1000.0f / num_samples) + 0.5f);
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | webrtc/video_engine/vie_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698