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