jlmiller@webrtc.org | 5f93d0a | 2015-01-20 21:36:13 +0000 | [diff] [blame] | 1 | /* |
kjellander | 1afca73 | 2016-02-07 20:46:45 -0800 | [diff] [blame] | 2 | * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. |
jlmiller@webrtc.org | 5f93d0a | 2015-01-20 21:36:13 +0000 | [diff] [blame] | 3 | * |
kjellander | 1afca73 | 2016-02-07 20:46:45 -0800 | [diff] [blame] | 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
jlmiller@webrtc.org | 5f93d0a | 2015-01-20 21:36:13 +0000 | [diff] [blame] | 9 | */ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "media/base/videoadapter.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 12 | |
andresp@webrtc.org | ff689be | 2015-02-12 11:54:26 +0000 | [diff] [blame] | 13 | #include <algorithm> |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 14 | #include <cmath> |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 15 | #include <cstdlib> |
Per | 766ad3b | 2016-04-05 15:23:49 +0200 | [diff] [blame] | 16 | #include <limits> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 17 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 18 | #include "api/optional.h" |
| 19 | #include "media/base/mediaconstants.h" |
| 20 | #include "media/base/videocommon.h" |
| 21 | #include "rtc_base/arraysize.h" |
| 22 | #include "rtc_base/checks.h" |
| 23 | #include "rtc_base/logging.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 24 | |
Per | 766ad3b | 2016-04-05 15:23:49 +0200 | [diff] [blame] | 25 | namespace { |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 26 | struct Fraction { |
| 27 | int numerator; |
| 28 | int denominator; |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 29 | |
| 30 | // Determines number of output pixels if both width and height of an input of |
| 31 | // |input_pixels| pixels is scaled with the fraction numerator / denominator. |
| 32 | int scale_pixel_count(int input_pixels) { |
| 33 | return (numerator * numerator * input_pixels) / (denominator * denominator); |
| 34 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 35 | }; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 36 | |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 37 | // Round |value_to_round| to a multiple of |multiple|. Prefer rounding upwards, |
| 38 | // but never more than |max_value|. |
| 39 | int roundUp(int value_to_round, int multiple, int max_value) { |
| 40 | const int rounded_value = |
| 41 | (value_to_round + multiple - 1) / multiple * multiple; |
| 42 | return rounded_value <= max_value ? rounded_value |
| 43 | : (max_value / multiple * multiple); |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 44 | } |
| 45 | |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 46 | // Generates a scale factor that makes |input_pixels| close to |target_pixels|, |
| 47 | // but no higher than |max_pixels|. |
| 48 | Fraction FindScale(int input_pixels, int target_pixels, int max_pixels) { |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 49 | // This function only makes sense for a positive target. |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 50 | RTC_DCHECK_GT(target_pixels, 0); |
| 51 | RTC_DCHECK_GT(max_pixels, 0); |
| 52 | RTC_DCHECK_GE(max_pixels, target_pixels); |
| 53 | |
| 54 | // Don't scale up original. |
| 55 | if (target_pixels >= input_pixels) |
| 56 | return Fraction{1, 1}; |
| 57 | |
| 58 | Fraction current_scale = Fraction{1, 1}; |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 59 | Fraction best_scale = Fraction{1, 1}; |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 60 | // The minimum (absolute) difference between the number of output pixels and |
| 61 | // the target pixel count. |
| 62 | int min_pixel_diff = std::numeric_limits<int>::max(); |
Magnus Jedvert | 6d230d7 | 2017-02-22 18:30:27 +0100 | [diff] [blame] | 63 | if (input_pixels <= max_pixels) { |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 64 | // Start condition for 1/1 case, if it is less than max. |
| 65 | min_pixel_diff = std::abs(input_pixels - target_pixels); |
| 66 | } |
| 67 | |
| 68 | // Alternately scale down by 2/3 and 3/4. This results in fractions which are |
| 69 | // effectively scalable. For instance, starting at 1280x720 will result in |
| 70 | // the series (3/4) => 960x540, (1/2) => 640x360, (3/8) => 480x270, |
| 71 | // (1/4) => 320x180, (3/16) => 240x125, (1/8) => 160x90. |
| 72 | while (current_scale.scale_pixel_count(input_pixels) > target_pixels) { |
| 73 | if (current_scale.numerator % 3 == 0 && |
| 74 | current_scale.denominator % 2 == 0) { |
| 75 | // Multiply by 2/3. |
| 76 | current_scale.numerator /= 3; |
| 77 | current_scale.denominator /= 2; |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 78 | } else { |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 79 | // Multiply by 3/4. |
| 80 | current_scale.numerator *= 3; |
| 81 | current_scale.denominator *= 4; |
| 82 | } |
| 83 | |
| 84 | int output_pixels = current_scale.scale_pixel_count(input_pixels); |
| 85 | if (output_pixels <= max_pixels) { |
| 86 | int diff = std::abs(target_pixels - output_pixels); |
| 87 | if (diff < min_pixel_diff) { |
| 88 | min_pixel_diff = diff; |
| 89 | best_scale = current_scale; |
| 90 | } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 91 | } |
| 92 | } |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 93 | |
wu@webrtc.org | cadf904 | 2013-08-30 21:24:16 +0000 | [diff] [blame] | 94 | return best_scale; |
| 95 | } |
Per | 766ad3b | 2016-04-05 15:23:49 +0200 | [diff] [blame] | 96 | } // namespace |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 97 | |
Per | 766ad3b | 2016-04-05 15:23:49 +0200 | [diff] [blame] | 98 | namespace cricket { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 99 | |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 100 | VideoAdapter::VideoAdapter(int required_resolution_alignment) |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 101 | : frames_in_(0), |
sergeyu@chromium.org | 9cf037b | 2014-02-07 19:03:26 +0000 | [diff] [blame] | 102 | frames_out_(0), |
| 103 | frames_scaled_(0), |
wu@webrtc.org | cadf904 | 2013-08-30 21:24:16 +0000 | [diff] [blame] | 104 | adaption_changes_(0), |
magjed@webrtc.org | a73d746 | 2014-11-14 13:25:25 +0000 | [diff] [blame] | 105 | previous_width_(0), |
| 106 | previous_height_(0), |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 107 | required_resolution_alignment_(required_resolution_alignment), |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 108 | resolution_request_target_pixel_count_(std::numeric_limits<int>::max()), |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 109 | resolution_request_max_pixel_count_(std::numeric_limits<int>::max()), |
| 110 | max_framerate_request_(std::numeric_limits<int>::max()) {} |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 111 | |
| 112 | VideoAdapter::VideoAdapter() : VideoAdapter(1) {} |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 113 | |
Per | 766ad3b | 2016-04-05 15:23:49 +0200 | [diff] [blame] | 114 | VideoAdapter::~VideoAdapter() {} |
| 115 | |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 116 | bool VideoAdapter::KeepFrame(int64_t in_timestamp_ns) { |
Per | 766ad3b | 2016-04-05 15:23:49 +0200 | [diff] [blame] | 117 | rtc::CritScope cs(&critical_section_); |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 118 | if (max_framerate_request_ <= 0) |
| 119 | return false; |
| 120 | |
| 121 | int64_t frame_interval_ns = |
| 122 | requested_format_ ? requested_format_->interval : 0; |
| 123 | |
| 124 | // If |max_framerate_request_| is not set, it will default to maxint, which |
| 125 | // will lead to a frame_interval_ns rounded to 0. |
| 126 | frame_interval_ns = std::max<int64_t>( |
| 127 | frame_interval_ns, rtc::kNumNanosecsPerSec / max_framerate_request_); |
| 128 | |
| 129 | if (frame_interval_ns <= 0) { |
| 130 | // Frame rate throttling not enabled. |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 131 | return true; |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 132 | } |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 133 | |
| 134 | if (next_frame_timestamp_ns_) { |
| 135 | // Time until next frame should be outputted. |
| 136 | const int64_t time_until_next_frame_ns = |
| 137 | (*next_frame_timestamp_ns_ - in_timestamp_ns); |
| 138 | |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 139 | // Continue if timestamp is within expected range. |
| 140 | if (std::abs(time_until_next_frame_ns) < 2 * frame_interval_ns) { |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 141 | // Drop if a frame shouldn't be outputted yet. |
| 142 | if (time_until_next_frame_ns > 0) |
| 143 | return false; |
| 144 | // Time to output new frame. |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 145 | *next_frame_timestamp_ns_ += frame_interval_ns; |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 146 | return true; |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | // First timestamp received or timestamp is way outside expected range, so |
| 151 | // reset. Set first timestamp target to just half the interval to prefer |
| 152 | // keeping frames in case of jitter. |
| 153 | next_frame_timestamp_ns_ = |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 154 | rtc::Optional<int64_t>(in_timestamp_ns + frame_interval_ns / 2); |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 155 | return true; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 156 | } |
| 157 | |
nisse | 47ac462 | 2016-05-25 08:47:01 -0700 | [diff] [blame] | 158 | bool VideoAdapter::AdaptFrameResolution(int in_width, |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 159 | int in_height, |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 160 | int64_t in_timestamp_ns, |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 161 | int* cropped_width, |
| 162 | int* cropped_height, |
| 163 | int* out_width, |
| 164 | int* out_height) { |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 165 | rtc::CritScope cs(&critical_section_); |
sergeyu@chromium.org | 9cf037b | 2014-02-07 19:03:26 +0000 | [diff] [blame] | 166 | ++frames_in_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 167 | |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 168 | // The max output pixel count is the minimum of the requests from |
| 169 | // OnOutputFormatRequest and OnResolutionRequest. |
| 170 | int max_pixel_count = resolution_request_max_pixel_count_; |
| 171 | if (requested_format_) { |
| 172 | max_pixel_count = std::min( |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 173 | max_pixel_count, requested_format_->width * requested_format_->height); |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 174 | } |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 175 | int target_pixel_count = |
| 176 | std::min(resolution_request_target_pixel_count_, max_pixel_count); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 177 | |
| 178 | // Drop the input frame if necessary. |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 179 | if (max_pixel_count <= 0 || !KeepFrame(in_timestamp_ns)) { |
sergeyu@chromium.org | 9cf037b | 2014-02-07 19:03:26 +0000 | [diff] [blame] | 180 | // Show VAdapt log every 90 frames dropped. (3 seconds) |
wu@webrtc.org | b9a088b | 2014-02-13 23:18:49 +0000 | [diff] [blame] | 181 | if ((frames_in_ - frames_out_) % 90 == 0) { |
sergeyu@chromium.org | 9cf037b | 2014-02-07 19:03:26 +0000 | [diff] [blame] | 182 | // TODO(fbarchard): Reduce to LS_VERBOSE when adapter info is not needed |
| 183 | // in default calls. |
wu@webrtc.org | b9a088b | 2014-02-13 23:18:49 +0000 | [diff] [blame] | 184 | LOG(LS_INFO) << "VAdapt Drop Frame: scaled " << frames_scaled_ |
| 185 | << " / out " << frames_out_ |
| 186 | << " / in " << frames_in_ |
sergeyu@chromium.org | 9cf037b | 2014-02-07 19:03:26 +0000 | [diff] [blame] | 187 | << " Changes: " << adaption_changes_ |
magjed@webrtc.org | f58b455 | 2014-11-19 18:09:14 +0000 | [diff] [blame] | 188 | << " Input: " << in_width |
| 189 | << "x" << in_height |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 190 | << " timestamp: " << in_timestamp_ns |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 191 | << " Output: i" |
| 192 | << (requested_format_ ? requested_format_->interval : 0); |
sergeyu@chromium.org | 9cf037b | 2014-02-07 19:03:26 +0000 | [diff] [blame] | 193 | } |
magjed@webrtc.org | f58b455 | 2014-11-19 18:09:14 +0000 | [diff] [blame] | 194 | |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 195 | // Drop frame. |
nisse | 47ac462 | 2016-05-25 08:47:01 -0700 | [diff] [blame] | 196 | return false; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 197 | } |
| 198 | |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 199 | // Calculate how the input should be cropped. |
| 200 | if (!requested_format_ || |
| 201 | requested_format_->width == 0 || requested_format_->height == 0) { |
| 202 | *cropped_width = in_width; |
| 203 | *cropped_height = in_height; |
| 204 | } else { |
| 205 | // Adjust |requested_format_| orientation to match input. |
| 206 | if ((in_width > in_height) != |
| 207 | (requested_format_->width > requested_format_->height)) { |
| 208 | std::swap(requested_format_->width, requested_format_->height); |
| 209 | } |
| 210 | const float requested_aspect = |
| 211 | requested_format_->width / |
| 212 | static_cast<float>(requested_format_->height); |
| 213 | *cropped_width = |
| 214 | std::min(in_width, static_cast<int>(in_height * requested_aspect)); |
| 215 | *cropped_height = |
| 216 | std::min(in_height, static_cast<int>(in_width / requested_aspect)); |
| 217 | } |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 218 | const Fraction scale = FindScale((*cropped_width) * (*cropped_height), |
| 219 | target_pixel_count, max_pixel_count); |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 220 | // Adjust cropping slightly to get even integer output size and a perfect |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 221 | // scale factor. Make sure the resulting dimensions are aligned correctly |
| 222 | // to be nice to hardware encoders. |
| 223 | *cropped_width = |
| 224 | roundUp(*cropped_width, |
| 225 | scale.denominator * required_resolution_alignment_, in_width); |
| 226 | *cropped_height = |
| 227 | roundUp(*cropped_height, |
| 228 | scale.denominator * required_resolution_alignment_, in_height); |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 229 | RTC_DCHECK_EQ(0, *cropped_width % scale.denominator); |
| 230 | RTC_DCHECK_EQ(0, *cropped_height % scale.denominator); |
| 231 | |
| 232 | // Calculate final output size. |
| 233 | *out_width = *cropped_width / scale.denominator * scale.numerator; |
| 234 | *out_height = *cropped_height / scale.denominator * scale.numerator; |
magjed | 4e83682 | 2017-02-28 06:30:59 -0800 | [diff] [blame] | 235 | RTC_DCHECK_EQ(0, *out_width % required_resolution_alignment_); |
kthelgason | c847417 | 2016-12-08 08:04:51 -0800 | [diff] [blame] | 236 | RTC_DCHECK_EQ(0, *out_height % required_resolution_alignment_); |
wu@webrtc.org | cadf904 | 2013-08-30 21:24:16 +0000 | [diff] [blame] | 237 | |
sergeyu@chromium.org | 9cf037b | 2014-02-07 19:03:26 +0000 | [diff] [blame] | 238 | ++frames_out_; |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 239 | if (scale.numerator != scale.denominator) |
sergeyu@chromium.org | 9cf037b | 2014-02-07 19:03:26 +0000 | [diff] [blame] | 240 | ++frames_scaled_; |
sergeyu@chromium.org | 9cf037b | 2014-02-07 19:03:26 +0000 | [diff] [blame] | 241 | |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 242 | if (previous_width_ && (previous_width_ != *out_width || |
| 243 | previous_height_ != *out_height)) { |
wu@webrtc.org | cadf904 | 2013-08-30 21:24:16 +0000 | [diff] [blame] | 244 | ++adaption_changes_; |
Per | 766ad3b | 2016-04-05 15:23:49 +0200 | [diff] [blame] | 245 | LOG(LS_INFO) << "Frame size changed: scaled " << frames_scaled_ << " / out " |
| 246 | << frames_out_ << " / in " << frames_in_ |
| 247 | << " Changes: " << adaption_changes_ << " Input: " << in_width |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 248 | << "x" << in_height |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 249 | << " Scale: " << scale.numerator << "/" << scale.denominator |
| 250 | << " Output: " << *out_width << "x" << *out_height << " i" |
| 251 | << (requested_format_ ? requested_format_->interval : 0); |
wu@webrtc.org | cadf904 | 2013-08-30 21:24:16 +0000 | [diff] [blame] | 252 | } |
magjed@webrtc.org | f58b455 | 2014-11-19 18:09:14 +0000 | [diff] [blame] | 253 | |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 254 | previous_width_ = *out_width; |
| 255 | previous_height_ = *out_height; |
nisse | 47ac462 | 2016-05-25 08:47:01 -0700 | [diff] [blame] | 256 | |
| 257 | return true; |
magjed@webrtc.org | f58b455 | 2014-11-19 18:09:14 +0000 | [diff] [blame] | 258 | } |
| 259 | |
Per | 766ad3b | 2016-04-05 15:23:49 +0200 | [diff] [blame] | 260 | void VideoAdapter::OnOutputFormatRequest(const VideoFormat& format) { |
| 261 | rtc::CritScope cs(&critical_section_); |
magjed | 709f73c | 2016-05-13 10:26:00 -0700 | [diff] [blame] | 262 | requested_format_ = rtc::Optional<VideoFormat>(format); |
magjed | 604abe0 | 2016-05-19 06:05:40 -0700 | [diff] [blame] | 263 | next_frame_timestamp_ns_ = rtc::Optional<int64_t>(); |
henrike@webrtc.org | d43aa9d | 2014-02-21 23:43:24 +0000 | [diff] [blame] | 264 | } |
| 265 | |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 266 | void VideoAdapter::OnResolutionFramerateRequest( |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 267 | const rtc::Optional<int>& target_pixel_count, |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 268 | int max_pixel_count, |
| 269 | int max_framerate_fps) { |
Per | 766ad3b | 2016-04-05 15:23:49 +0200 | [diff] [blame] | 270 | rtc::CritScope cs(&critical_section_); |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 271 | resolution_request_max_pixel_count_ = max_pixel_count; |
sprang | 84a3759 | 2017-02-10 07:04:27 -0800 | [diff] [blame] | 272 | resolution_request_target_pixel_count_ = |
| 273 | target_pixel_count.value_or(resolution_request_max_pixel_count_); |
sprang | c5d62e2 | 2017-04-02 23:53:04 -0700 | [diff] [blame] | 274 | max_framerate_request_ = max_framerate_fps; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | } // namespace cricket |