OLD | NEW |
---|---|
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 private: | 89 private: |
90 struct SampleCounter { | 90 struct SampleCounter { |
91 SampleCounter() : sum(0), num_samples(0) {} | 91 SampleCounter() : sum(0), num_samples(0) {} |
92 void Add(int sample); | 92 void Add(int sample); |
93 int Avg(int min_required_samples) const; | 93 int Avg(int min_required_samples) const; |
94 | 94 |
95 private: | 95 private: |
96 int sum; | 96 int sum; |
97 int num_samples; | 97 int num_samples; |
98 }; | 98 }; |
99 struct BoolSampleCounter { | |
100 BoolSampleCounter() : sum(0), num_samples(0) {} | |
101 void Add(bool sample); | |
102 int Percent(int min_required_samples) const; | |
103 int Permille(int min_required_samples) const; | |
104 | |
105 private: | |
106 int Fraction(int min_required_samples, float multiplier) const; | |
pbos-webrtc
2015/09/28 13:50:12
denominator
| |
107 int sum; | |
108 int num_samples; | |
109 }; | |
99 struct StatsUpdateTimes { | 110 struct StatsUpdateTimes { |
100 StatsUpdateTimes() : resolution_update_ms(0) {} | 111 StatsUpdateTimes() : resolution_update_ms(0) {} |
101 int64_t resolution_update_ms; | 112 int64_t resolution_update_ms; |
102 int64_t bitrate_update_ms; | 113 int64_t bitrate_update_ms; |
103 }; | 114 }; |
104 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 115 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
105 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) | 116 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) |
106 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 117 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
107 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 118 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
108 | 119 |
109 Clock* const clock_; | 120 Clock* const clock_; |
110 const VideoSendStream::Config config_; | 121 const VideoSendStream::Config config_; |
111 mutable rtc::CriticalSection crit_; | 122 mutable rtc::CriticalSection crit_; |
112 VideoSendStream::Stats stats_ GUARDED_BY(crit_); | 123 VideoSendStream::Stats stats_ GUARDED_BY(crit_); |
113 rtc::RateTracker input_frame_rate_tracker_ GUARDED_BY(crit_); | 124 rtc::RateTracker input_frame_rate_tracker_ GUARDED_BY(crit_); |
114 rtc::RateTracker sent_frame_rate_tracker_ GUARDED_BY(crit_); | 125 rtc::RateTracker sent_frame_rate_tracker_ GUARDED_BY(crit_); |
115 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); | 126 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); |
116 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_); | 127 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_); |
117 | 128 |
118 int max_sent_width_per_timestamp_ GUARDED_BY(crit_); | 129 int max_sent_width_per_timestamp_ GUARDED_BY(crit_); |
119 int max_sent_height_per_timestamp_ GUARDED_BY(crit_); | 130 int max_sent_height_per_timestamp_ GUARDED_BY(crit_); |
120 SampleCounter input_width_counter_ GUARDED_BY(crit_); | 131 SampleCounter input_width_counter_ GUARDED_BY(crit_); |
121 SampleCounter input_height_counter_ GUARDED_BY(crit_); | 132 SampleCounter input_height_counter_ GUARDED_BY(crit_); |
122 SampleCounter sent_width_counter_ GUARDED_BY(crit_); | 133 SampleCounter sent_width_counter_ GUARDED_BY(crit_); |
123 SampleCounter sent_height_counter_ GUARDED_BY(crit_); | 134 SampleCounter sent_height_counter_ GUARDED_BY(crit_); |
124 SampleCounter encode_time_counter_ GUARDED_BY(crit_); | 135 SampleCounter encode_time_counter_ GUARDED_BY(crit_); |
136 BoolSampleCounter key_frame_counter_ GUARDED_BY(crit_); | |
125 }; | 137 }; |
126 | 138 |
127 } // namespace webrtc | 139 } // namespace webrtc |
128 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ | 140 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
OLD | NEW |