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 #ifndef WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ // NOLINT | 11 #ifndef WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ // NOLINT |
12 #define WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ | 12 #define WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ |
13 | 13 |
14 #include "webrtc/base/common.h" // For ASSERT | 14 #include "webrtc/base/common.h" // For ASSERT |
15 #include "webrtc/base/criticalsection.h" | 15 #include "webrtc/base/criticalsection.h" |
| 16 #include "webrtc/base/optional.h" |
16 #include "webrtc/base/sigslot.h" | 17 #include "webrtc/base/sigslot.h" |
17 #include "webrtc/media/base/videocommon.h" | 18 #include "webrtc/media/base/videocommon.h" |
18 | 19 |
19 namespace cricket { | 20 namespace cricket { |
20 | 21 |
21 class VideoFrame; | 22 class VideoFrame; |
22 | 23 |
23 // VideoAdapter adapts an input video frame to an output frame based on the | 24 // VideoAdapter adapts an input video frame to an output frame based on the |
24 // specified input and output formats. The adaptation includes dropping frames | 25 // specified input and output formats. The adaptation includes dropping frames |
25 // to reduce frame rate and scaling frames. VideoAdapter is thread safe. | 26 // to reduce frame rate and scaling frames. VideoAdapter is thread safe. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // CPU process load threshold for reducing resolution. e.g. 0.10f | 133 // CPU process load threshold for reducing resolution. e.g. 0.10f |
133 void set_process_threshold(float process_threshold); | 134 void set_process_threshold(float process_threshold); |
134 float process_threshold() const { return process_threshold_; } | 135 float process_threshold() const { return process_threshold_; } |
135 | 136 |
136 // Handle the format request from the server via Jingle update message. | 137 // Handle the format request from the server via Jingle update message. |
137 void OnOutputFormatRequest(const VideoFormat& format); | 138 void OnOutputFormatRequest(const VideoFormat& format); |
138 // Handle the resolution request from the encoder due to bandwidth changes. | 139 // Handle the resolution request from the encoder due to bandwidth changes. |
139 void OnEncoderResolutionRequest(int width, int height, AdaptRequest request); | 140 void OnEncoderResolutionRequest(int width, int height, AdaptRequest request); |
140 // Handle the resolution request for CPU overuse. | 141 // Handle the resolution request for CPU overuse. |
141 void OnCpuResolutionRequest(AdaptRequest request); | 142 void OnCpuResolutionRequest(AdaptRequest request); |
| 143 void OnCpuResolutionRequest(rtc::Optional<int> max_pixel_count, |
| 144 rtc::Optional<int> max_pixel_count_step_up); |
| 145 |
142 // Handle the CPU load provided by a CPU monitor. | 146 // Handle the CPU load provided by a CPU monitor. |
143 void OnCpuLoadUpdated(int current_cpus, int max_cpus, | 147 void OnCpuLoadUpdated(int current_cpus, int max_cpus, |
144 float process_load, float system_load); | 148 float process_load, float system_load); |
145 | 149 |
146 sigslot::signal0<> SignalCpuAdaptationUnable; | 150 sigslot::signal0<> SignalCpuAdaptationUnable; |
147 | 151 |
148 private: | 152 private: |
149 // Adapt to the minimum of the formats the server requests, the CPU wants, and | 153 // Adapt to the minimum of the formats the server requests, the CPU wants, and |
150 // the encoder wants. Returns true if resolution changed. | 154 // the encoder wants. Returns true if resolution changed. |
151 bool AdaptToMinimumFormat(int* new_width, int* new_height); | 155 bool AdaptToMinimumFormat(int* new_width, int* new_height); |
(...skipping 30 matching lines...) Expand all Loading... |
182 // The weighted average of cpu load over time. It's always updated (if cpu | 186 // The weighted average of cpu load over time. It's always updated (if cpu |
183 // adaptation is on), but only used if cpu_smoothing_ is set. | 187 // adaptation is on), but only used if cpu_smoothing_ is set. |
184 float system_load_average_; | 188 float system_load_average_; |
185 | 189 |
186 RTC_DISALLOW_COPY_AND_ASSIGN(CoordinatedVideoAdapter); | 190 RTC_DISALLOW_COPY_AND_ASSIGN(CoordinatedVideoAdapter); |
187 }; | 191 }; |
188 | 192 |
189 } // namespace cricket | 193 } // namespace cricket |
190 | 194 |
191 #endif // WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ // NOLINT | 195 #endif // WEBRTC_MEDIA_BASE_VIDEOADAPTER_H_ // NOLINT |
OLD | NEW |