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 |
11 #ifndef WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ | 11 #ifndef WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
12 #define WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ | 12 #define WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <memory> | 15 #include <memory> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/common_types.h" | 19 #include "webrtc/common_types.h" |
20 #include "webrtc/modules/video_coding/include/video_codec_interface.h" | 20 #include "webrtc/modules/video_coding/include/video_codec_interface.h" |
21 #include "webrtc/modules/video_coding/include/video_coding_defines.h" | 21 #include "webrtc/modules/video_coding/include/video_coding_defines.h" |
22 #include "webrtc/rtc_base/criticalsection.h" | 22 #include "webrtc/rtc_base/criticalsection.h" |
23 #include "webrtc/rtc_base/numerics/exp_filter.h" | 23 #include "webrtc/rtc_base/numerics/exp_filter.h" |
24 #include "webrtc/rtc_base/ratetracker.h" | 24 #include "webrtc/rtc_base/ratetracker.h" |
25 #include "webrtc/rtc_base/thread_annotations.h" | 25 #include "webrtc/rtc_base/thread_annotations.h" |
26 #include "webrtc/system_wrappers/include/clock.h" | 26 #include "webrtc/system_wrappers/include/clock.h" |
27 #include "webrtc/video/overuse_frame_detector.h" | 27 #include "webrtc/video/overuse_frame_detector.h" |
28 #include "webrtc/video/report_block_stats.h" | 28 #include "webrtc/video/report_block_stats.h" |
29 #include "webrtc/video/stats_counter.h" | 29 #include "webrtc/video/stats_counter.h" |
30 #include "webrtc/video/vie_encoder.h" | 30 #include "webrtc/video/video_stream_encoder.h" |
31 #include "webrtc/video_send_stream.h" | 31 #include "webrtc/video_send_stream.h" |
32 | 32 |
33 namespace webrtc { | 33 namespace webrtc { |
34 | 34 |
35 class SendStatisticsProxy : public CpuOveruseMetricsObserver, | 35 class SendStatisticsProxy : public CpuOveruseMetricsObserver, |
36 public RtcpStatisticsCallback, | 36 public RtcpStatisticsCallback, |
37 public RtcpPacketTypeCounterObserver, | 37 public RtcpPacketTypeCounterObserver, |
38 public StreamDataCountersCallback, | 38 public StreamDataCountersCallback, |
39 public BitrateStatisticsObserver, | 39 public BitrateStatisticsObserver, |
40 public FrameCountObserver, | 40 public FrameCountObserver, |
(...skipping 10 matching lines...) Expand all Loading... |
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 // Adaptation stats. | 60 // Adaptation stats. |
61 void SetAdaptationStats(const ViEEncoder::AdaptCounts& cpu_counts, | 61 void SetAdaptationStats( |
62 const ViEEncoder::AdaptCounts& quality_counts); | 62 const VideoStreamEncoder::AdaptCounts& cpu_counts, |
63 void OnCpuAdaptationChanged(const ViEEncoder::AdaptCounts& cpu_counts, | 63 const VideoStreamEncoder::AdaptCounts& quality_counts); |
64 const ViEEncoder::AdaptCounts& quality_counts); | 64 void OnCpuAdaptationChanged( |
| 65 const VideoStreamEncoder::AdaptCounts& cpu_counts, |
| 66 const VideoStreamEncoder::AdaptCounts& quality_counts); |
65 void OnQualityAdaptationChanged( | 67 void OnQualityAdaptationChanged( |
66 const ViEEncoder::AdaptCounts& cpu_counts, | 68 const VideoStreamEncoder::AdaptCounts& cpu_counts, |
67 const ViEEncoder::AdaptCounts& quality_counts); | 69 const VideoStreamEncoder::AdaptCounts& quality_counts); |
68 | 70 |
69 void OnEncoderStatsUpdate(uint32_t framerate, uint32_t bitrate); | 71 void OnEncoderStatsUpdate(uint32_t framerate, uint32_t bitrate); |
70 void OnSuspendChange(bool is_suspended); | 72 void OnSuspendChange(bool is_suspended); |
71 void OnInactiveSsrc(uint32_t ssrc); | 73 void OnInactiveSsrc(uint32_t ssrc); |
72 | 74 |
73 // Used to indicate change in content type, which may require a change in | 75 // Used to indicate change in content type, which may require a change in |
74 // how stats are collected and set the configured preferred media bitrate. | 76 // how stats are collected and set the configured preferred media bitrate. |
75 void OnEncoderReconfigured(const VideoEncoderConfig& encoder_config, | 77 void OnEncoderReconfigured(const VideoEncoderConfig& encoder_config, |
76 uint32_t preferred_bitrate_bps); | 78 uint32_t preferred_bitrate_bps); |
77 | 79 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 }; | 159 }; |
158 struct QpCounters { | 160 struct QpCounters { |
159 SampleCounter vp8; // QP range: 0-127. | 161 SampleCounter vp8; // QP range: 0-127. |
160 SampleCounter vp9; // QP range: 0-255. | 162 SampleCounter vp9; // QP range: 0-255. |
161 SampleCounter h264; // QP range: 0-51. | 163 SampleCounter h264; // QP range: 0-51. |
162 }; | 164 }; |
163 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 165 void PurgeOldStats() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
164 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) | 166 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) |
165 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 167 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
166 | 168 |
167 void SetAdaptTimer(const ViEEncoder::AdaptCounts& counts, StatsTimer* timer) | 169 void SetAdaptTimer(const VideoStreamEncoder::AdaptCounts& counts, |
| 170 StatsTimer* timer) |
168 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 171 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
169 void UpdateAdaptationStats(const ViEEncoder::AdaptCounts& cpu_counts, | 172 void UpdateAdaptationStats( |
170 const ViEEncoder::AdaptCounts& quality_counts) | 173 const VideoStreamEncoder::AdaptCounts& cpu_counts, |
| 174 const VideoStreamEncoder::AdaptCounts& quality_counts) |
171 EXCLUSIVE_LOCKS_REQUIRED(crit_); | 175 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
172 | 176 |
173 Clock* const clock_; | 177 Clock* const clock_; |
174 const std::string payload_name_; | 178 const std::string payload_name_; |
175 const VideoSendStream::Config::Rtp rtp_config_; | 179 const VideoSendStream::Config::Rtp rtp_config_; |
176 rtc::CriticalSection crit_; | 180 rtc::CriticalSection crit_; |
177 VideoEncoderConfig::ContentType content_type_ GUARDED_BY(crit_); | 181 VideoEncoderConfig::ContentType content_type_ GUARDED_BY(crit_); |
178 const int64_t start_ms_; | 182 const int64_t start_ms_; |
179 VideoSendStream::Stats stats_ GUARDED_BY(crit_); | 183 VideoSendStream::Stats stats_ GUARDED_BY(crit_); |
180 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); | 184 uint32_t last_sent_frame_timestamp_ GUARDED_BY(crit_); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 238 |
235 std::map<int, QpCounters> | 239 std::map<int, QpCounters> |
236 qp_counters_; // QP counters mapped by spatial idx. | 240 qp_counters_; // QP counters mapped by spatial idx. |
237 }; | 241 }; |
238 | 242 |
239 std::unique_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); | 243 std::unique_ptr<UmaSamplesContainer> uma_container_ GUARDED_BY(crit_); |
240 }; | 244 }; |
241 | 245 |
242 } // namespace webrtc | 246 } // namespace webrtc |
243 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ | 247 #endif // WEBRTC_VIDEO_SEND_STATISTICS_PROXY_H_ |
OLD | NEW |