| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 void OnCpuRestrictedResolutionChanged(bool cpu_restricted_resolution); |
| 61 void OnQualityRestrictedResolutionChanged(int num_quality_downscales); | 61 void OnQualityRestrictedResolutionChanged(int num_quality_downscales); |
| 62 void SetCpuScalingStats(bool cpu_restricted_resolution); | 62 void SetCpuScalingStats(int num_cpu_downscales); // -1: disabled. |
| 63 void SetQualityScalingStats(int num_quality_downscales); // -1: disabled. | 63 void SetQualityScalingStats(int num_quality_downscales); // -1: disabled. |
| 64 | 64 |
| 65 void OnEncoderStatsUpdate(uint32_t framerate, uint32_t bitrate); | 65 void OnEncoderStatsUpdate(uint32_t framerate, uint32_t bitrate); |
| 66 void OnSuspendChange(bool is_suspended); | 66 void OnSuspendChange(bool is_suspended); |
| 67 void OnInactiveSsrc(uint32_t ssrc); | 67 void OnInactiveSsrc(uint32_t ssrc); |
| 68 | 68 |
| 69 // Used to indicate change in content type, which may require a change in | 69 // 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. | 70 // how stats are collected and set the configured preferred media bitrate. |
| 71 void OnEncoderReconfigured(const VideoEncoderConfig& encoder_config, | 71 void OnEncoderReconfigured(const VideoEncoderConfig& encoder_config, |
| 72 uint32_t preferred_bitrate_bps); | 72 uint32_t preferred_bitrate_bps); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 int64_t resolution_update_ms; | 137 int64_t resolution_update_ms; |
| 138 int64_t bitrate_update_ms; | 138 int64_t bitrate_update_ms; |
| 139 }; | 139 }; |
| 140 struct TargetRateUpdates { | 140 struct TargetRateUpdates { |
| 141 TargetRateUpdates() | 141 TargetRateUpdates() |
| 142 : pause_resume_events(0), last_paused_or_resumed(false), last_ms(-1) {} | 142 : pause_resume_events(0), last_paused_or_resumed(false), last_ms(-1) {} |
| 143 int pause_resume_events; | 143 int pause_resume_events; |
| 144 bool last_paused_or_resumed; | 144 bool last_paused_or_resumed; |
| 145 int64_t last_ms; | 145 int64_t last_ms; |
| 146 }; | 146 }; |
| 147 struct StatsTimer { |
| 148 void Start(int64_t now_ms); |
| 149 void Stop(int64_t now_ms); |
| 150 void Restart(int64_t now_ms); |
| 151 int64_t start_ms = -1; |
| 152 int64_t total_ms = 0; |
| 153 }; |
| 147 struct QpCounters { | 154 struct QpCounters { |
| 148 SampleCounter vp8; // QP range: 0-127 | 155 SampleCounter vp8; // QP range: 0-127. |
| 149 SampleCounter vp9; // QP range: 0-255 | 156 SampleCounter vp9; // QP range: 0-255. |
| 150 SampleCounter h264; // QP range: 0-51 | 157 SampleCounter h264; // QP range: 0-51. |
| 151 }; | 158 }; |
| 152 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 159 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 153 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) | 160 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) |
| 154 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 161 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 155 | 162 |
| 156 Clock* const clock_; | 163 Clock* const clock_; |
| 157 const std::string payload_name_; | 164 const std::string payload_name_; |
| 158 const VideoSendStream::Config::Rtp rtp_config_; | 165 const VideoSendStream::Config::Rtp rtp_config_; |
| 159 rtc::CriticalSection crit_; | 166 rtc::CriticalSection crit_; |
| 160 VideoEncoderConfig::ContentType content_type_ GUARDED_BY(crit_); | 167 VideoEncoderConfig::ContentType content_type_ GUARDED_BY(crit_); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 RateCounter input_fps_counter_; | 207 RateCounter input_fps_counter_; |
| 201 RateCounter sent_fps_counter_; | 208 RateCounter sent_fps_counter_; |
| 202 RateAccCounter total_byte_counter_; | 209 RateAccCounter total_byte_counter_; |
| 203 RateAccCounter media_byte_counter_; | 210 RateAccCounter media_byte_counter_; |
| 204 RateAccCounter rtx_byte_counter_; | 211 RateAccCounter rtx_byte_counter_; |
| 205 RateAccCounter padding_byte_counter_; | 212 RateAccCounter padding_byte_counter_; |
| 206 RateAccCounter retransmit_byte_counter_; | 213 RateAccCounter retransmit_byte_counter_; |
| 207 RateAccCounter fec_byte_counter_; | 214 RateAccCounter fec_byte_counter_; |
| 208 int64_t first_rtcp_stats_time_ms_; | 215 int64_t first_rtcp_stats_time_ms_; |
| 209 int64_t first_rtp_stats_time_ms_; | 216 int64_t first_rtp_stats_time_ms_; |
| 217 StatsTimer cpu_scaling_timer_; |
| 218 StatsTimer quality_scaling_timer_; |
| 210 BoolSampleCounter paused_time_counter_; | 219 BoolSampleCounter paused_time_counter_; |
| 211 TargetRateUpdates target_rate_updates_; | 220 TargetRateUpdates target_rate_updates_; |
| 212 ReportBlockStats report_block_stats_; | 221 ReportBlockStats report_block_stats_; |
| 213 const VideoSendStream::Stats start_stats_; | 222 const VideoSendStream::Stats start_stats_; |
| 214 | 223 |
| 215 std::map<int, QpCounters> | 224 std::map<int, QpCounters> |
| 216 qp_counters_; // QP counters mapped by spatial idx. | 225 qp_counters_; // QP counters mapped by spatial idx. |
| 217 }; | 226 }; |
| 218 | 227 |
| 219 std::unique_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); | 228 std::unique_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); |
| 220 }; | 229 }; |
| 221 | 230 |
| 222 } // namespace webrtc | 231 } // namespace webrtc |
| 223 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ | 232 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
| OLD | NEW |