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

Side by Side Diff: webrtc/video/overuse_frame_detector.cc

Issue 1855433002: Replace NULL with nullptr in webrtc/video. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: replace x == nullptr with !x Created 4 years, 8 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 | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/payload_router_unittest.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
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 last_processed_capture_time_ms_(-1), 186 last_processed_capture_time_ms_(-1),
187 num_pixels_(0), 187 num_pixels_(0),
188 next_process_time_ms_(clock_->TimeInMilliseconds()), 188 next_process_time_ms_(clock_->TimeInMilliseconds()),
189 last_overuse_time_ms_(-1), 189 last_overuse_time_ms_(-1),
190 checks_above_threshold_(0), 190 checks_above_threshold_(0),
191 num_overuse_detections_(0), 191 num_overuse_detections_(0),
192 last_rampup_time_ms_(-1), 192 last_rampup_time_ms_(-1),
193 in_quick_rampup_(false), 193 in_quick_rampup_(false),
194 current_rampup_delay_ms_(kStandardRampUpDelayMs), 194 current_rampup_delay_ms_(kStandardRampUpDelayMs),
195 usage_(new SendProcessingUsage(options)) { 195 usage_(new SendProcessingUsage(options)) {
196 RTC_DCHECK(metrics_observer != nullptr); 196 RTC_DCHECK(metrics_observer);
197 processing_thread_.DetachFromThread(); 197 processing_thread_.DetachFromThread();
198 } 198 }
199 199
200 OveruseFrameDetector::~OveruseFrameDetector() { 200 OveruseFrameDetector::~OveruseFrameDetector() {
201 } 201 }
202 202
203 void OveruseFrameDetector::EncodedFrameTimeMeasured(int encode_duration_ms) { 203 void OveruseFrameDetector::EncodedFrameTimeMeasured(int encode_duration_ms) {
204 if (!metrics_) 204 if (!metrics_)
205 metrics_ = rtc::Optional<CpuOveruseMetrics>(CpuOveruseMetrics()); 205 metrics_ = rtc::Optional<CpuOveruseMetrics>(CpuOveruseMetrics());
206 metrics_->encode_usage_percent = usage_->Value(); 206 metrics_->encode_usage_percent = usage_->Value();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // Not currently backing off, reset rampup delay. 334 // Not currently backing off, reset rampup delay.
335 current_rampup_delay_ms_ = kStandardRampUpDelayMs; 335 current_rampup_delay_ms_ = kStandardRampUpDelayMs;
336 } 336 }
337 } 337 }
338 338
339 last_overuse_time_ms_ = now; 339 last_overuse_time_ms_ = now;
340 in_quick_rampup_ = false; 340 in_quick_rampup_ = false;
341 checks_above_threshold_ = 0; 341 checks_above_threshold_ = 0;
342 ++num_overuse_detections_; 342 ++num_overuse_detections_;
343 343
344 if (observer_ != NULL) 344 if (observer_)
345 observer_->OveruseDetected(); 345 observer_->OveruseDetected();
346 } else if (IsUnderusing(current_metrics, now)) { 346 } else if (IsUnderusing(current_metrics, now)) {
347 last_rampup_time_ms_ = now; 347 last_rampup_time_ms_ = now;
348 in_quick_rampup_ = true; 348 in_quick_rampup_ = true;
349 349
350 if (observer_ != NULL) 350 if (observer_)
351 observer_->NormalUsage(); 351 observer_->NormalUsage();
352 } 352 }
353 353
354 int rampup_delay = 354 int rampup_delay =
355 in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_; 355 in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_;
356 356
357 LOG(LS_VERBOSE) << " Frame stats: " 357 LOG(LS_VERBOSE) << " Frame stats: "
358 << " encode usage " << current_metrics.encode_usage_percent 358 << " encode usage " << current_metrics.encode_usage_percent
359 << " overuse detections " << num_overuse_detections_ 359 << " overuse detections " << num_overuse_detections_
360 << " rampup delay " << rampup_delay; 360 << " rampup delay " << rampup_delay;
(...skipping 12 matching lines...) Expand all
373 bool OveruseFrameDetector::IsUnderusing(const CpuOveruseMetrics& metrics, 373 bool OveruseFrameDetector::IsUnderusing(const CpuOveruseMetrics& metrics,
374 int64_t time_now) { 374 int64_t time_now) {
375 int delay = in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_; 375 int delay = in_quick_rampup_ ? kQuickRampUpDelayMs : current_rampup_delay_ms_;
376 if (time_now < last_rampup_time_ms_ + delay) 376 if (time_now < last_rampup_time_ms_ + delay)
377 return false; 377 return false;
378 378
379 return metrics.encode_usage_percent < 379 return metrics.encode_usage_percent <
380 options_.low_encode_usage_threshold_percent; 380 options_.low_encode_usage_threshold_percent;
381 } 381 }
382 } // namespace webrtc 382 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/end_to_end_tests.cc ('k') | webrtc/video/payload_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698