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 |
11 #include "webrtc/media/base/videoadapter.h" | 11 #include "webrtc/media/base/videoadapter.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <cmath> | 14 #include <cmath> |
15 #include <cstdlib> | 15 #include <cstdlib> |
16 #include <limits> | 16 #include <limits> |
17 | 17 |
| 18 #include "webrtc/api/optional.h" |
18 #include "webrtc/media/base/mediaconstants.h" | 19 #include "webrtc/media/base/mediaconstants.h" |
19 #include "webrtc/media/base/videocommon.h" | 20 #include "webrtc/media/base/videocommon.h" |
20 #include "webrtc/rtc_base/arraysize.h" | 21 #include "webrtc/rtc_base/arraysize.h" |
21 #include "webrtc/rtc_base/checks.h" | 22 #include "webrtc/rtc_base/checks.h" |
22 #include "webrtc/rtc_base/logging.h" | 23 #include "webrtc/rtc_base/logging.h" |
23 #include "webrtc/rtc_base/optional.h" | |
24 | 24 |
25 namespace { | 25 namespace { |
26 struct Fraction { | 26 struct Fraction { |
27 int numerator; | 27 int numerator; |
28 int denominator; | 28 int denominator; |
29 | 29 |
30 // Determines number of output pixels if both width and height of an input of | 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. | 31 // |input_pixels| pixels is scaled with the fraction numerator / denominator. |
32 int scale_pixel_count(int input_pixels) { | 32 int scale_pixel_count(int input_pixels) { |
33 return (numerator * numerator * input_pixels) / (denominator * denominator); | 33 return (numerator * numerator * input_pixels) / (denominator * denominator); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 int max_pixel_count, | 268 int max_pixel_count, |
269 int max_framerate_fps) { | 269 int max_framerate_fps) { |
270 rtc::CritScope cs(&critical_section_); | 270 rtc::CritScope cs(&critical_section_); |
271 resolution_request_max_pixel_count_ = max_pixel_count; | 271 resolution_request_max_pixel_count_ = max_pixel_count; |
272 resolution_request_target_pixel_count_ = | 272 resolution_request_target_pixel_count_ = |
273 target_pixel_count.value_or(resolution_request_max_pixel_count_); | 273 target_pixel_count.value_or(resolution_request_max_pixel_count_); |
274 max_framerate_request_ = max_framerate_fps; | 274 max_framerate_request_ = max_framerate_fps; |
275 } | 275 } |
276 | 276 |
277 } // namespace cricket | 277 } // namespace cricket |
OLD | NEW |