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 30 matching lines...) Expand all Loading... | |
41 int* out_height); | 41 int* out_height); |
42 | 42 |
43 // Requests the output frame size and frame interval from | 43 // Requests the output frame size and frame interval from |
44 // |AdaptFrameResolution| to not be larger than |format|. Also, the input | 44 // |AdaptFrameResolution| to not be larger than |format|. Also, the input |
45 // frame size will be cropped to match the requested aspect ratio. The | 45 // frame size will be cropped to match the requested aspect ratio. The |
46 // requested aspect ratio is orientation agnostic and will be adjusted to | 46 // requested aspect ratio is orientation agnostic and will be adjusted to |
47 // maintain the input orientation, so it doesn't matter if e.g. 1280x720 or | 47 // maintain the input orientation, so it doesn't matter if e.g. 1280x720 or |
48 // 720x1280 is requested. | 48 // 720x1280 is requested. |
49 void OnOutputFormatRequest(const VideoFormat& format); | 49 void OnOutputFormatRequest(const VideoFormat& format); |
50 | 50 |
51 // Requests the output frame size from |AdaptFrameResolution| to not have | 51 // Requests the output frame size from |AdaptFrameResolution| to have as close |
52 // more than |max_pixel_count| pixels and have "one step" up more pixels than | 52 // as possible to |target_pixel_count|, but no more than |max_pixel_count| |
53 // max_pixel_count_step_up. | 53 // pixels. If |target_pixel_count| is not set, treat it as being equal to |
54 void OnResolutionRequest(rtc::Optional<int> max_pixel_count, | 54 // |max_pixel_count|. If |max_pixel_count| is not set, treat is as being the |
55 rtc::Optional<int> max_pixel_count_step_up); | 55 // highest resolution available. |
56 void OnResolutionRequest(rtc::Optional<int> target_pixel_count, | |
57 rtc::Optional<int> max_pixel_count); | |
kthelgason
2017/02/06 12:13:20
Maybe we should use this opportunity and change th
sprang_webrtc
2017/02/06 13:18:07
Since we're always gonna have an rtc::Optional in
| |
56 | 58 |
57 private: | 59 private: |
58 // Determine if frame should be dropped based on input fps and requested fps. | 60 // Determine if frame should be dropped based on input fps and requested fps. |
59 bool KeepFrame(int64_t in_timestamp_ns); | 61 bool KeepFrame(int64_t in_timestamp_ns); |
60 | 62 |
61 int frames_in_; // Number of input frames. | 63 int frames_in_; // Number of input frames. |
62 int frames_out_; // Number of output frames. | 64 int frames_out_; // Number of output frames. |
63 int frames_scaled_; // Number of frames scaled. | 65 int frames_scaled_; // Number of frames scaled. |
64 int adaption_changes_; // Number of changes in scale factor. | 66 int adaption_changes_; // Number of changes in scale factor. |
65 int previous_width_; // Previous adapter output width. | 67 int previous_width_; // Previous adapter output width. |
66 int previous_height_; // Previous adapter output height. | 68 int previous_height_; // Previous adapter output height. |
67 // Resolution must be divisible by this factor. | 69 // Resolution must be divisible by this factor. |
68 const int required_resolution_alignment_; | 70 const int required_resolution_alignment_; |
69 // The target timestamp for the next frame based on requested format. | 71 // The target timestamp for the next frame based on requested format. |
70 rtc::Optional<int64_t> next_frame_timestamp_ns_ GUARDED_BY(critical_section_); | 72 rtc::Optional<int64_t> next_frame_timestamp_ns_ GUARDED_BY(critical_section_); |
71 | 73 |
72 // Max number of pixels requested via calls to OnOutputFormatRequest, | 74 // Max number of pixels requested via calls to OnOutputFormatRequest, |
73 // OnResolutionRequest respectively. | 75 // OnResolutionRequest respectively. |
74 // The adapted output format is the minimum of these. | 76 // The adapted output format is the minimum of these. |
75 rtc::Optional<VideoFormat> requested_format_ GUARDED_BY(critical_section_); | 77 rtc::Optional<VideoFormat> requested_format_ GUARDED_BY(critical_section_); |
78 int resolution_request_target_pixel_count_ GUARDED_BY(critical_section_); | |
76 int resolution_request_max_pixel_count_ GUARDED_BY(critical_section_); | 79 int resolution_request_max_pixel_count_ GUARDED_BY(critical_section_); |
77 bool step_up_ GUARDED_BY(critical_section_); | |
78 | 80 |
79 // The critical section to protect the above variables. | 81 // The critical section to protect the above variables. |
80 rtc::CriticalSection critical_section_; | 82 rtc::CriticalSection critical_section_; |
81 | 83 |
82 RTC_DISALLOW_COPY_AND_ASSIGN(VideoAdapter); | 84 RTC_DISALLOW_COPY_AND_ASSIGN(VideoAdapter); |
83 }; | 85 }; |
84 | 86 |
85 } // namespace cricket | 87 } // namespace cricket |
86 | 88 |
87 #endif // WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ | 89 #endif // WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ |
OLD | NEW |