| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const unsigned int framerate, | 86 const unsigned int framerate, |
| 87 const unsigned int bitrate) override; | 87 const unsigned int bitrate) override; |
| 88 | 88 |
| 89 void SuspendChange(int video_channel, bool is_suspended) override; | 89 void SuspendChange(int video_channel, bool is_suspended) override; |
| 90 | 90 |
| 91 void SendSideDelayUpdated(int avg_delay_ms, | 91 void SendSideDelayUpdated(int avg_delay_ms, |
| 92 int max_delay_ms, | 92 int max_delay_ms, |
| 93 uint32_t ssrc) override; | 93 uint32_t ssrc) override; |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 struct SampleCounter { | 96 class SampleCounter { |
| 97 public: |
| 97 SampleCounter() : sum(0), num_samples(0) {} | 98 SampleCounter() : sum(0), num_samples(0) {} |
| 99 ~SampleCounter() {} |
| 98 void Add(int sample); | 100 void Add(int sample); |
| 99 int Avg(int min_required_samples) const; | 101 int Avg(int min_required_samples) const; |
| 100 | 102 |
| 101 private: | 103 private: |
| 102 int sum; | 104 int sum; |
| 103 int num_samples; | 105 int num_samples; |
| 104 }; | 106 }; |
| 107 class BoolSampleCounter { |
| 108 public: |
| 109 BoolSampleCounter() : sum(0), num_samples(0) {} |
| 110 ~BoolSampleCounter() {} |
| 111 void Add(bool sample); |
| 112 int Percent(int min_required_samples) const; |
| 113 |
| 114 private: |
| 115 int sum; |
| 116 int num_samples; |
| 117 }; |
| 105 struct StatsUpdateTimes { | 118 struct StatsUpdateTimes { |
| 106 StatsUpdateTimes() : resolution_update_ms(0) {} | 119 StatsUpdateTimes() : resolution_update_ms(0) {} |
| 107 int64_t resolution_update_ms; | 120 int64_t resolution_update_ms; |
| 108 int64_t bitrate_update_ms; | 121 int64_t bitrate_update_ms; |
| 109 }; | 122 }; |
| 110 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 123 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 111 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) | 124 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) |
| 112 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 125 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 113 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 126 void UpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 114 | 127 |
| 115 Clock* const clock_; | 128 Clock* const clock_; |
| 116 const VideoSendStream::Config config_; | 129 const VideoSendStream::Config config_; |
| 117 mutable rtc::CriticalSection crit_; | 130 mutable rtc::CriticalSection crit_; |
| 118 VideoSendStream::Stats stats_ GUARDED_BY(crit_); | 131 VideoSendStream::Stats stats_ GUARDED_BY(crit_); |
| 119 rtc::RateTracker input_frame_rate_tracker_ GUARDED_BY(crit_); | 132 rtc::RateTracker input_frame_rate_tracker_ GUARDED_BY(crit_); |
| 120 rtc::RateTracker input_frame_rate_tracker_total_ GUARDED_BY(crit_); | 133 rtc::RateTracker input_frame_rate_tracker_total_ GUARDED_BY(crit_); |
| 121 rtc::RateTracker sent_frame_rate_tracker_total_ GUARDED_BY(crit_); | 134 rtc::RateTracker sent_frame_rate_tracker_total_ GUARDED_BY(crit_); |
| 122 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); | 135 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); |
| 123 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_); | 136 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_); |
| 124 | 137 |
| 125 int max_sent_width_per_timestamp_ GUARDED_BY(crit_); | 138 int max_sent_width_per_timestamp_ GUARDED_BY(crit_); |
| 126 int max_sent_height_per_timestamp_ GUARDED_BY(crit_); | 139 int max_sent_height_per_timestamp_ GUARDED_BY(crit_); |
| 127 SampleCounter input_width_counter_ GUARDED_BY(crit_); | 140 SampleCounter input_width_counter_ GUARDED_BY(crit_); |
| 128 SampleCounter input_height_counter_ GUARDED_BY(crit_); | 141 SampleCounter input_height_counter_ GUARDED_BY(crit_); |
| 129 SampleCounter sent_width_counter_ GUARDED_BY(crit_); | 142 SampleCounter sent_width_counter_ GUARDED_BY(crit_); |
| 130 SampleCounter sent_height_counter_ GUARDED_BY(crit_); | 143 SampleCounter sent_height_counter_ GUARDED_BY(crit_); |
| 131 SampleCounter encode_time_counter_ GUARDED_BY(crit_); | 144 SampleCounter encode_time_counter_ GUARDED_BY(crit_); |
| 145 BoolSampleCounter bw_limited_frame_counter_ GUARDED_BY(crit_); |
| 146 SampleCounter bw_resolutions_disabled_counter_ GUARDED_BY(crit_); |
| 132 }; | 147 }; |
| 133 | 148 |
| 134 } // namespace webrtc | 149 } // namespace webrtc |
| 135 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ | 150 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
| OLD | NEW |