| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 | 971 |
| 972 switch (degradation_preference_) { | 972 switch (degradation_preference_) { |
| 973 case VideoSendStream::DegradationPreference::kBalanced: { | 973 case VideoSendStream::DegradationPreference::kBalanced: { |
| 974 // Try scale down framerate, if lower. | 974 // Try scale down framerate, if lower. |
| 975 int fps = MinFps(last_frame_info_->pixel_count()); | 975 int fps = MinFps(last_frame_info_->pixel_count()); |
| 976 if (source_proxy_->RestrictFramerate(fps)) { | 976 if (source_proxy_->RestrictFramerate(fps)) { |
| 977 GetAdaptCounter().IncrementFramerate(reason); | 977 GetAdaptCounter().IncrementFramerate(reason); |
| 978 break; | 978 break; |
| 979 } | 979 } |
| 980 // Scale down resolution. | 980 // Scale down resolution. |
| 981 FALLTHROUGH(); | 981 RTC_FALLTHROUGH(); |
| 982 } | 982 } |
| 983 case VideoSendStream::DegradationPreference::kMaintainFramerate: | 983 case VideoSendStream::DegradationPreference::kMaintainFramerate: |
| 984 // Scale down resolution. | 984 // Scale down resolution. |
| 985 if (!source_proxy_->RequestResolutionLowerThan( | 985 if (!source_proxy_->RequestResolutionLowerThan( |
| 986 adaptation_request.input_pixel_count_, | 986 adaptation_request.input_pixel_count_, |
| 987 settings_.encoder->GetScalingSettings().min_pixels_per_frame)) { | 987 settings_.encoder->GetScalingSettings().min_pixels_per_frame)) { |
| 988 return; | 988 return; |
| 989 } | 989 } |
| 990 GetAdaptCounter().IncrementResolution(reason); | 990 GetAdaptCounter().IncrementResolution(reason); |
| 991 break; | 991 break; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 GetAdaptCounter().DecrementFramerate(reason, fps); | 1049 GetAdaptCounter().DecrementFramerate(reason, fps); |
| 1050 // Reset framerate in case of fewer fps steps down than up. | 1050 // Reset framerate in case of fewer fps steps down than up. |
| 1051 if (adapt_counter.FramerateCount() == 0 && | 1051 if (adapt_counter.FramerateCount() == 0 && |
| 1052 fps != std::numeric_limits<int>::max()) { | 1052 fps != std::numeric_limits<int>::max()) { |
| 1053 LOG(LS_INFO) << "Removing framerate down-scaling setting."; | 1053 LOG(LS_INFO) << "Removing framerate down-scaling setting."; |
| 1054 source_proxy_->IncreaseFramerate(std::numeric_limits<int>::max()); | 1054 source_proxy_->IncreaseFramerate(std::numeric_limits<int>::max()); |
| 1055 } | 1055 } |
| 1056 break; | 1056 break; |
| 1057 } | 1057 } |
| 1058 // Scale up resolution. | 1058 // Scale up resolution. |
| 1059 FALLTHROUGH(); | 1059 RTC_FALLTHROUGH(); |
| 1060 } | 1060 } |
| 1061 case VideoSendStream::DegradationPreference::kMaintainFramerate: { | 1061 case VideoSendStream::DegradationPreference::kMaintainFramerate: { |
| 1062 // Scale up resolution. | 1062 // Scale up resolution. |
| 1063 int pixel_count = adaptation_request.input_pixel_count_; | 1063 int pixel_count = adaptation_request.input_pixel_count_; |
| 1064 if (adapt_counter.ResolutionCount() == 1) { | 1064 if (adapt_counter.ResolutionCount() == 1) { |
| 1065 LOG(LS_INFO) << "Removing resolution down-scaling setting."; | 1065 LOG(LS_INFO) << "Removing resolution down-scaling setting."; |
| 1066 pixel_count = std::numeric_limits<int>::max(); | 1066 pixel_count = std::numeric_limits<int>::max(); |
| 1067 } | 1067 } |
| 1068 if (!source_proxy_->RequestHigherResolutionThan(pixel_count)) | 1068 if (!source_proxy_->RequestHigherResolutionThan(pixel_count)) |
| 1069 return; | 1069 return; |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 std::string VideoStreamEncoder::AdaptCounter::ToString( | 1251 std::string VideoStreamEncoder::AdaptCounter::ToString( |
| 1252 const std::vector<int>& counters) const { | 1252 const std::vector<int>& counters) const { |
| 1253 std::stringstream ss; | 1253 std::stringstream ss; |
| 1254 for (size_t reason = 0; reason < kScaleReasonSize; ++reason) { | 1254 for (size_t reason = 0; reason < kScaleReasonSize; ++reason) { |
| 1255 ss << (reason ? " cpu" : "quality") << ":" << counters[reason]; | 1255 ss << (reason ? " cpu" : "quality") << ":" << counters[reason]; |
| 1256 } | 1256 } |
| 1257 return ss.str(); | 1257 return ss.str(); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 } // namespace webrtc | 1260 } // namespace webrtc |
| OLD | NEW |