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

Side by Side 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 and update histograms on content type change Created 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Used to update encode time of frames. 51 // Used to update encode time of frames.
52 void OnEncodedFrame(int encode_time_ms); 52 void OnEncodedFrame(int encode_time_ms);
53 53
54 // From VideoEncoderRateObserver. 54 // From VideoEncoderRateObserver.
55 void OnSetRates(uint32_t bitrate_bps, int framerate) override; 55 void OnSetRates(uint32_t bitrate_bps, int framerate) override;
56 56
57 void OnOutgoingRate(uint32_t framerate, uint32_t bitrate); 57 void OnOutgoingRate(uint32_t framerate, uint32_t bitrate);
58 void OnSuspendChange(bool is_suspended); 58 void OnSuspendChange(bool is_suspended);
59 void OnInactiveSsrc(uint32_t ssrc); 59 void OnInactiveSsrc(uint32_t ssrc);
60 60
61 void SetCodecMode(VideoCodecMode mode);
62
61 protected: 63 protected:
62 // From CpuOveruseMetricsObserver. 64 // From CpuOveruseMetricsObserver.
63 void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) override; 65 void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) override;
64 // From RtcpStatisticsCallback. 66 // From RtcpStatisticsCallback.
65 void StatisticsUpdated(const RtcpStatistics& statistics, 67 void StatisticsUpdated(const RtcpStatistics& statistics,
66 uint32_t ssrc) override; 68 uint32_t ssrc) override;
67 void CNameChanged(const char* cname, uint32_t ssrc) override; 69 void CNameChanged(const char* cname, uint32_t ssrc) override;
68 // From RtcpPacketTypeCounterObserver. 70 // From RtcpPacketTypeCounterObserver.
69 void RtcpPacketTypesCounterUpdated( 71 void RtcpPacketTypesCounterUpdated(
70 uint32_t ssrc, 72 uint32_t ssrc,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void Add(bool sample); 107 void Add(bool sample);
106 int Percent(int min_required_samples) const; 108 int Percent(int min_required_samples) const;
107 int Permille(int min_required_samples) const; 109 int Permille(int min_required_samples) const;
108 110
109 private: 111 private:
110 int Fraction(int min_required_samples, float multiplier) const; 112 int Fraction(int min_required_samples, float multiplier) const;
111 int sum; 113 int sum;
112 int num_samples; 114 int num_samples;
113 }; 115 };
114 struct StatsUpdateTimes { 116 struct StatsUpdateTimes {
115 StatsUpdateTimes() : resolution_update_ms(0) {} 117 StatsUpdateTimes() : resolution_update_ms(0), bitrate_update_ms(0) {}
116 int64_t resolution_update_ms; 118 int64_t resolution_update_ms;
117 int64_t bitrate_update_ms; 119 int64_t bitrate_update_ms;
118 }; 120 };
119 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); 121 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_);
120 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) 122 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc)
121 EXCLUSIVE_LOCKS_REQUIRED(crit_); 123 EXCLUSIVE_LOCKS_REQUIRED(crit_);
122 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_);
123 124
124 Clock* const clock_; 125 Clock* const clock_;
125 const VideoSendStream::Config config_; 126 const VideoSendStream::Config config_;
127 VideoCodecMode codec_mode_ GUARDED_BY(crit_);
126 mutable rtc::CriticalSection crit_; 128 mutable rtc::CriticalSection crit_;
127 VideoSendStream::Stats stats_ GUARDED_BY(crit_); 129 VideoSendStream::Stats stats_ GUARDED_BY(crit_);
128 rtc::RateTracker input_frame_rate_tracker_ GUARDED_BY(crit_);
129 rtc::RateTracker sent_frame_rate_tracker_ GUARDED_BY(crit_);
130 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_);
131 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_);
132 130
133 int max_sent_width_per_timestamp_ GUARDED_BY(crit_); 131 struct StatsSet {
pbos-webrtc 2015/11/12 10:38:19 StatsSet sounds too generic, can you think of a na
sprang_webrtc 2015/11/12 11:01:25 Done.
134 int max_sent_height_per_timestamp_ GUARDED_BY(crit_); 132 explicit StatsSet(const char* prefix)
pbos-webrtc 2015/11/12 10:38:19 Put constructor in .cc file.
sprang_webrtc 2015/11/12 11:01:25 Done.
135 SampleCounter input_width_counter_ GUARDED_BY(crit_); 133 : kPrefix(prefix),
136 SampleCounter input_height_counter_ GUARDED_BY(crit_); 134 input_frame_rate_tracker_(100u, 10u),
137 SampleCounter sent_width_counter_ GUARDED_BY(crit_); 135 sent_frame_rate_tracker_(100u, 10u),
138 SampleCounter sent_height_counter_ GUARDED_BY(crit_); 136 last_sent_frame_timestamp_(0),
139 SampleCounter encode_time_counter_ GUARDED_BY(crit_); 137 max_sent_width_per_timestamp_(0),
140 BoolSampleCounter key_frame_counter_ GUARDED_BY(crit_); 138 max_sent_height_per_timestamp_(0) {}
141 BoolSampleCounter quality_limited_frame_counter_ GUARDED_BY(crit_); 139 const std::string kPrefix;
pbos-webrtc 2015/11/12 10:38:19 stats_prefix_, "const" doesn't make it a "kConstan
sprang_webrtc 2015/11/12 11:01:25 Done.
142 SampleCounter quality_downscales_counter_ GUARDED_BY(crit_); 140 rtc::RateTracker input_frame_rate_tracker_;
143 BoolSampleCounter bw_limited_frame_counter_ GUARDED_BY(crit_); 141 rtc::RateTracker sent_frame_rate_tracker_;
144 SampleCounter bw_resolutions_disabled_counter_ GUARDED_BY(crit_); 142 uint32_t last_sent_frame_timestamp_;
145 SampleCounter delay_counter_ GUARDED_BY(crit_); 143 std::map<uint32_t, StatsUpdateTimes> update_times_;
146 SampleCounter max_delay_counter_ GUARDED_BY(crit_); 144
145 int max_sent_width_per_timestamp_;
146 int max_sent_height_per_timestamp_;
147 SampleCounter input_width_counter_;
148 SampleCounter input_height_counter_;
149 SampleCounter sent_width_counter_;
150 SampleCounter sent_height_counter_;
151 SampleCounter encode_time_counter_;
152 BoolSampleCounter key_frame_counter_;
153 BoolSampleCounter quality_limited_frame_counter_;
154 SampleCounter quality_downscales_counter_;
155 BoolSampleCounter bw_limited_frame_counter_;
156 SampleCounter bw_resolutions_disabled_counter_;
157 SampleCounter delay_counter_;
158 SampleCounter max_delay_counter_;
159
160 void UpdateHistograms();
161 };
162
163 rtc::scoped_ptr<StatsSet> stats_set_ GUARDED_BY(crit_);
pbos-webrtc 2015/11/12 10:38:19 Since this doesn't rely on a destructor being call
sprang_webrtc 2015/11/12 11:01:25 Ugh, that would mean I have to add copy assignment
pbos-webrtc 2015/11/12 11:09:40 They're not copy-constructible by default?
sprang_webrtc 2015/11/12 13:32:06 Nope. :(
147 }; 164 };
148 165
149 } // namespace webrtc 166 } // namespace webrtc
150 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ 167 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/send_statistics_proxy.cc » ('j') | webrtc/video/send_statistics_proxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698