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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 class SendStatisticsProxy : public CpuOveruseMetricsObserver, | 34 class SendStatisticsProxy : public CpuOveruseMetricsObserver, |
35 public RtcpStatisticsCallback, | 35 public RtcpStatisticsCallback, |
36 public RtcpPacketTypeCounterObserver, | 36 public RtcpPacketTypeCounterObserver, |
37 public StreamDataCountersCallback, | 37 public StreamDataCountersCallback, |
38 public BitrateStatisticsObserver, | 38 public BitrateStatisticsObserver, |
39 public FrameCountObserver, | 39 public FrameCountObserver, |
40 public SendSideDelayObserver { | 40 public SendSideDelayObserver { |
41 public: | 41 public: |
42 static const int kStatsTimeoutMs; | 42 static const int kStatsTimeoutMs; |
| 43 // Number of required samples to be collected before a metric is added |
| 44 // to a rtc histogram. |
| 45 static const int kMinRequiredMetricsSamples = 200; |
43 | 46 |
44 SendStatisticsProxy(Clock* clock, | 47 SendStatisticsProxy(Clock* clock, |
45 const VideoSendStream::Config& config, | 48 const VideoSendStream::Config& config, |
46 VideoEncoderConfig::ContentType content_type); | 49 VideoEncoderConfig::ContentType content_type); |
47 virtual ~SendStatisticsProxy(); | 50 virtual ~SendStatisticsProxy(); |
48 | 51 |
49 VideoSendStream::Stats GetStats(); | 52 VideoSendStream::Stats GetStats(); |
50 | 53 |
51 virtual void OnSendEncodedImage(const EncodedImage& encoded_image, | 54 virtual void OnSendEncodedImage(const EncodedImage& encoded_image, |
52 const CodecSpecificInfo* codec_info); | 55 const CodecSpecificInfo* codec_info); |
53 // Used to update incoming frame rate. | 56 // Used to update incoming frame rate. |
54 void OnIncomingFrame(int width, int height); | 57 void OnIncomingFrame(int width, int height); |
55 | 58 |
| 59 // Used to indicate that the current input frame resolution is restricted due |
| 60 // to cpu usage. |
| 61 void SetCpuRestrictedResolution(bool cpu_restricted); |
| 62 // Used to update the number of times the input frame resolution has changed |
| 63 // due to cpu adaptation. |
| 64 void OnCpuRestrictedResolutionChanged(bool cpu_restricted_resolution); |
| 65 |
56 void OnEncoderStatsUpdate(uint32_t framerate, uint32_t bitrate); | 66 void OnEncoderStatsUpdate(uint32_t framerate, uint32_t bitrate); |
57 void OnSuspendChange(bool is_suspended); | 67 void OnSuspendChange(bool is_suspended); |
58 void OnInactiveSsrc(uint32_t ssrc); | 68 void OnInactiveSsrc(uint32_t ssrc); |
59 | 69 |
60 // Used to indicate change in content type, which may require a change in | 70 // Used to indicate change in content type, which may require a change in |
61 // how stats are collected and set the configured preferred media bitrate. | 71 // how stats are collected and set the configured preferred media bitrate. |
62 void OnEncoderReconfigured(const VideoEncoderConfig& encoder_config, | 72 void OnEncoderReconfigured(const VideoEncoderConfig& encoder_config, |
63 uint32_t preferred_bitrate_bps); | 73 uint32_t preferred_bitrate_bps); |
64 | 74 |
65 // Used to update the encoder target rate. | 75 // Used to update the encoder target rate. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 int max_sent_width_per_timestamp_; | 173 int max_sent_width_per_timestamp_; |
164 int max_sent_height_per_timestamp_; | 174 int max_sent_height_per_timestamp_; |
165 SampleCounter input_width_counter_; | 175 SampleCounter input_width_counter_; |
166 SampleCounter input_height_counter_; | 176 SampleCounter input_height_counter_; |
167 SampleCounter sent_width_counter_; | 177 SampleCounter sent_width_counter_; |
168 SampleCounter sent_height_counter_; | 178 SampleCounter sent_height_counter_; |
169 SampleCounter encode_time_counter_; | 179 SampleCounter encode_time_counter_; |
170 BoolSampleCounter key_frame_counter_; | 180 BoolSampleCounter key_frame_counter_; |
171 BoolSampleCounter quality_limited_frame_counter_; | 181 BoolSampleCounter quality_limited_frame_counter_; |
172 SampleCounter quality_downscales_counter_; | 182 SampleCounter quality_downscales_counter_; |
| 183 BoolSampleCounter cpu_limited_frame_counter_; |
173 BoolSampleCounter bw_limited_frame_counter_; | 184 BoolSampleCounter bw_limited_frame_counter_; |
174 SampleCounter bw_resolutions_disabled_counter_; | 185 SampleCounter bw_resolutions_disabled_counter_; |
175 SampleCounter delay_counter_; | 186 SampleCounter delay_counter_; |
176 SampleCounter max_delay_counter_; | 187 SampleCounter max_delay_counter_; |
177 rtc::RateTracker input_frame_rate_tracker_; | 188 rtc::RateTracker input_frame_rate_tracker_; |
178 rtc::RateTracker sent_frame_rate_tracker_; | 189 rtc::RateTracker sent_frame_rate_tracker_; |
179 int64_t first_rtcp_stats_time_ms_; | 190 int64_t first_rtcp_stats_time_ms_; |
180 int64_t first_rtp_stats_time_ms_; | 191 int64_t first_rtp_stats_time_ms_; |
181 ReportBlockStats report_block_stats_; | 192 ReportBlockStats report_block_stats_; |
182 const VideoSendStream::Stats start_stats_; | 193 const VideoSendStream::Stats start_stats_; |
183 std::map<int, QpCounters> | 194 std::map<int, QpCounters> |
184 qp_counters_; // QP counters mapped by spatial idx. | 195 qp_counters_; // QP counters mapped by spatial idx. |
185 }; | 196 }; |
186 | 197 |
187 std::unique_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); | 198 std::unique_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); |
188 }; | 199 }; |
189 | 200 |
190 } // namespace webrtc | 201 } // namespace webrtc |
191 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ | 202 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
OLD | NEW |