Communicate encoder resolutions via rtc::VideoSinkWants.
This will allow us to optimize the internal buffers of
webrtc::VideoFrame for the resolution(s) that we actually want to
encode.
Bug: webrtc:12469, chromium:1157072
Change-Id: If378b52b5e35aa9a9800c1f7dfe189437ce43253
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/208540
Reviewed-by: Niels Moller <nisse@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33342}
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index 6591ab5..4cb9766 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -561,6 +561,18 @@
// TODO(sprang): Add integration test for maintain-framerate mode?
void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) override {
+ // The sink wants can change either because an adaptation happened (i.e.
+ // the pixels or frame rate changed) or for other reasons, such as encoded
+ // resolutions being communicated (happens whenever we capture a new frame
+ // size). In this test, we only care about adaptations.
+ bool did_adapt =
+ last_wants_.max_pixel_count != wants.max_pixel_count ||
+ last_wants_.target_pixel_count != wants.target_pixel_count ||
+ last_wants_.max_framerate_fps != wants.max_framerate_fps;
+ last_wants_ = wants;
+ if (!did_adapt) {
+ return;
+ }
// At kStart expect CPU overuse. Then expect CPU underuse when the encoder
// delay has been decreased.
switch (test_phase_) {
@@ -625,6 +637,9 @@
kAdaptedDown,
kAdaptedUp
} test_phase_;
+
+ private:
+ rtc::VideoSinkWants last_wants_;
} test;
RunBaseTest(&test);