Index: webrtc/media/base/videosourceinterface.h |
diff --git a/webrtc/media/base/videosourceinterface.h b/webrtc/media/base/videosourceinterface.h |
index 0ea1c60abfa389e5bc236925e25d9bae74e2886d..7ac212bd7557edb5a5c6bb1558e504cfb3e282e6 100644 |
--- a/webrtc/media/base/videosourceinterface.h |
+++ b/webrtc/media/base/videosourceinterface.h |
@@ -26,14 +26,43 @@ struct VideoSinkWants { |
// Tells the source that the sink only wants black frames. |
bool black_frames = false; |
- // Tells the source the maximum number of pixels the sink wants. |
- rtc::Optional<int> max_pixel_count; |
+ // Indicates a range some value should be constrained to, such as resolution |
+ // (pixel count) or frame rate. It is up to the application code to make sure |
+ // |min| <= |target| <= |max|. |
+ struct Range { |
+ Range() |
+ : min(0), target(std::numeric_limits<uint32_t>::max()), max(target) {} |
+ Range(uint32_t min, uint32_t target, uint32_t max) |
+ : min(min), target(target), max(max) {} |
+ |
+ // |min| = 0, indicates no lower bound. |
+ uint32_t min; |
+ // |target| = maxint by default - requesting highest option available. |
+ uint32_t target; |
+ // |max| = maxint, indicates to upper bound. |
+ uint32_t max; |
+ }; |
+ |
// Tells the source the desired number of pixels the sinks wants. This will |
- // typically be used when stepping the resolution up again when conditions |
- // have improved after an earlier downgrade. The source should select the |
- // closest resolution to this pixel count, but if max_pixel_count is set, it |
- // still sets the absolute upper bound. |
- rtc::Optional<int> target_pixel_count; |
+ // typically be used when stepping the resolution down or up again as resource |
+ // constraints are imposed or lifted. |
+ // |
+ // For example, when stepping down resolution on CPU overuse, it's preferable |
+ // to set the max just below the current resolution but the target to a |
+ // resolution that it is assumed would result in a utilization the system can |
+ // handle. The source should select a resolution as close to |target| as |
+ // possible, but no higher than |max|. Then |min| limit can then be set so |
+ // that user requested minimum resolution bounds aren't violated. |
+ // |
+ // Similarly, when stepping up again, the |min| limit can be set one higher |
+ // than the current resolution, and |target| to something reasonably higher |
+ // (probably matching the step size down). The |max| limit can be set to |
+ // avoid too large input. |
+ rtc::Optional<Range> pixel_count; |
+ |
+ // These constraints work in just the same manner as the pixel_count ones, but |
+ // instead of limiting resolution they limit the framerate. |
+ rtc::Optional<Range> framerate_fps_; |
}; |
template <typename VideoFrameT> |