Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: video/send_statistics_proxy.h

Issue 3012863002: Add stats for forced software encoder fallback for VP8. (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | video/send_statistics_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 VIDEO_SEND_STATISTICS_PROXY_H_ 11 #ifndef VIDEO_SEND_STATISTICS_PROXY_H_
12 #define VIDEO_SEND_STATISTICS_PROXY_H_ 12 #define 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 "common_types.h" 19 #include "common_types.h" // NOLINT(build/include)
20 #include "modules/video_coding/include/video_codec_interface.h" 20 #include "modules/video_coding/include/video_codec_interface.h"
21 #include "modules/video_coding/include/video_coding_defines.h" 21 #include "modules/video_coding/include/video_coding_defines.h"
22 #include "rtc_base/criticalsection.h" 22 #include "rtc_base/criticalsection.h"
23 #include "rtc_base/numerics/exp_filter.h" 23 #include "rtc_base/numerics/exp_filter.h"
24 #include "rtc_base/ratetracker.h" 24 #include "rtc_base/ratetracker.h"
25 #include "rtc_base/thread_annotations.h" 25 #include "rtc_base/thread_annotations.h"
26 #include "system_wrappers/include/clock.h" 26 #include "system_wrappers/include/clock.h"
27 #include "video/overuse_frame_detector.h" 27 #include "video/overuse_frame_detector.h"
28 #include "video/report_block_stats.h" 28 #include "video/report_block_stats.h"
29 #include "video/stats_counter.h" 29 #include "video/stats_counter.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 int64_t resolution_update_ms; 143 int64_t resolution_update_ms;
144 int64_t bitrate_update_ms; 144 int64_t bitrate_update_ms;
145 }; 145 };
146 struct TargetRateUpdates { 146 struct TargetRateUpdates {
147 TargetRateUpdates() 147 TargetRateUpdates()
148 : pause_resume_events(0), last_paused_or_resumed(false), last_ms(-1) {} 148 : pause_resume_events(0), last_paused_or_resumed(false), last_ms(-1) {}
149 int pause_resume_events; 149 int pause_resume_events;
150 bool last_paused_or_resumed; 150 bool last_paused_or_resumed;
151 int64_t last_ms; 151 int64_t last_ms;
152 }; 152 };
153 struct FallbackEncoderInfo {
154 bool is_possible = true;
155 bool is_active = false;
156 int on_off_events = 0;
157 int64_t elapsed_ms = 0;
158 rtc::Optional<int64_t> last_update_ms;
159 const int max_frame_diff_ms = 2000;
160 };
153 struct StatsTimer { 161 struct StatsTimer {
154 void Start(int64_t now_ms); 162 void Start(int64_t now_ms);
155 void Stop(int64_t now_ms); 163 void Stop(int64_t now_ms);
156 void Restart(int64_t now_ms); 164 void Restart(int64_t now_ms);
157 int64_t start_ms = -1; 165 int64_t start_ms = -1;
158 int64_t total_ms = 0; 166 int64_t total_ms = 0;
159 }; 167 };
160 struct QpCounters { 168 struct QpCounters {
161 SampleCounter vp8; // QP range: 0-127. 169 SampleCounter vp8; // QP range: 0-127.
162 SampleCounter vp9; // QP range: 0-255. 170 SampleCounter vp9; // QP range: 0-255.
163 SampleCounter h264; // QP range: 0-51. 171 SampleCounter h264; // QP range: 0-51.
164 }; 172 };
165 void PurgeOldStats() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); 173 void PurgeOldStats() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
166 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc) 174 VideoSendStream::StreamStats* GetStatsEntry(uint32_t ssrc)
167 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); 175 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
168 176
169 void SetAdaptTimer(const VideoStreamEncoder::AdaptCounts& counts, 177 void SetAdaptTimer(const VideoStreamEncoder::AdaptCounts& counts,
170 StatsTimer* timer) RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); 178 StatsTimer* timer) RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
171 void UpdateAdaptationStats( 179 void UpdateAdaptationStats(
172 const VideoStreamEncoder::AdaptCounts& cpu_counts, 180 const VideoStreamEncoder::AdaptCounts& cpu_counts,
173 const VideoStreamEncoder::AdaptCounts& quality_counts) 181 const VideoStreamEncoder::AdaptCounts& quality_counts)
174 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_); 182 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
175 183
184 void UpdateEncoderFallbackStats(const CodecSpecificInfo* codec_info)
185 RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_);
186
176 Clock* const clock_; 187 Clock* const clock_;
177 const std::string payload_name_; 188 const std::string payload_name_;
178 const VideoSendStream::Config::Rtp rtp_config_; 189 const VideoSendStream::Config::Rtp rtp_config_;
190 const rtc::Optional<int> min_first_fallback_interval_ms_;
179 rtc::CriticalSection crit_; 191 rtc::CriticalSection crit_;
180 VideoEncoderConfig::ContentType content_type_ RTC_GUARDED_BY(crit_); 192 VideoEncoderConfig::ContentType content_type_ RTC_GUARDED_BY(crit_);
181 const int64_t start_ms_; 193 const int64_t start_ms_;
182 VideoSendStream::Stats stats_ RTC_GUARDED_BY(crit_); 194 VideoSendStream::Stats stats_ RTC_GUARDED_BY(crit_);
183 uint32_t last_sent_frame_timestamp_ RTC_GUARDED_BY(crit_); 195 uint32_t last_sent_frame_timestamp_ RTC_GUARDED_BY(crit_);
184 std::map<uint32_t, StatsUpdateTimes> update_times_ RTC_GUARDED_BY(crit_); 196 std::map<uint32_t, StatsUpdateTimes> update_times_ RTC_GUARDED_BY(crit_);
185 rtc::ExpFilter encode_time_ RTC_GUARDED_BY(crit_); 197 rtc::ExpFilter encode_time_ RTC_GUARDED_BY(crit_);
186 int quality_downscales_ RTC_GUARDED_BY(crit_); 198 int quality_downscales_ RTC_GUARDED_BY(crit_);
187 int cpu_downscales_ RTC_GUARDED_BY(crit_); 199 int cpu_downscales_ RTC_GUARDED_BY(crit_);
188 200
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 RateAccCounter rtx_byte_counter_; 237 RateAccCounter rtx_byte_counter_;
226 RateAccCounter padding_byte_counter_; 238 RateAccCounter padding_byte_counter_;
227 RateAccCounter retransmit_byte_counter_; 239 RateAccCounter retransmit_byte_counter_;
228 RateAccCounter fec_byte_counter_; 240 RateAccCounter fec_byte_counter_;
229 int64_t first_rtcp_stats_time_ms_; 241 int64_t first_rtcp_stats_time_ms_;
230 int64_t first_rtp_stats_time_ms_; 242 int64_t first_rtp_stats_time_ms_;
231 StatsTimer cpu_adapt_timer_; 243 StatsTimer cpu_adapt_timer_;
232 StatsTimer quality_adapt_timer_; 244 StatsTimer quality_adapt_timer_;
233 BoolSampleCounter paused_time_counter_; 245 BoolSampleCounter paused_time_counter_;
234 TargetRateUpdates target_rate_updates_; 246 TargetRateUpdates target_rate_updates_;
247 BoolSampleCounter fallback_active_counter_;
248 FallbackEncoderInfo fallback_info_;
235 ReportBlockStats report_block_stats_; 249 ReportBlockStats report_block_stats_;
236 const VideoSendStream::Stats start_stats_; 250 const VideoSendStream::Stats start_stats_;
237 251
238 std::map<int, QpCounters> 252 std::map<int, QpCounters>
239 qp_counters_; // QP counters mapped by spatial idx. 253 qp_counters_; // QP counters mapped by spatial idx.
240 }; 254 };
241 255
242 std::unique_ptr<UmaSamplesContainer> uma_container_ RTC_GUARDED_BY(crit_); 256 std::unique_ptr<UmaSamplesContainer> uma_container_ RTC_GUARDED_BY(crit_);
243 }; 257 };
244 258
245 } // namespace webrtc 259 } // namespace webrtc
246 #endif // VIDEO_SEND_STATISTICS_PROXY_H_ 260 #endif // VIDEO_SEND_STATISTICS_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | video/send_statistics_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698