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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 VideoEncoderConfig::ContentType content_type); | 50 VideoEncoderConfig::ContentType content_type); |
51 virtual ~SendStatisticsProxy(); | 51 virtual ~SendStatisticsProxy(); |
52 | 52 |
53 virtual VideoSendStream::Stats GetStats(); | 53 virtual VideoSendStream::Stats GetStats(); |
54 | 54 |
55 virtual void OnSendEncodedImage(const EncodedImage& encoded_image, | 55 virtual void OnSendEncodedImage(const EncodedImage& encoded_image, |
56 const CodecSpecificInfo* codec_info); | 56 const CodecSpecificInfo* codec_info); |
57 // Used to update incoming frame rate. | 57 // Used to update incoming frame rate. |
58 void OnIncomingFrame(int width, int height); | 58 void OnIncomingFrame(int width, int height); |
59 | 59 |
60 void OnCpuRestrictedResolutionChanged(bool cpu_restricted_resolution); | 60 // Adaptation stats. |
61 void OnQualityRestrictedResolutionChanged(int num_quality_downscales); | 61 void SetAdaptationStats(const ViEEncoder::AdaptCounts& cpu_counts, |
62 void SetCpuScalingStats(int num_cpu_downscales); // -1: disabled. | 62 const ViEEncoder::AdaptCounts& quality_counts); |
63 void SetQualityScalingStats(int num_quality_downscales); // -1: disabled. | 63 void OnCpuAdaptationChanged(const ViEEncoder::AdaptCounts& cpu_counts, |
| 64 const ViEEncoder::AdaptCounts& quality_counts); |
| 65 void OnQualityAdaptationChanged( |
| 66 const ViEEncoder::AdaptCounts& cpu_counts, |
| 67 const ViEEncoder::AdaptCounts& quality_counts); |
64 | 68 |
65 void OnEncoderStatsUpdate(uint32_t framerate, uint32_t bitrate); | 69 void OnEncoderStatsUpdate(uint32_t framerate, uint32_t bitrate); |
66 void OnSuspendChange(bool is_suspended); | 70 void OnSuspendChange(bool is_suspended); |
67 void OnInactiveSsrc(uint32_t ssrc); | 71 void OnInactiveSsrc(uint32_t ssrc); |
68 | 72 |
69 // Used to indicate change in content type, which may require a change in | 73 // Used to indicate change in content type, which may require a change in |
70 // how stats are collected and set the configured preferred media bitrate. | 74 // how stats are collected and set the configured preferred media bitrate. |
71 void OnEncoderReconfigured(const VideoEncoderConfig& encoder_config, | 75 void OnEncoderReconfigured(const VideoEncoderConfig& encoder_config, |
72 uint32_t preferred_bitrate_bps); | 76 uint32_t preferred_bitrate_bps); |
73 | 77 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 }; | 157 }; |
154 struct QpCounters { | 158 struct QpCounters { |
155 SampleCounter vp8; // QP range: 0-127. | 159 SampleCounter vp8; // QP range: 0-127. |
156 SampleCounter vp9; // QP range: 0-255. | 160 SampleCounter vp9; // QP range: 0-255. |
157 SampleCounter h264; // QP range: 0-51. | 161 SampleCounter h264; // QP range: 0-51. |
158 }; | 162 }; |
159 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 163 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
160 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) | 164 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) |
161 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 165 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
162 | 166 |
| 167 void SetAdaptTimer(const ViEEncoder::AdaptCounts& counts, StatsTimer* timer) |
| 168 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 169 void UpdateAdaptationStats(const ViEEncoder::AdaptCounts& cpu_counts, |
| 170 const ViEEncoder::AdaptCounts& quality_counts) |
| 171 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 172 |
163 Clock* const clock_; | 173 Clock* const clock_; |
164 const std::string payload_name_; | 174 const std::string payload_name_; |
165 const VideoSendStream::Config::Rtp rtp_config_; | 175 const VideoSendStream::Config::Rtp rtp_config_; |
166 rtc::CriticalSection crit_; | 176 rtc::CriticalSection crit_; |
167 VideoEncoderConfig::ContentType content_type_ GUARDED_BY(crit_); | 177 VideoEncoderConfig::ContentType content_type_ GUARDED_BY(crit_); |
168 const int64_t start_ms_; | 178 const int64_t start_ms_; |
169 VideoSendStream::Stats stats_ GUARDED_BY(crit_); | 179 VideoSendStream::Stats stats_ GUARDED_BY(crit_); |
170 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); | 180 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); |
171 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_); | 181 std::map<uint32_t, StatsUpdateTimes> update_times_ GUARDED_BY(crit_); |
172 rtc::ExpFilter encode_time_ GUARDED_BY(crit_); | 182 rtc::ExpFilter encode_time_ GUARDED_BY(crit_); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 RateCounter input_fps_counter_; | 218 RateCounter input_fps_counter_; |
209 RateCounter sent_fps_counter_; | 219 RateCounter sent_fps_counter_; |
210 RateAccCounter total_byte_counter_; | 220 RateAccCounter total_byte_counter_; |
211 RateAccCounter media_byte_counter_; | 221 RateAccCounter media_byte_counter_; |
212 RateAccCounter rtx_byte_counter_; | 222 RateAccCounter rtx_byte_counter_; |
213 RateAccCounter padding_byte_counter_; | 223 RateAccCounter padding_byte_counter_; |
214 RateAccCounter retransmit_byte_counter_; | 224 RateAccCounter retransmit_byte_counter_; |
215 RateAccCounter fec_byte_counter_; | 225 RateAccCounter fec_byte_counter_; |
216 int64_t first_rtcp_stats_time_ms_; | 226 int64_t first_rtcp_stats_time_ms_; |
217 int64_t first_rtp_stats_time_ms_; | 227 int64_t first_rtp_stats_time_ms_; |
218 StatsTimer cpu_scaling_timer_; | 228 StatsTimer cpu_adapt_timer_; |
219 StatsTimer quality_scaling_timer_; | 229 StatsTimer quality_adapt_timer_; |
220 BoolSampleCounter paused_time_counter_; | 230 BoolSampleCounter paused_time_counter_; |
221 TargetRateUpdates target_rate_updates_; | 231 TargetRateUpdates target_rate_updates_; |
222 ReportBlockStats report_block_stats_; | 232 ReportBlockStats report_block_stats_; |
223 const VideoSendStream::Stats start_stats_; | 233 const VideoSendStream::Stats start_stats_; |
224 | 234 |
225 std::map<int, QpCounters> | 235 std::map<int, QpCounters> |
226 qp_counters_; // QP counters mapped by spatial idx. | 236 qp_counters_; // QP counters mapped by spatial idx. |
227 }; | 237 }; |
228 | 238 |
229 std::unique_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); | 239 std::unique_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); |
230 }; | 240 }; |
231 | 241 |
232 } // namespace webrtc | 242 } // namespace webrtc |
233 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ | 243 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
OLD | NEW |