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

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: Fixed compile error 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 unified diff | Download patch
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/send_statistics_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 20 matching lines...) Expand all
31 public RtcpStatisticsCallback, 31 public RtcpStatisticsCallback,
32 public RtcpPacketTypeCounterObserver, 32 public RtcpPacketTypeCounterObserver,
33 public StreamDataCountersCallback, 33 public StreamDataCountersCallback,
34 public BitrateStatisticsObserver, 34 public BitrateStatisticsObserver,
35 public FrameCountObserver, 35 public FrameCountObserver,
36 public VideoEncoderRateObserver, 36 public VideoEncoderRateObserver,
37 public SendSideDelayObserver { 37 public SendSideDelayObserver {
38 public: 38 public:
39 static const int kStatsTimeoutMs; 39 static const int kStatsTimeoutMs;
40 40
41 SendStatisticsProxy(Clock* clock, const VideoSendStream::Config& config); 41 SendStatisticsProxy(Clock* clock,
42 const VideoSendStream::Config& config,
43 VideoEncoderConfig::ContentType content_type);
42 virtual ~SendStatisticsProxy(); 44 virtual ~SendStatisticsProxy();
43 45
44 VideoSendStream::Stats GetStats(); 46 VideoSendStream::Stats GetStats();
45 47
46 virtual void OnSendEncodedImage(const EncodedImage& encoded_image, 48 virtual void OnSendEncodedImage(const EncodedImage& encoded_image,
47 const RTPVideoHeader* rtp_video_header); 49 const RTPVideoHeader* rtp_video_header);
48 // Used to update incoming frame rate. 50 // Used to update incoming frame rate.
49 void OnIncomingFrame(int width, int height); 51 void OnIncomingFrame(int width, int height);
50 52
51 // Used to update encode time of frames. 53 // Used to update encode time of frames.
52 void OnEncodedFrame(int encode_time_ms); 54 void OnEncodedFrame(int encode_time_ms);
53 55
54 // From VideoEncoderRateObserver. 56 // From VideoEncoderRateObserver.
55 void OnSetRates(uint32_t bitrate_bps, int framerate) override; 57 void OnSetRates(uint32_t bitrate_bps, int framerate) override;
56 58
57 void OnOutgoingRate(uint32_t framerate, uint32_t bitrate); 59 void OnOutgoingRate(uint32_t framerate, uint32_t bitrate);
58 void OnSuspendChange(bool is_suspended); 60 void OnSuspendChange(bool is_suspended);
59 void OnInactiveSsrc(uint32_t ssrc); 61 void OnInactiveSsrc(uint32_t ssrc);
60 62
63 // Used to indicate change in content type, which may require a change in
64 // how stats are collected.
65 void SetContentType(VideoEncoderConfig::ContentType content_type);
66
61 protected: 67 protected:
62 // From CpuOveruseMetricsObserver. 68 // From CpuOveruseMetricsObserver.
63 void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) override; 69 void CpuOveruseMetricsUpdated(const CpuOveruseMetrics& metrics) override;
64 // From RtcpStatisticsCallback. 70 // From RtcpStatisticsCallback.
65 void StatisticsUpdated(const RtcpStatistics& statistics, 71 void StatisticsUpdated(const RtcpStatistics& statistics,
66 uint32_t ssrc) override; 72 uint32_t ssrc) override;
67 void CNameChanged(const char* cname, uint32_t ssrc) override; 73 void CNameChanged(const char* cname, uint32_t ssrc) override;
68 // From RtcpPacketTypeCounterObserver. 74 // From RtcpPacketTypeCounterObserver.
69 void RtcpPacketTypesCounterUpdated( 75 void RtcpPacketTypesCounterUpdated(
70 uint32_t ssrc, 76 uint32_t ssrc,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void Add(bool sample); 111 void Add(bool sample);
106 int Percent(int min_required_samples) const; 112 int Percent(int min_required_samples) const;
107 int Permille(int min_required_samples) const; 113 int Permille(int min_required_samples) const;
108 114
109 private: 115 private:
110 int Fraction(int min_required_samples, float multiplier) const; 116 int Fraction(int min_required_samples, float multiplier) const;
111 int sum; 117 int sum;
112 int num_samples; 118 int num_samples;
113 }; 119 };
114 struct StatsUpdateTimes { 120 struct StatsUpdateTimes {
115 StatsUpdateTimes() : resolution_update_ms(0) {} 121 StatsUpdateTimes() : resolution_update_ms(0), bitrate_update_ms(0) {}
116 int64_t resolution_update_ms; 122 int64_t resolution_update_ms;
117 int64_t bitrate_update_ms; 123 int64_t bitrate_update_ms;
118 }; 124 };
119 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); 125 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_);
120 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) 126 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc)
121 EXCLUSIVE_LOCKS_REQUIRED(crit_); 127 EXCLUSIVE_LOCKS_REQUIRED(crit_);
122 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_);
123 128
124 Clock* const clock_; 129 Clock* const clock_;
125 const VideoSendStream::Config config_; 130 const VideoSendStream::Config config_;
126 mutable rtc::CriticalSection crit_; 131 mutable rtc::CriticalSection crit_;
132 VideoEncoderConfig::ContentType content_type_ GUARDED_BY(crit_);
127 VideoSendStream::Stats stats_ GUARDED_BY(crit_); 133 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_); 134 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_);
131 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_); 135 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_);
132 136
133 int max_sent_width_per_timestamp_ GUARDED_BY(crit_); 137 // Contains stats used for UMA histograms. These stats will be reset if
134 int max_sent_height_per_timestamp_ GUARDED_BY(crit_); 138 // content type changes between real-time video and screenshare, since these
135 SampleCounter input_width_counter_ GUARDED_BY(crit_); 139 // will be reported separately.
136 SampleCounter input_height_counter_ GUARDED_BY(crit_); 140 struct UmaSamplesContainer {
137 SampleCounter sent_width_counter_ GUARDED_BY(crit_); 141 explicit UmaSamplesContainer(const char* prefix);
138 SampleCounter sent_height_counter_ GUARDED_BY(crit_); 142 ~UmaSamplesContainer();
139 SampleCounter encode_time_counter_ GUARDED_BY(crit_); 143
140 BoolSampleCounter key_frame_counter_ GUARDED_BY(crit_); 144 void UpdateHistograms();
141 BoolSampleCounter quality_limited_frame_counter_ GUARDED_BY(crit_); 145
142 SampleCounter quality_downscales_counter_ GUARDED_BY(crit_); 146 const std::string uma_prefix_;
143 BoolSampleCounter bw_limited_frame_counter_ GUARDED_BY(crit_); 147 int max_sent_width_per_timestamp_;
144 SampleCounter bw_resolutions_disabled_counter_ GUARDED_BY(crit_); 148 int max_sent_height_per_timestamp_;
145 SampleCounter delay_counter_ GUARDED_BY(crit_); 149 SampleCounter input_width_counter_;
146 SampleCounter max_delay_counter_ GUARDED_BY(crit_); 150 SampleCounter input_height_counter_;
151 SampleCounter sent_width_counter_;
152 SampleCounter sent_height_counter_;
153 SampleCounter encode_time_counter_;
154 BoolSampleCounter key_frame_counter_;
155 BoolSampleCounter quality_limited_frame_counter_;
156 SampleCounter quality_downscales_counter_;
157 BoolSampleCounter bw_limited_frame_counter_;
158 SampleCounter bw_resolutions_disabled_counter_;
159 SampleCounter delay_counter_;
160 SampleCounter max_delay_counter_;
161 rtc::RateTracker input_frame_rate_tracker_;
162 rtc::RateTracker sent_frame_rate_tracker_;
163 };
164
165 rtc::scoped_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_);
147 }; 166 };
148 167
149 } // namespace webrtc 168 } // namespace webrtc
150 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ 169 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_
OLDNEW
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/send_statistics_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698