Change rtc::VideoSinkWants to have target and a max pixel count

The current method with max_pixel_count and max_pixel_count_step_up,
where only one should be used at a time and this first signaling an
inclusive upper bound and other other an exclusive lower bound, makes
for a lot of confusion.

I've updated this to have a desired target and a maximum instead. The
source should select a resolution as close to the target as possible,
but no higher than the maximum.

I intend to also add similar frame rate settings in an upcoming cl.

BUG=webrtc:4172,webrtc:6850

Review-Url: https://codereview.webrtc.org/2672793002
Cr-Commit-Position: refs/heads/master@{#16533}
This commit is contained in:
sprang
2017-02-10 07:04:27 -08:00
committed by Commit bot
parent e9ad271db4
commit 84a3759825
14 changed files with 258 additions and 177 deletions

View File

@ -490,13 +490,20 @@ TEST_F(CallPerfTest, ReceivesCpuOveruseAndUnderuse) {
const rtc::VideoSinkWants& wants) override {
// First expect CPU overuse. Then expect CPU underuse when the encoder
// delay has been decreased.
if (wants.max_pixel_count) {
if (wants.target_pixel_count &&
*wants.target_pixel_count <
wants.max_pixel_count.value_or(std::numeric_limits<int>::max())) {
// On adapting up, ViEEncoder::VideoSourceProxy will set the target
// pixel count to a step up from the current and the max value to
// something higher than the target.
EXPECT_FALSE(expect_lower_resolution_wants_);
observation_complete_.Set();
} else if (wants.max_pixel_count) {
// On adapting down, ViEEncoder::VideoSourceProxy will set only the max
// pixel count, leaving the target unset.
EXPECT_TRUE(expect_lower_resolution_wants_);
expect_lower_resolution_wants_ = false;
encoder_.SetDelay(2);
} else if (wants.max_pixel_count_step_up) {
EXPECT_FALSE(expect_lower_resolution_wants_);
observation_complete_.Set();
}
}