Chromium Code Reviews| Index: webrtc/media/base/videosourceinterface.h |
| diff --git a/webrtc/media/base/videosourceinterface.h b/webrtc/media/base/videosourceinterface.h |
| index 0ea1c60abfa389e5bc236925e25d9bae74e2886d..37a6f72e7a41a0b2e45bad82bff7c31b7ef7b85d 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 ValueRange { |
| + ValueRange() |
| + : min(0), target(std::numeric_limits<uint32_t>::max()), max(target) {} |
| + ValueRange(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; |
|
nisse-webrtc
2017/02/17 08:55:21
This makes it impossible to request min and max va
sprang_webrtc
2017/02/20 15:48:35
I think it's reasonable to explicitly define the t
nisse-webrtc
2017/02/20 16:03:47
I think we need to get a second opinion (or third,
sprang_webrtc
2017/02/21 09:11:03
Yes, I think avoid optional entirely in this case
nisse-webrtc
2017/02/21 09:33:59
The original SinkWants cabal were myself, perkj, p
|
| + // |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<ValueRange> 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<ValueRange> framerate_fps_; |
| }; |
| template <typename VideoFrameT> |