Reland "Add initial support for RtpEncodingParameters max_framerate."
This reverts commit 948b7e37557af68b3bc9b81b29ae2daffb2784ad. Reason for revert: downstream project fixed. Original change's description: > Revert "Add initial support for RtpEncodingParameters max_framerate." > > This reverts commit ced5cfdb35a20c684df927eab37e16d35979555f. > > Reason for revert: Breaks downstream project. > > Original change's description: > > Add initial support for RtpEncodingParameters max_framerate. > > > > Add support to set the framerate to the maximum of |max_framerate|. > > Different framerates are currently not supported per stream for video. > > > > Bug: webrtc:9597 > > Change-Id: Ie326617b66bd97be387f809a7f82b97b8f3ff5fe > > Reviewed-on: https://webrtc-review.googlesource.com/92392 > > Reviewed-by: Sebastian Jansson <srte@webrtc.org> > > Reviewed-by: Erik Språng <sprang@webrtc.org> > > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > > Reviewed-by: Steve Anton <steveanton@webrtc.org> > > Commit-Queue: Åsa Persson <asapersson@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24270} > > TBR=steveanton@webrtc.org,magjed@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org,srte@webrtc.org > > Change-Id: I508fe48e0c53996654f657357913ac307dc256bd > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: webrtc:9597 > Reviewed-on: https://webrtc-review.googlesource.com/94060 > Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24277} TBR=steveanton@webrtc.org,mbonadei@webrtc.org,magjed@webrtc.org,asapersson@webrtc.org,sprang@webrtc.org,srte@webrtc.org Bug: webrtc:9597 Change-Id: Ieed9d62787f3e9dcb439399bfe7529012292381e Reviewed-on: https://webrtc-review.googlesource.com/100080 Reviewed-by: Åsa Persson <asapersson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24720}
This commit is contained in:
@ -32,13 +32,6 @@
|
||||
#include "video/send_statistics_proxy.h"
|
||||
#include "video/video_stream_encoder.h"
|
||||
|
||||
namespace {
|
||||
const int kMinPixelsPerFrame = 320 * 180;
|
||||
const int kMinFramerateFps = 2;
|
||||
const int kMinBalancedFramerateFps = 7;
|
||||
const int64_t kFrameTimeoutMs = 100;
|
||||
} // namespace
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
using ScaleReason = AdaptationObserverInterface::AdaptReason;
|
||||
@ -46,11 +39,16 @@ using ::testing::_;
|
||||
using ::testing::Return;
|
||||
|
||||
namespace {
|
||||
const int kMinPixelsPerFrame = 320 * 180;
|
||||
const int kMinFramerateFps = 2;
|
||||
const int kMinBalancedFramerateFps = 7;
|
||||
const int64_t kFrameTimeoutMs = 100;
|
||||
const size_t kMaxPayloadLength = 1440;
|
||||
const int kTargetBitrateBps = 1000000;
|
||||
const int kLowTargetBitrateBps = kTargetBitrateBps / 10;
|
||||
const int kMaxInitialFramedrop = 4;
|
||||
const int kDefaultFramerate = 30;
|
||||
const int64_t kFrameIntervalMs = rtc::kNumMillisecsPerSec / kDefaultFramerate;
|
||||
|
||||
class TestBuffer : public webrtc::I420Buffer {
|
||||
public:
|
||||
@ -276,7 +274,7 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
||||
: video_send_config_(VideoSendStream::Config(nullptr)),
|
||||
codec_width_(320),
|
||||
codec_height_(240),
|
||||
max_framerate_(30),
|
||||
max_framerate_(kDefaultFramerate),
|
||||
fake_encoder_(),
|
||||
encoder_factory_(&fake_encoder_),
|
||||
stats_proxy_(new MockableSendStatisticsProxy(
|
||||
@ -379,22 +377,28 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
||||
EXPECT_EQ(wants1.max_pixel_count, wants2.max_pixel_count);
|
||||
}
|
||||
|
||||
void VerifyFpsMaxResolutionMax(const rtc::VideoSinkWants& wants) {
|
||||
EXPECT_EQ(kDefaultFramerate, wants.max_framerate_fps);
|
||||
EXPECT_EQ(std::numeric_limits<int>::max(), wants.max_pixel_count);
|
||||
EXPECT_FALSE(wants.target_pixel_count);
|
||||
}
|
||||
|
||||
void VerifyFpsMaxResolutionLt(const rtc::VideoSinkWants& wants1,
|
||||
const rtc::VideoSinkWants& wants2) {
|
||||
EXPECT_EQ(std::numeric_limits<int>::max(), wants1.max_framerate_fps);
|
||||
EXPECT_EQ(kDefaultFramerate, wants1.max_framerate_fps);
|
||||
EXPECT_LT(wants1.max_pixel_count, wants2.max_pixel_count);
|
||||
EXPECT_GT(wants1.max_pixel_count, 0);
|
||||
}
|
||||
|
||||
void VerifyFpsMaxResolutionGt(const rtc::VideoSinkWants& wants1,
|
||||
const rtc::VideoSinkWants& wants2) {
|
||||
EXPECT_EQ(std::numeric_limits<int>::max(), wants1.max_framerate_fps);
|
||||
EXPECT_EQ(kDefaultFramerate, wants1.max_framerate_fps);
|
||||
EXPECT_GT(wants1.max_pixel_count, wants2.max_pixel_count);
|
||||
}
|
||||
|
||||
void VerifyFpsMaxResolutionEq(const rtc::VideoSinkWants& wants1,
|
||||
const rtc::VideoSinkWants& wants2) {
|
||||
EXPECT_EQ(std::numeric_limits<int>::max(), wants1.max_framerate_fps);
|
||||
EXPECT_EQ(kDefaultFramerate, wants1.max_framerate_fps);
|
||||
EXPECT_EQ(wants1.max_pixel_count, wants2.max_pixel_count);
|
||||
}
|
||||
|
||||
@ -425,7 +429,7 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
||||
|
||||
void VerifyFpsMaxResolutionLt(const rtc::VideoSinkWants& wants,
|
||||
int pixel_count) {
|
||||
EXPECT_EQ(std::numeric_limits<int>::max(), wants.max_framerate_fps);
|
||||
EXPECT_EQ(kDefaultFramerate, wants.max_framerate_fps);
|
||||
EXPECT_LT(wants.max_pixel_count, pixel_count);
|
||||
EXPECT_GT(wants.max_pixel_count, 0);
|
||||
}
|
||||
@ -455,7 +459,7 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
||||
} else if (last_frame_pixels <= 640 * 480) {
|
||||
EXPECT_LE(15, fps_limit);
|
||||
} else {
|
||||
EXPECT_EQ(std::numeric_limits<int>::max(), fps_limit);
|
||||
EXPECT_EQ(kDefaultFramerate, fps_limit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -936,7 +940,7 @@ TEST_F(VideoStreamEncoderTest, TestCpuDowngrades_BalancedMode) {
|
||||
last_wants.max_framerate_fps);
|
||||
}
|
||||
|
||||
VerifyNoLimitation(video_source_.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(video_source_.sink_wants());
|
||||
stats_proxy_->ResetMockStats();
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_framerate);
|
||||
@ -951,9 +955,8 @@ TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
||||
|
||||
const int kFrameWidth = 1280;
|
||||
const int kFrameHeight = 720;
|
||||
const int kFrameIntervalMs = 1000 / 30;
|
||||
|
||||
int frame_timestamp = 1;
|
||||
int64_t frame_timestamp = 1;
|
||||
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(frame_timestamp, kFrameWidth, kFrameHeight));
|
||||
@ -972,8 +975,7 @@ TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
||||
EXPECT_FALSE(video_source_.sink_wants().target_pixel_count);
|
||||
EXPECT_LT(video_source_.sink_wants().max_pixel_count,
|
||||
kFrameWidth * kFrameHeight);
|
||||
EXPECT_EQ(std::numeric_limits<int>::max(),
|
||||
video_source_.sink_wants().max_framerate_fps);
|
||||
EXPECT_EQ(kDefaultFramerate, video_source_.sink_wants().max_framerate_fps);
|
||||
|
||||
// Set new source, switch to maintain-resolution.
|
||||
test::FrameForwarder new_video_source;
|
||||
@ -981,7 +983,7 @@ TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
||||
&new_video_source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
||||
|
||||
// Initially no degradation registered.
|
||||
VerifyNoLimitation(new_video_source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(new_video_source.sink_wants());
|
||||
|
||||
// Force an input frame rate to be available, or the adaptation call won't
|
||||
// know what framerate to adapt form.
|
||||
@ -1005,7 +1007,7 @@ TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
||||
// Turn off degradation completely.
|
||||
video_stream_encoder_->SetSource(&new_video_source,
|
||||
webrtc::DegradationPreference::DISABLED);
|
||||
VerifyNoLimitation(new_video_source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(new_video_source.sink_wants());
|
||||
|
||||
video_stream_encoder_->TriggerCpuOveruse();
|
||||
new_video_source.IncomingCapturedFrame(
|
||||
@ -1014,7 +1016,7 @@ TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
||||
frame_timestamp += kFrameIntervalMs;
|
||||
|
||||
// Still no degradation.
|
||||
VerifyNoLimitation(new_video_source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(new_video_source.sink_wants());
|
||||
|
||||
// Calling SetSource with resolution scaling enabled apply the old SinkWants.
|
||||
video_stream_encoder_->SetSource(
|
||||
@ -1022,8 +1024,7 @@ TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
||||
EXPECT_LT(new_video_source.sink_wants().max_pixel_count,
|
||||
kFrameWidth * kFrameHeight);
|
||||
EXPECT_FALSE(new_video_source.sink_wants().target_pixel_count);
|
||||
EXPECT_EQ(std::numeric_limits<int>::max(),
|
||||
new_video_source.sink_wants().max_framerate_fps);
|
||||
EXPECT_EQ(kDefaultFramerate, new_video_source.sink_wants().max_framerate_fps);
|
||||
|
||||
// Calling SetSource with framerate scaling enabled apply the old SinkWants.
|
||||
video_stream_encoder_->SetSource(
|
||||
@ -1235,25 +1236,31 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
const int kWidth = 1280;
|
||||
const int kHeight = 720;
|
||||
int64_t timestamp_ms = kFrameIntervalMs;
|
||||
video_source_.set_adaptation_enabled(true);
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
WaitForEncodedFrame(1);
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
// Trigger adapt down.
|
||||
video_stream_encoder_->TriggerQualityLow();
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
|
||||
WaitForEncodedFrame(2);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
// Trigger overuse.
|
||||
video_stream_encoder_->TriggerCpuOveruse();
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight));
|
||||
WaitForEncodedFrame(3);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
@ -1267,9 +1274,10 @@ TEST_F(VideoStreamEncoderTest,
|
||||
video_encoder_config.video_format.parameters["foo"] = "foo";
|
||||
video_stream_encoder_->ConfigureEncoder(std::move(video_encoder_config),
|
||||
kMaxPayloadLength);
|
||||
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight));
|
||||
WaitForEncodedFrame(4);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
@ -1472,7 +1480,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
WaitForEncodedFrame(1);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
@ -1503,7 +1511,7 @@ TEST_F(VideoStreamEncoderTest, SkipsSameOrLargerAdaptDownRequest_BalancedMode) {
|
||||
webrtc::DegradationPreference::BALANCED);
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(1);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
|
||||
// Trigger adapt down, expect scaled down resolution.
|
||||
video_stream_encoder_->TriggerQualityLow();
|
||||
@ -1544,13 +1552,13 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
// Trigger adapt up, expect no change.
|
||||
video_stream_encoder_->TriggerCpuNormalUsage();
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
@ -1570,13 +1578,13 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_framerate);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
// Trigger adapt up, expect no change.
|
||||
video_stream_encoder_->TriggerCpuNormalUsage();
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_framerate);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
@ -1595,14 +1603,14 @@ TEST_F(VideoStreamEncoderTest, NoChangeForInitialNormalUsage_BalancedMode) {
|
||||
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_framerate);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
// Trigger adapt up, expect no change.
|
||||
video_stream_encoder_->TriggerQualityHigh();
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_framerate);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
@ -1622,14 +1630,14 @@ TEST_F(VideoStreamEncoderTest, NoChangeForInitialNormalUsage_DisabledMode) {
|
||||
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_framerate);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
// Trigger adapt up, expect no change.
|
||||
video_stream_encoder_->TriggerQualityHigh();
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_framerate);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
@ -1651,7 +1659,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
WaitForEncodedFrame(1);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
@ -1665,7 +1673,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger adapt up, expect no restriction.
|
||||
video_stream_encoder_->TriggerQualityHigh();
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(2, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
@ -1687,7 +1695,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
// Expect no scaling to begin with (preference: MAINTAIN_FRAMERATE).
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(1);
|
||||
VerifyNoLimitation(video_source_.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(video_source_.sink_wants());
|
||||
|
||||
// Trigger adapt down, expect scaled down resolution.
|
||||
video_stream_encoder_->TriggerQualityLow();
|
||||
@ -1699,7 +1707,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
test::FrameForwarder new_video_source;
|
||||
video_stream_encoder_->SetSource(
|
||||
&new_video_source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
||||
VerifyNoLimitation(new_video_source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(new_video_source.sink_wants());
|
||||
|
||||
// Trigger adapt down, expect reduced framerate.
|
||||
video_stream_encoder_->TriggerQualityLow();
|
||||
@ -1709,7 +1717,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger adapt up, expect no restriction.
|
||||
video_stream_encoder_->TriggerQualityHigh();
|
||||
VerifyNoLimitation(new_video_source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(new_video_source.sink_wants());
|
||||
|
||||
video_stream_encoder_->Stop();
|
||||
}
|
||||
@ -1730,8 +1738,9 @@ TEST_F(VideoStreamEncoderTest, DoesNotScaleBelowSetResolutionLimit) {
|
||||
|
||||
int downscales = 0;
|
||||
for (size_t i = 1; i <= kNumFrames; i++) {
|
||||
video_source_.IncomingCapturedFrame(CreateFrame(i, kWidth, kHeight));
|
||||
WaitForEncodedFrame(i);
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(i * kFrameIntervalMs, kWidth, kHeight));
|
||||
WaitForEncodedFrame(i * kFrameIntervalMs);
|
||||
|
||||
// Trigger scale down.
|
||||
rtc::VideoSinkWants last_wants = video_source_.sink_wants();
|
||||
@ -1761,41 +1770,46 @@ TEST_F(VideoStreamEncoderTest,
|
||||
video_stream_encoder_->SetSource(
|
||||
&source, webrtc::DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
int64_t timestamp_ms = kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
// Trigger adapt down, expect scaled down resolution.
|
||||
video_stream_encoder_->TriggerCpuOveruse();
|
||||
source.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
|
||||
WaitForEncodedFrame(2);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionLt(source.sink_wants(), kWidth * kHeight);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
// Trigger adapt up, expect no restriction.
|
||||
video_stream_encoder_->TriggerCpuNormalUsage();
|
||||
source.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight));
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_EQ(2, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
// Trigger adapt down, expect scaled down resolution.
|
||||
video_stream_encoder_->TriggerCpuOveruse();
|
||||
source.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight));
|
||||
WaitForEncodedFrame(4);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionLt(source.sink_wants(), kWidth * kHeight);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_EQ(3, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
// Trigger adapt up, expect no restriction.
|
||||
video_stream_encoder_->TriggerCpuNormalUsage();
|
||||
source.IncomingCapturedFrame(CreateFrame(5, kWidth, kHeight));
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_EQ(4, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
@ -1814,41 +1828,46 @@ TEST_F(VideoStreamEncoderTest,
|
||||
video_stream_encoder_->SetSource(&source,
|
||||
webrtc::DegradationPreference::BALANCED);
|
||||
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
int64_t timestamp_ms = kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
// Trigger adapt down, expect scaled down resolution.
|
||||
video_stream_encoder_->TriggerQualityLow();
|
||||
source.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(2);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionLt(source.sink_wants(), kWidth * kHeight);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(1, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
// Trigger adapt up, expect no restriction.
|
||||
video_stream_encoder_->TriggerQualityHigh();
|
||||
source.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight));
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(2, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
// Trigger adapt down, expect scaled down resolution.
|
||||
video_stream_encoder_->TriggerQualityLow();
|
||||
source.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(4);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionLt(source.sink_wants(), kWidth * kHeight);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(3, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
// Trigger adapt up, expect no restriction.
|
||||
video_stream_encoder_->TriggerQualityHigh();
|
||||
source.IncomingCapturedFrame(CreateFrame(5, kWidth, kHeight));
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
sink_.WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(4, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
@ -1867,9 +1886,10 @@ TEST_F(VideoStreamEncoderTest,
|
||||
video_stream_encoder_->SetSource(
|
||||
&source, webrtc::DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
||||
int64_t timestamp_ms = kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
@ -1877,8 +1897,9 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger cpu adapt down, expect scaled down resolution (960x540).
|
||||
video_stream_encoder_->TriggerCpuOveruse();
|
||||
source.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
|
||||
WaitForEncodedFrame(2);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionLt(source.sink_wants(), kWidth * kHeight);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
@ -1887,8 +1908,9 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger cpu adapt down, expect scaled down resolution (640x360).
|
||||
video_stream_encoder_->TriggerCpuOveruse();
|
||||
source.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight));
|
||||
WaitForEncodedFrame(3);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionLt(source.sink_wants(), source.last_wants());
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
@ -1897,8 +1919,9 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger cpu adapt down, expect scaled down resolution (480x270).
|
||||
video_stream_encoder_->TriggerCpuOveruse();
|
||||
source.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight));
|
||||
WaitForEncodedFrame(4);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionLt(source.sink_wants(), source.last_wants());
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
@ -1907,8 +1930,9 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger quality adapt down, expect scaled down resolution (320x180).
|
||||
video_stream_encoder_->TriggerQualityLow();
|
||||
source.IncomingCapturedFrame(CreateFrame(5, kWidth, kHeight));
|
||||
WaitForEncodedFrame(5);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionLt(source.sink_wants(), source.last_wants());
|
||||
rtc::VideoSinkWants last_wants = source.sink_wants();
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
@ -1918,8 +1942,9 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger quality adapt down, expect no change (min resolution reached).
|
||||
video_stream_encoder_->TriggerQualityLow();
|
||||
source.IncomingCapturedFrame(CreateFrame(6, kWidth, kHeight));
|
||||
WaitForEncodedFrame(6);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionEq(source.sink_wants(), last_wants);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
@ -1928,8 +1953,9 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger cpu adapt up, expect upscaled resolution (480x270).
|
||||
video_stream_encoder_->TriggerCpuNormalUsage();
|
||||
source.IncomingCapturedFrame(CreateFrame(7, kWidth, kHeight));
|
||||
WaitForEncodedFrame(7);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionGt(source.sink_wants(), source.last_wants());
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
@ -1938,8 +1964,9 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger cpu adapt up, expect upscaled resolution (640x360).
|
||||
video_stream_encoder_->TriggerCpuNormalUsage();
|
||||
source.IncomingCapturedFrame(CreateFrame(8, kWidth, kHeight));
|
||||
WaitForEncodedFrame(8);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionGt(source.sink_wants(), source.last_wants());
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
@ -1948,8 +1975,9 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger cpu adapt up, expect upscaled resolution (960x540).
|
||||
video_stream_encoder_->TriggerCpuNormalUsage();
|
||||
source.IncomingCapturedFrame(CreateFrame(9, kWidth, kHeight));
|
||||
WaitForEncodedFrame(9);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsMaxResolutionGt(source.sink_wants(), source.last_wants());
|
||||
last_wants = source.sink_wants();
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
@ -1959,8 +1987,9 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger cpu adapt up, no cpu downgrades, expect no change (960x540).
|
||||
video_stream_encoder_->TriggerCpuNormalUsage();
|
||||
source.IncomingCapturedFrame(CreateFrame(10, kWidth, kHeight));
|
||||
WaitForEncodedFrame(10);
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyFpsEqResolutionEq(source.sink_wants(), last_wants);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
@ -1969,10 +1998,11 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger quality adapt up, expect no restriction (1280x720).
|
||||
video_stream_encoder_->TriggerQualityHigh();
|
||||
source.IncomingCapturedFrame(CreateFrame(11, kWidth, kHeight));
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyFpsMaxResolutionGt(source.sink_wants(), source.last_wants());
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_EQ(6, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
@ -2376,7 +2406,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
source.IncomingCapturedFrame(CreateFrame(1, kTooSmallWidth, kTooSmallHeight));
|
||||
WaitForEncodedFrame(1);
|
||||
video_stream_encoder_->TriggerCpuOveruse();
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
|
||||
@ -2444,19 +2474,19 @@ TEST_F(VideoStreamEncoderTest,
|
||||
video_source_.set_adaptation_enabled(true);
|
||||
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(1, kFrameWidth, kFrameHeight));
|
||||
CreateFrame(1 * kFrameIntervalMs, kFrameWidth, kFrameHeight));
|
||||
WaitForEncodedFrame(kFrameWidth, kFrameHeight);
|
||||
|
||||
// Trigger CPU overuse, downscale by 3/4.
|
||||
video_stream_encoder_->TriggerCpuOveruse();
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(2, kFrameWidth, kFrameHeight));
|
||||
CreateFrame(2 * kFrameIntervalMs, kFrameWidth, kFrameHeight));
|
||||
WaitForEncodedFrame((kFrameWidth * 3) / 4, (kFrameHeight * 3) / 4);
|
||||
|
||||
// Trigger CPU normal use, return to original resolution.
|
||||
video_stream_encoder_->TriggerCpuNormalUsage();
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(3, kFrameWidth, kFrameHeight));
|
||||
CreateFrame(3 * kFrameIntervalMs, kFrameWidth, kFrameHeight));
|
||||
WaitForEncodedFrame(kFrameWidth, kFrameHeight);
|
||||
|
||||
video_stream_encoder_->Stop();
|
||||
@ -2466,7 +2496,6 @@ TEST_F(VideoStreamEncoderTest,
|
||||
AdaptsFramerateOnOveruse_MaintainResolutionMode) {
|
||||
const int kFrameWidth = 1280;
|
||||
const int kFrameHeight = 720;
|
||||
int kFrameIntervalMs = rtc::kNumMillisecsPerSec / max_framerate_;
|
||||
|
||||
video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
|
||||
video_stream_encoder_->SetSource(
|
||||
@ -2512,7 +2541,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
// Trigger CPU overuse, reduce framerate by 2/3 again.
|
||||
video_stream_encoder_->TriggerCpuOveruse();
|
||||
num_frames_dropped = 0;
|
||||
for (int i = 0; i < max_framerate_; ++i) {
|
||||
for (int i = 0; i <= max_framerate_; ++i) {
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
video_source_.IncomingCapturedFrame(
|
||||
CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight));
|
||||
@ -2618,7 +2647,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_framerate);
|
||||
EXPECT_EQ(0, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
@ -2770,14 +2799,14 @@ TEST_F(VideoStreamEncoderTest,
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyFpsMaxResolutionGt(source.sink_wants(), source.last_wants());
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_framerate);
|
||||
EXPECT_EQ(14, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
// Trigger adapt up, expect no change.
|
||||
video_stream_encoder_->TriggerQualityHigh();
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_EQ(14, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
video_stream_encoder_->Stop();
|
||||
@ -2798,7 +2827,7 @@ TEST_F(VideoStreamEncoderTest, AdaptWithTwoReasonsAndDifferentOrder_Framerate) {
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_framerate);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
@ -2877,7 +2906,7 @@ TEST_F(VideoStreamEncoderTest, AdaptWithTwoReasonsAndDifferentOrder_Framerate) {
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyFpsMaxResolutionGt(source.sink_wants(), source.last_wants());
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_framerate);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
@ -2887,7 +2916,7 @@ TEST_F(VideoStreamEncoderTest, AdaptWithTwoReasonsAndDifferentOrder_Framerate) {
|
||||
|
||||
// Trigger adapt up, expect no change.
|
||||
video_stream_encoder_->TriggerQualityHigh();
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_EQ(4, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
EXPECT_EQ(2, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
@ -2911,7 +2940,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(kWidth, kHeight);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_framerate);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
@ -2963,7 +2992,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
timestamp_ms += kFrameIntervalMs;
|
||||
source.IncomingCapturedFrame(CreateFrame(timestamp_ms, kWidth, kHeight));
|
||||
WaitForEncodedFrame(timestamp_ms);
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_framerate);
|
||||
EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
|
||||
@ -2973,7 +3002,7 @@ TEST_F(VideoStreamEncoderTest,
|
||||
|
||||
// Trigger adapt up, expect no change.
|
||||
video_stream_encoder_->TriggerQualityHigh();
|
||||
VerifyNoLimitation(source.sink_wants());
|
||||
VerifyFpsMaxResolutionMax(source.sink_wants());
|
||||
EXPECT_EQ(2, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
|
||||
EXPECT_EQ(2, stats_proxy_->GetStats().number_of_quality_adapt_changes);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user