OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 | 488 |
489 LOG(LS_INFO) << "VAdapt GD Request: " | 489 LOG(LS_INFO) << "VAdapt GD Request: " |
490 << (DOWNGRADE == request ? "down" : | 490 << (DOWNGRADE == request ? "down" : |
491 (UPGRADE == request ? "up" : "keep")) | 491 (UPGRADE == request ? "up" : "keep")) |
492 << " From: " << width << "x" << height | 492 << " From: " << width << "x" << height |
493 << " Pixels: " << encoder_desired_num_pixels_ | 493 << " Pixels: " << encoder_desired_num_pixels_ |
494 << " Changed: " << (changed ? "true" : "false") | 494 << " Changed: " << (changed ? "true" : "false") |
495 << " To: " << new_width << "x" << new_height; | 495 << " To: " << new_width << "x" << new_height; |
496 } | 496 } |
497 | 497 |
498 void CoordinatedVideoAdapter::OnCpuResolutionRequest( | |
499 rtc::Optional<int> max_pixel_count, | |
500 rtc::Optional<int> max_pixel_count_step_up) { | |
501 rtc::CritScope cs(&request_critical_section_); | |
502 if (max_pixel_count && *max_pixel_count < GetOutputNumPixels()) { | |
503 OnCpuResolutionRequest(DOWNGRADE); | |
504 } else if (max_pixel_count_step_up && | |
505 *max_pixel_count_step_up <= GetOutputNumPixels()) { | |
perkj_webrtc
2016/02/26 14:08:25
right- this will currently increase the resolution
| |
506 OnCpuResolutionRequest(UPGRADE); | |
507 } | |
508 } | |
509 | |
498 // A Bandwidth GD request for new resolution | 510 // A Bandwidth GD request for new resolution |
499 void CoordinatedVideoAdapter::OnCpuResolutionRequest(AdaptRequest request) { | 511 void CoordinatedVideoAdapter::OnCpuResolutionRequest(AdaptRequest request) { |
500 rtc::CritScope cs(&request_critical_section_); | 512 rtc::CritScope cs(&request_critical_section_); |
501 if (!cpu_adaptation_) { | 513 if (!cpu_adaptation_) { |
502 return; | 514 return; |
503 } | 515 } |
516 | |
504 // Update how many times we have downgraded due to the cpu load. | 517 // Update how many times we have downgraded due to the cpu load. |
505 switch (request) { | 518 switch (request) { |
506 case DOWNGRADE: | 519 case DOWNGRADE: |
507 // Ignore downgrades if we have downgraded the maximum times. | 520 // Ignore downgrades if we have downgraded the maximum times. |
508 if (cpu_downgrade_count_ < kMaxCpuDowngrades) { | 521 if (cpu_downgrade_count_ < kMaxCpuDowngrades) { |
509 ++cpu_downgrade_count_; | 522 ++cpu_downgrade_count_; |
510 } else { | 523 } else { |
511 LOG(LS_VERBOSE) << "VAdapt CPU load high but do not downgrade " | 524 LOG(LS_VERBOSE) << "VAdapt CPU load high but do not downgrade " |
512 "because maximum downgrades reached"; | 525 "because maximum downgrades reached"; |
513 SignalCpuAdaptationUnable(); | 526 SignalCpuAdaptationUnable(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
693 // When any adaptation occurs, historic CPU load levels are no longer | 706 // When any adaptation occurs, historic CPU load levels are no longer |
694 // accurate. Clear out our state so we can re-learn at the new normal. | 707 // accurate. Clear out our state so we can re-learn at the new normal. |
695 cpu_load_num_samples_ = 0; | 708 cpu_load_num_samples_ = 0; |
696 system_load_average_ = kCpuLoadInitialAverage; | 709 system_load_average_ = kCpuLoadInitialAverage; |
697 } | 710 } |
698 | 711 |
699 return changed; | 712 return changed; |
700 } | 713 } |
701 | 714 |
702 } // namespace cricket | 715 } // namespace cricket |
OLD | NEW |