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

Unified Diff: webrtc/video_engine/overuse_frame_detector.h

Issue 1228853004: Reduce locking in overuse frame detector now that (as of r9508) the observer_ and options_ can only (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/video_engine/overuse_frame_detector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video_engine/overuse_frame_detector.h
diff --git a/webrtc/video_engine/overuse_frame_detector.h b/webrtc/video_engine/overuse_frame_detector.h
index 391c5cd327fc4fe2cde61addd9149a5c22ebda01..aff4b43025f5f98972e53920910e80a453a15198 100644
--- a/webrtc/video_engine/overuse_frame_detector.h
+++ b/webrtc/video_engine/overuse_frame_detector.h
@@ -121,12 +121,9 @@ class OveruseFrameDetector : public Module {
// need a guard.
void AddProcessingTime(int elapsed_ms) EXCLUSIVE_LOCKS_REQUIRED(crit_);
- // TODO(asapersson): This method is always called on the processing thread.
- // If locking is required, consider doing that locking inside the
- // implementation and reduce scope as much as possible. We should also
- // see if we can avoid calling out to other methods while holding the lock.
- bool IsOverusing() EXCLUSIVE_LOCKS_REQUIRED(crit_);
- bool IsUnderusing(int64_t time_now) EXCLUSIVE_LOCKS_REQUIRED(crit_);
+ // Only called on the processing thread.
+ bool IsOverusing(const CpuOveruseMetrics& metrics);
+ bool IsUnderusing(const CpuOveruseMetrics& metrics, int64_t time_now);
bool FrameTimeoutDetected(int64_t now) const EXCLUSIVE_LOCKS_REQUIRED(crit_);
bool FrameSizeChanged(int num_pixels) const EXCLUSIVE_LOCKS_REQUIRED(crit_);
@@ -149,24 +146,24 @@ class OveruseFrameDetector : public Module {
CpuOveruseMetrics metrics_ GUARDED_BY(crit_);
Clock* const clock_;
- int64_t next_process_time_; // Only accessed on the processing thread.
int64_t num_process_times_ GUARDED_BY(crit_);
int64_t last_capture_time_ GUARDED_BY(crit_);
- // These six members are only accessed on the processing thread.
+ // Number of pixels of last captured frame.
+ int num_pixels_ GUARDED_BY(crit_);
+
+ // These seven members are only accessed on the processing thread.
+ int64_t next_process_time_;
int64_t last_overuse_time_;
int checks_above_threshold_;
int num_overuse_detections_;
-
int64_t last_rampup_time_;
bool in_quick_rampup_;
int current_rampup_delay_ms_;
- // Number of pixels of last captured frame.
- int num_pixels_ GUARDED_BY(crit_);
-
int64_t last_encode_sample_ms_; // Only accessed by one thread.
+ int64_t last_sample_time_ms_; // Only accessed by one thread.
// TODO(asapersson): Can these be regular members (avoid separate heap
// allocs)?
@@ -174,8 +171,6 @@ class OveruseFrameDetector : public Module {
const rtc::scoped_ptr<SendProcessingUsage> usage_ GUARDED_BY(crit_);
const rtc::scoped_ptr<FrameQueue> frame_queue_ GUARDED_BY(crit_);
- int64_t last_sample_time_ms_; // Only accessed by one thread.
-
rtc::ThreadChecker processing_thread_;
RTC_DISALLOW_COPY_AND_ASSIGN(OveruseFrameDetector);
« no previous file with comments | « no previous file | webrtc/video_engine/overuse_frame_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698