Index: webrtc/media/base/videoadapter.cc |
diff --git a/webrtc/media/base/videoadapter.cc b/webrtc/media/base/videoadapter.cc |
index 9228e6d84cf75846ce3dc72c96cb96c0c0c58ace..31d4eef3239fa0653e0d968f198398d775bf96f9 100644 |
--- a/webrtc/media/base/videoadapter.cc |
+++ b/webrtc/media/base/videoadapter.cc |
@@ -495,12 +495,31 @@ void CoordinatedVideoAdapter::OnEncoderResolutionRequest( |
<< " To: " << new_width << "x" << new_height; |
} |
+void CoordinatedVideoAdapter::OnCpuResolutionRequest( |
+ rtc::Optional<int> max_pixel_count, |
+ rtc::Optional<int> max_pixel_count_step_up) { |
+ rtc::CritScope cs(&request_critical_section_); |
+ |
+ AdaptRequest request = KEEP; |
+ if (!max_pixel_count && !max_pixel_count_step_up) { |
+ return; |
+ } |
+ if (max_pixel_count && *max_pixel_count < GetOutputNumPixels()) { |
+ request = DOWNGRADE; |
+ } else if (max_pixel_count_step_up && |
+ *max_pixel_count_step_up <= GetOutputNumPixels()) { |
+ request = UPGRADE; |
+ } |
+ OnCpuResolutionRequest(request); |
pthatcher1
2016/02/25 07:40:30
Could this be shortened to the following?
if (max
perkj_webrtc
2016/02/25 13:57:07
Done.
|
+} |
+ |
// A Bandwidth GD request for new resolution |
void CoordinatedVideoAdapter::OnCpuResolutionRequest(AdaptRequest request) { |
rtc::CritScope cs(&request_critical_section_); |
if (!cpu_adaptation_) { |
return; |
} |
+ |
// Update how many times we have downgraded due to the cpu load. |
switch (request) { |
case DOWNGRADE: |