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..a2b840eff61d05d6e85a11516de463b26735d10e 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, |
+ VideoEncoderConfig::ContentType content_type); |
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,51 @@ 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); |
+ ~UmaSamplesContainer(); |
+ |
+ 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 |