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

Unified Diff: webrtc/video/send_statistics_proxy.h

Issue 1433393002: Add separate send-side UMA stats for screenshare and video. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Reset stats in stats_proxy, donstream Created 5 years 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/video/send_statistics_proxy.h
diff --git a/webrtc/video/send_statistics_proxy.h b/webrtc/video/send_statistics_proxy.h
index 7209094fe68a70342de60992ea2acc6e4528ef47..7a59aea2db700a482ec0dcc3cd9d18126fa09a06 100644
--- a/webrtc/video/send_statistics_proxy.h
+++ b/webrtc/video/send_statistics_proxy.h
@@ -38,7 +38,9 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver,
public:
static const int kStatsTimeoutMs;
- SendStatisticsProxy(Clock* clock, const VideoSendStream::Config& config);
+ SendStatisticsProxy(Clock* clock,
+ const VideoSendStream::Config& config,
+ const VideoEncoderConfig& encoder_config);
mflodman 2015/12/02 14:07:54 I'd prefer VideoEncoderConfig::ContentType instead
sprang_webrtc 2015/12/03 10:26:30 Done.
virtual ~SendStatisticsProxy();
VideoSendStream::Stats GetStats();
@@ -58,6 +60,10 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver,
void OnSuspendChange(bool is_suspended);
void OnInactiveSsrc(uint32_t ssrc);
+ // Used to indicate change in content type, which may require a change in
+ // how stats are collected.
+ void SetContentType(VideoEncoderConfig::ContentType content_type);
+
protected:
// From CpuOveruseMetricsObserver.
void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) override;
@@ -112,38 +118,50 @@ class SendStatisticsProxy : public CpuOveruseMetricsObserver,
int num_samples;
};
struct StatsUpdateTimes {
- StatsUpdateTimes() : resolution_update_ms(0) {}
+ StatsUpdateTimes() : resolution_update_ms(0), bitrate_update_ms(0) {}
int64_t resolution_update_ms;
int64_t bitrate_update_ms;
};
void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_);
VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc)
EXCLUSIVE_LOCKS_REQUIRED(crit_);
- void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_);
Clock* const clock_;
const VideoSendStream::Config config_;
mutable rtc::CriticalSection crit_;
+ VideoEncoderConfig::ContentType content_type_ GUARDED_BY(crit_);
VideoSendStream::Stats stats_ GUARDED_BY(crit_);
- rtc::RateTracker input_frame_rate_tracker_ GUARDED_BY(crit_);
- rtc::RateTracker sent_frame_rate_tracker_ GUARDED_BY(crit_);
uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_);
std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_);
- int max_sent_width_per_timestamp_ GUARDED_BY(crit_);
- int max_sent_height_per_timestamp_ GUARDED_BY(crit_);
- SampleCounter input_width_counter_ GUARDED_BY(crit_);
- SampleCounter input_height_counter_ GUARDED_BY(crit_);
- SampleCounter sent_width_counter_ GUARDED_BY(crit_);
- SampleCounter sent_height_counter_ GUARDED_BY(crit_);
- SampleCounter encode_time_counter_ GUARDED_BY(crit_);
- BoolSampleCounter key_frame_counter_ GUARDED_BY(crit_);
- BoolSampleCounter quality_limited_frame_counter_ GUARDED_BY(crit_);
- SampleCounter quality_downscales_counter_ GUARDED_BY(crit_);
- BoolSampleCounter bw_limited_frame_counter_ GUARDED_BY(crit_);
- SampleCounter bw_resolutions_disabled_counter_ GUARDED_BY(crit_);
- SampleCounter delay_counter_ GUARDED_BY(crit_);
- SampleCounter max_delay_counter_ GUARDED_BY(crit_);
+ // Contains stats used for UMA histograms. These stats will be reset if
+ // content type changes between real-time video and screenshare, since these
+ // will be reported separately.
+ struct UmaSamplesContainer {
+ explicit UmaSamplesContainer(const char* prefix);
+
+ void UpdateHistograms();
+
+ const std::string uma_prefix_;
+ int max_sent_width_per_timestamp_;
+ int max_sent_height_per_timestamp_;
+ SampleCounter input_width_counter_;
+ SampleCounter input_height_counter_;
+ SampleCounter sent_width_counter_;
+ SampleCounter sent_height_counter_;
+ SampleCounter encode_time_counter_;
+ BoolSampleCounter key_frame_counter_;
+ BoolSampleCounter quality_limited_frame_counter_;
+ SampleCounter quality_downscales_counter_;
+ BoolSampleCounter bw_limited_frame_counter_;
+ SampleCounter bw_resolutions_disabled_counter_;
+ SampleCounter delay_counter_;
+ SampleCounter max_delay_counter_;
+ rtc::RateTracker input_frame_rate_tracker_;
+ rtc::RateTracker sent_frame_rate_tracker_;
+ };
+
+ rtc::scoped_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_);
};
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698