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

Unified Diff: webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc

Issue 1734793003: Add stats (histograms) for vp8 screenshare layers (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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
Index: webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc
diff --git a/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc b/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc
index 2480a502e8e02ed92ce79fbfa1f0c51b86b4a5cb..6935c118aa2044e55643633ca2ca98b0bd716937 100644
--- a/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc
+++ b/webrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc
@@ -17,6 +17,8 @@
#include "vpx/vpx_encoder.h"
#include "vpx/vp8cx.h"
#include "webrtc/modules/video_coding/include/video_codec_interface.h"
+#include "webrtc/system_wrappers/include/clock.h"
+#include "webrtc/system_wrappers/include/metrics.h"
namespace webrtc {
@@ -46,8 +48,10 @@ const int ScreenshareLayers::kTl1SyncFlags =
VP8_EFLAG_NO_UPD_LAST;
ScreenshareLayers::ScreenshareLayers(int num_temporal_layers,
- uint8_t initial_tl0_pic_idx)
- : number_of_temporal_layers_(num_temporal_layers),
+ uint8_t initial_tl0_pic_idx,
+ Clock* clock)
+ : clock_(clock),
+ number_of_temporal_layers_(num_temporal_layers),
last_base_layer_sync_(false),
tl0_pic_idx_(initial_tl0_pic_idx),
active_layer_(-1),
@@ -61,6 +65,10 @@ ScreenshareLayers::ScreenshareLayers(int num_temporal_layers,
RTC_CHECK_LE(num_temporal_layers, 2);
}
+ScreenshareLayers::~ScreenshareLayers() {
+ UpdateHistograms();
+}
+
int ScreenshareLayers::CurrentLayerId() const {
// Codec does not use temporal layers for screenshare.
return 0;
@@ -72,6 +80,9 @@ int ScreenshareLayers::EncodeFlags(uint32_t timestamp) {
return 0;
}
+ if (stats_.first_framt_time_ms_ == -1)
stefan-webrtc 2016/02/29 09:10:18 first_frame_time_ms_
sprang_webrtc 2016/02/29 12:43:17 Done.
+ stats_.first_framt_time_ms_ = clock_->TimeInMilliseconds();
+
int64_t unwrapped_timestamp = time_wrap_handler_.Unwrap(timestamp);
int flags = 0;
@@ -104,6 +115,7 @@ int ScreenshareLayers::EncodeFlags(uint32_t timestamp) {
break;
case -1:
flags = -1;
+ ++stats_.num_dropped_frames_;
break;
default:
flags = -1;
@@ -176,6 +188,7 @@ void ScreenshareLayers::FrameEncoded(unsigned int size,
RTC_DCHECK_NE(-1, active_layer_);
if (size == 0) {
layers_[active_layer_].state = TemporalLayer::State::kDropped;
+ ++stats_.num_overshoots_;
return;
}
@@ -189,8 +202,14 @@ void ScreenshareLayers::FrameEncoded(unsigned int size,
if (active_layer_ == 0) {
layers_[0].debt_bytes_ += size;
layers_[1].debt_bytes_ += size;
+ ++stats_.num_tl0_frames_;
+ stats_.tl0_target_bitrate_sum_ += layers_[0].target_rate_kbps_;
+ stats_.tl0_qp_sum_ += qp;
} else if (active_layer_ == 1) {
layers_[1].debt_bytes_ += size;
+ ++stats_.num_tl1_frames_;
+ stats_.tl1_target_bitrate_sum_ += layers_[1].target_rate_kbps_;
+ stats_.tl1_qp_sum_ += qp;
}
}
@@ -283,4 +302,43 @@ void ScreenshareLayers::TemporalLayer::UpdateDebt(int64_t delta_ms) {
}
}
+void ScreenshareLayers::UpdateHistograms() {
+ if (stats_.first_framt_time_ms_ == -1)
+ return;
+ int64_t duration_sec =
+ (clock_->TimeInMilliseconds() - stats_.first_framt_time_ms_ + 500) / 1000;
+ if (duration_sec >= metrics::kMinRunTimeInSeconds) {
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.Screenshare.FrameRateLayer0",
+ (stats_.num_tl0_frames_ + (duration_sec / 2)) / duration_sec);
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.Screenshare.FrameRateLayer1",
+ (stats_.num_tl1_frames_ + (duration_sec / 2)) / duration_sec);
stefan-webrtc 2016/02/29 09:10:18 Should this report tl0+tl1 instead, since that's t
sprang_webrtc 2016/02/29 12:43:17 I think I'd rather keep them separate. The total f
stefan-webrtc 2016/02/29 15:04:51 ack
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.Screenshare.FramesPerDrop",
+ stats_.num_dropped_frames_ == 0 ? 0 : (stats_.num_tl0_frames_ +
+ stats_.num_tl1_frames_) /
+ stats_.num_dropped_frames_);
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.Screenshare.FramesPerOvershoot",
+ stats_.num_overshoots_ == 0 ? 0 : (stats_.num_tl0_frames_ +
+ stats_.num_tl1_frames_) /
+ stats_.num_overshoots_);
+ if (stats_.num_tl0_frames_ > 0) {
+ RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.Screenshare.AverageQpLayer0",
+ stats_.tl0_qp_sum_ / stats_.num_tl0_frames_);
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.Screenshare.TargetBitrateLayer0",
+ stats_.tl0_target_bitrate_sum_ / stats_.num_tl0_frames_);
+ }
+ if (stats_.num_tl1_frames_ > 0) {
+ RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.Screenshare.AverageQpLayer1",
+ stats_.tl1_qp_sum_ / stats_.num_tl1_frames_);
+ RTC_HISTOGRAM_COUNTS_10000(
+ "WebRTC.Video.Screenshare.TargetBitrateLayer1",
+ stats_.tl1_target_bitrate_sum_ / stats_.num_tl1_frames_);
+ }
+ }
+}
+
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698