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

Side by Side Diff: webrtc/media/base/videoadapter.cc

Issue 1695263002: Move direct use of VideoCapturer::VideoAdapter to VideoSinkWants. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed test for screencast from videocapturer Created 4 years, 10 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
OLDNEW
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
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 // TODO(perkj): We should support taking larger steps up and down and
503 // actually look at the values set in max_pixel_count and
504 // max_pixel_count_step_up.
505 if (max_pixel_count && *max_pixel_count < GetOutputNumPixels()) {
506 OnCpuResolutionRequest(DOWNGRADE);
507 } else if (max_pixel_count_step_up &&
508 *max_pixel_count_step_up >= GetOutputNumPixels()) {
509 OnCpuResolutionRequest(UPGRADE);
pbos-webrtc 2016/02/26 14:26:18 Should we take this lock recursively or can you an
510 }
511 }
512
498 // A Bandwidth GD request for new resolution 513 // A Bandwidth GD request for new resolution
499 void CoordinatedVideoAdapter::OnCpuResolutionRequest(AdaptRequest request) { 514 void CoordinatedVideoAdapter::OnCpuResolutionRequest(AdaptRequest request) {
500 rtc::CritScope cs(&request_critical_section_); 515 rtc::CritScope cs(&request_critical_section_);
501 if (!cpu_adaptation_) { 516 if (!cpu_adaptation_) {
502 return; 517 return;
503 } 518 }
519
504 // Update how many times we have downgraded due to the cpu load. 520 // Update how many times we have downgraded due to the cpu load.
505 switch (request) { 521 switch (request) {
506 case DOWNGRADE: 522 case DOWNGRADE:
507 // Ignore downgrades if we have downgraded the maximum times. 523 // Ignore downgrades if we have downgraded the maximum times.
508 if (cpu_downgrade_count_ < kMaxCpuDowngrades) { 524 if (cpu_downgrade_count_ < kMaxCpuDowngrades) {
509 ++cpu_downgrade_count_; 525 ++cpu_downgrade_count_;
510 } else { 526 } else {
511 LOG(LS_VERBOSE) << "VAdapt CPU load high but do not downgrade " 527 LOG(LS_VERBOSE) << "VAdapt CPU load high but do not downgrade "
512 "because maximum downgrades reached"; 528 "because maximum downgrades reached";
513 SignalCpuAdaptationUnable(); 529 SignalCpuAdaptationUnable();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 // When any adaptation occurs, historic CPU load levels are no longer 709 // 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. 710 // accurate. Clear out our state so we can re-learn at the new normal.
695 cpu_load_num_samples_ = 0; 711 cpu_load_num_samples_ = 0;
696 system_load_average_ = kCpuLoadInitialAverage; 712 system_load_average_ = kCpuLoadInitialAverage;
697 } 713 }
698 714
699 return changed; 715 return changed;
700 } 716 }
701 717
702 } // namespace cricket 718 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698