|
|
|
@ -505,9 +505,9 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
|
|
|
|
|
|
|
|
|
EXPECT_CALL(bitrate_observer, OnBitrateAllocationUpdated(expected_bitrate))
|
|
|
|
|
.Times(1);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0,
|
|
|
|
|
0);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
|
CreateFrame(1, codec_width_, codec_height_));
|
|
|
|
@ -1090,7 +1090,8 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, EncodeOneFrame) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
rtc::Event frame_destroyed_event;
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, &frame_destroyed_event));
|
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
@ -1109,7 +1110,8 @@ TEST_F(VideoStreamEncoderTest, DropsFramesBeforeFirstOnBitrateUpdated) {
|
|
|
|
|
EXPECT_TRUE(frame_destroyed_event.Wait(kDefaultTimeoutMs));
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// The pending frame should be received.
|
|
|
|
|
WaitForEncodedFrame(2);
|
|
|
|
@ -1121,12 +1123,13 @@ TEST_F(VideoStreamEncoderTest, DropsFramesBeforeFirstOnBitrateUpdated) {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFramesWhenRateSetToZero) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(0), DataRate::bps(0), 0,
|
|
|
|
|
0);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(0), DataRate::bps(0),
|
|
|
|
|
DataRate::bps(0), 0, 0);
|
|
|
|
|
// The encoder will cache up to one frame for a short duration. Adding two
|
|
|
|
|
// frames means that the first frame will be dropped and the second frame will
|
|
|
|
|
// be sent when the encoder is resumed.
|
|
|
|
@ -1134,7 +1137,8 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenRateSetToZero) {
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(3, nullptr));
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
WaitForEncodedFrame(3);
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(4, nullptr));
|
|
|
|
|
WaitForEncodedFrame(4);
|
|
|
|
@ -1143,7 +1147,8 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenRateSetToZero) {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFramesWithSameOrOldNtpTimestamp) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
|
|
|
|
|
@ -1157,7 +1162,8 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWithSameOrOldNtpTimestamp) {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFrameAfterStop) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
@ -1171,7 +1177,8 @@ TEST_F(VideoStreamEncoderTest, DropsFrameAfterStop) {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsPendingFramesOnSlowEncode) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
fake_encoder_.BlockNextEncode();
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
@ -1188,7 +1195,8 @@ TEST_F(VideoStreamEncoderTest, DropsPendingFramesOnSlowEncode) {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropFrameWithFailedI420Conversion) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
rtc::Event frame_destroyed_event;
|
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
@ -1208,7 +1216,8 @@ TEST_F(VideoStreamEncoderTest, DropFrameWithFailedI420ConversionWithCrop) {
|
|
|
|
|
|
|
|
|
|
// Capture a frame at codec_width_/codec_height_.
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
|
// The encoder will have been configured once.
|
|
|
|
@ -1229,7 +1238,8 @@ TEST_F(VideoStreamEncoderTest, DropFrameWithFailedI420ConversionWithCrop) {
|
|
|
|
|
TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
ConfigureEncoderTriggersOnEncoderConfigurationChanged) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
EXPECT_EQ(0, sink_.number_of_reconfigurations());
|
|
|
|
|
|
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
@ -1256,7 +1266,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, FrameResolutionChangeReconfigureEncoder) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
@ -1282,7 +1293,8 @@ TEST_F(VideoStreamEncoderTest, FrameResolutionChangeReconfigureEncoder) {
|
|
|
|
|
TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
EncoderInstanceDestroyedBeforeAnotherInstanceCreated) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
@ -1304,7 +1316,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, BitrateLimitsChangeReconfigureRateAllocator) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
VideoEncoderConfig video_encoder_config;
|
|
|
|
|
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
|
|
|
|
@ -1349,7 +1362,8 @@ TEST_F(VideoStreamEncoderTest, BitrateLimitsChangeReconfigureRateAllocator) {
|
|
|
|
|
TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
EncoderRecommendedBitrateLimitsDoNotOverrideAppBitrateLimits) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
VideoEncoderConfig video_encoder_config;
|
|
|
|
|
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
|
|
|
|
@ -1441,7 +1455,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
EncoderRecommendedMaxAndMinBitratesUsedForGivenResolution) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
const VideoEncoder::ResolutionBitrateLimits encoder_bitrate_limits_270p(
|
|
|
|
|
480 * 270, 34 * 1000, 12 * 1000, 1234 * 1000);
|
|
|
|
@ -1509,7 +1524,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, EncoderRecommendedMaxBitrateCapsTargetBitrate) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
VideoEncoderConfig video_encoder_config;
|
|
|
|
|
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
|
|
|
|
@ -1579,7 +1595,8 @@ TEST_F(VideoStreamEncoderTest, TestCpuDowngrades_BalancedMode) {
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_stream_encoder_->SetSource(&video_source_,
|
|
|
|
|
webrtc::DegradationPreference::BALANCED);
|
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
@ -1662,7 +1679,8 @@ TEST_F(VideoStreamEncoderTest, TestCpuDowngrades_BalancedMode) {
|
|
|
|
|
}
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
|
|
|
|
|
|
const int kFrameWidth = 1280;
|
|
|
|
@ -1751,7 +1769,8 @@ TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, StatsTracksQualityAdaptationStats) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -1785,7 +1804,8 @@ TEST_F(VideoStreamEncoderTest, StatsTracksQualityAdaptationStats) {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, StatsTracksCpuAdaptationStats) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -1819,7 +1839,8 @@ TEST_F(VideoStreamEncoderTest, StatsTracksCpuAdaptationStats) {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, SwitchingSourceKeepsCpuAdaptation) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -1888,7 +1909,8 @@ TEST_F(VideoStreamEncoderTest, SwitchingSourceKeepsCpuAdaptation) {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, SwitchingSourceKeepsQualityAdaptation) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -1949,7 +1971,8 @@ TEST_F(VideoStreamEncoderTest, SwitchingSourceKeepsQualityAdaptation) {
|
|
|
|
|
TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
QualityAdaptationStatsAreResetWhenScalerIsDisabled) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -2005,7 +2028,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
StatsTracksCpuAdaptationStatsWhenSwitchingSource) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -2142,7 +2166,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Expect no scaling to begin with.
|
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
@ -2191,7 +2216,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2224,7 +2250,8 @@ TEST_F(VideoStreamEncoderTest, SkipsSameOrLargerAdaptDownRequest_BalancedMode) {
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2265,7 +2292,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2292,7 +2320,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_RESOLUTION preference, no initial limitation.
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2318,7 +2347,8 @@ TEST_F(VideoStreamEncoderTest, NoChangeForInitialNormalUsage_BalancedMode) {
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2346,7 +2376,8 @@ TEST_F(VideoStreamEncoderTest, NoChangeForInitialNormalUsage_DisabledMode) {
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable DISABLED preference, no initial limitation.
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2375,7 +2406,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2413,7 +2445,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
const int kInputFps = 30;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
VideoSendStream::Stats stats = stats_proxy_->GetStats();
|
|
|
|
|
stats.input_frame_rate = kInputFps;
|
|
|
|
@ -2455,7 +2488,8 @@ TEST_F(VideoStreamEncoderTest, DoesNotScaleBelowSetResolutionLimit) {
|
|
|
|
|
const size_t kNumFrames = 10;
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable adapter, expected input resolutions when downscaling:
|
|
|
|
|
// 1280x720 -> 960x540 -> 640x360 -> 480x270 -> 320x180 (kMinPixelsPerFrame)
|
|
|
|
@ -2491,7 +2525,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2550,7 +2585,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2616,9 +2652,9 @@ TEST_F(VideoStreamEncoderTest, NoAdaptUpIfBwEstimateIsLessThanMinBitrate) {
|
|
|
|
|
const int64_t kFrameIntervalMs = 150;
|
|
|
|
|
const int kMinBitrateBps = 425000;
|
|
|
|
|
const int kTooLowMinBitrateBps = 424000;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(kTooLowMinBitrateBps),
|
|
|
|
|
DataRate::bps(kTooLowMinBitrateBps),
|
|
|
|
|
0, 0);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTooLowMinBitrateBps), DataRate::bps(kTooLowMinBitrateBps),
|
|
|
|
|
DataRate::bps(kTooLowMinBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2666,6 +2702,7 @@ TEST_F(VideoStreamEncoderTest, NoAdaptUpIfBwEstimateIsLessThanMinBitrate) {
|
|
|
|
|
|
|
|
|
|
// Trigger adapt up, expect upscaled fps (target bitrate == min bitrate).
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(kMinBitrateBps),
|
|
|
|
|
DataRate::bps(kMinBitrateBps),
|
|
|
|
|
DataRate::bps(kMinBitrateBps), 0, 0);
|
|
|
|
|
video_stream_encoder_->TriggerQualityHigh();
|
|
|
|
|
timestamp_ms += kFrameIntervalMs;
|
|
|
|
@ -2691,6 +2728,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kResolutionMinBitrateBps = 435000;
|
|
|
|
|
const int kTooLowMinResolutionBitrateBps = 434000;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTooLowMinResolutionBitrateBps),
|
|
|
|
|
DataRate::bps(kTooLowMinResolutionBitrateBps),
|
|
|
|
|
DataRate::bps(kTooLowMinResolutionBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
@ -2747,6 +2785,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
// Trigger adapt up, expect upscaled res (target bitrate == min bitrate).
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kResolutionMinBitrateBps),
|
|
|
|
|
DataRate::bps(kResolutionMinBitrateBps),
|
|
|
|
|
DataRate::bps(kResolutionMinBitrateBps), 0, 0);
|
|
|
|
|
video_stream_encoder_->TriggerQualityHigh();
|
|
|
|
@ -2774,9 +2813,9 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kTooLowMinBitrateBps = 424000;
|
|
|
|
|
const int kResolutionMinBitrateBps = 435000;
|
|
|
|
|
const int kTooLowMinResolutionBitrateBps = 434000;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(kTooLowMinBitrateBps),
|
|
|
|
|
DataRate::bps(kTooLowMinBitrateBps),
|
|
|
|
|
0, 0);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTooLowMinBitrateBps), DataRate::bps(kTooLowMinBitrateBps),
|
|
|
|
|
DataRate::bps(kTooLowMinBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2823,6 +2862,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
// Trigger adapt up, expect upscaled fps (target bitrate == min bitrate).
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(kMinBitrateBps),
|
|
|
|
|
DataRate::bps(kMinBitrateBps),
|
|
|
|
|
DataRate::bps(kMinBitrateBps), 0, 0);
|
|
|
|
|
video_stream_encoder_->TriggerQualityHigh();
|
|
|
|
|
timestamp_ms += kFrameIntervalMs;
|
|
|
|
@ -2833,6 +2873,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
// Trigger adapt up, expect no upscale in res (target bitrate < min bitrate).
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTooLowMinResolutionBitrateBps),
|
|
|
|
|
DataRate::bps(kTooLowMinResolutionBitrateBps),
|
|
|
|
|
DataRate::bps(kTooLowMinResolutionBitrateBps), 0, 0);
|
|
|
|
|
video_stream_encoder_->TriggerQualityHigh();
|
|
|
|
@ -2843,6 +2884,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
// Trigger adapt up, expect upscaled res (target bitrate == min bitrate).
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kResolutionMinBitrateBps),
|
|
|
|
|
DataRate::bps(kResolutionMinBitrateBps),
|
|
|
|
|
DataRate::bps(kResolutionMinBitrateBps), 0, 0);
|
|
|
|
|
video_stream_encoder_->TriggerQualityHigh();
|
|
|
|
@ -2860,7 +2902,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
|
const int kHeight = 720;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2998,7 +3041,8 @@ TEST_F(VideoStreamEncoderTest, CpuLimitedHistogramIsReported) {
|
|
|
|
|
const int kHeight = 360;
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) {
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(i, kWidth, kHeight));
|
|
|
|
@ -3025,7 +3069,8 @@ TEST_F(VideoStreamEncoderTest, CpuLimitedHistogramIsReported) {
|
|
|
|
|
TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
CpuLimitedHistogramIsNotReportedForDisabledDegradation) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
const int kWidth = 640;
|
|
|
|
|
const int kHeight = 360;
|
|
|
|
|
|
|
|
|
@ -3057,9 +3102,9 @@ TEST_F(VideoStreamEncoderTest, CallsBitrateObserver) {
|
|
|
|
|
|
|
|
|
|
EXPECT_CALL(bitrate_observer, OnBitrateAllocationUpdated(expected_bitrate))
|
|
|
|
|
.Times(1);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
|
0, 0);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
|
CreateFrame(rtc::TimeMillis(), codec_width_, codec_height_));
|
|
|
|
@ -3164,7 +3209,8 @@ TEST_F(VideoStreamEncoderTest, OveruseDetectorUpdatedOnReconfigureAndAdaption) {
|
|
|
|
|
const int kFramerate = 24;
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
|
&source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
@ -3225,7 +3271,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kHighFramerate = 25;
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
|
&source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
@ -3289,7 +3336,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kFramerate = 24;
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
|
&source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
@ -3335,6 +3383,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFramesAndScalesWhenBitrateIsTooLow) {
|
|
|
|
|
const int kTooLowBitrateForFrameSizeBps = 10000;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps), 0, 0);
|
|
|
|
|
const int kWidth = 640;
|
|
|
|
@ -3366,6 +3415,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
NumberOfDroppedFramesLimitedWhenBitrateIsTooLow) {
|
|
|
|
|
const int kTooLowBitrateForFrameSizeBps = 10000;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps), 0, 0);
|
|
|
|
|
const int kWidth = 640;
|
|
|
|
@ -3391,9 +3441,9 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
InitialFrameDropOffWithMaintainResolutionPreference) {
|
|
|
|
|
const int kWidth = 640;
|
|
|
|
|
const int kHeight = 360;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
|
0, 0);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Set degradation preference.
|
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
@ -3417,9 +3467,9 @@ TEST_F(VideoStreamEncoderTest, InitialFrameDropOffWhenEncoderDisabledScaling) {
|
|
|
|
|
video_encoder_config.video_format.parameters["foo"] = "foo";
|
|
|
|
|
video_stream_encoder_->ConfigureEncoder(std::move(video_encoder_config),
|
|
|
|
|
kMaxPayloadLength);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
|
0, 0);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Force quality scaler reconfiguration by resetting the source.
|
|
|
|
|
video_stream_encoder_->SetSource(&video_source_,
|
|
|
|
@ -3443,12 +3493,14 @@ TEST_F(VideoStreamEncoderTest, InitialFrameDropActivatesWhenBWEstimateReady) {
|
|
|
|
|
const int kHeight = 360;
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
|
|
|
|
// Frame should not be dropped.
|
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
|
|
|
|
@ -3472,12 +3524,14 @@ TEST_F(VideoStreamEncoderTest, InitialFrameDropActivatesWhenBweDrops) {
|
|
|
|
|
const int kHeight = 360;
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
|
|
|
|
// Frame should not be dropped.
|
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kNotTooLowBitrateForFrameSizeBps),
|
|
|
|
|
DataRate::bps(kNotTooLowBitrateForFrameSizeBps),
|
|
|
|
|
DataRate::bps(kNotTooLowBitrateForFrameSizeBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
|
|
|
|
@ -3485,6 +3539,7 @@ TEST_F(VideoStreamEncoderTest, InitialFrameDropActivatesWhenBweDrops) {
|
|
|
|
|
WaitForEncodedFrame(2);
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight));
|
|
|
|
@ -3501,7 +3556,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kTooSmallWidth = 10;
|
|
|
|
|
const int kTooSmallHeight = 10;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -3527,7 +3583,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kTooSmallHeight = 10;
|
|
|
|
|
const int kFpsLimit = 7;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -3561,7 +3618,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, FailingInitEncodeDoesntCauseCrash) {
|
|
|
|
|
fake_encoder_.ForceInitEncodeFailure(true);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
ResetEncoder("VP8", 2, 1, 1, false);
|
|
|
|
|
const int kFrameWidth = 1280;
|
|
|
|
|
const int kFrameHeight = 720;
|
|
|
|
@ -3575,7 +3633,8 @@ TEST_F(VideoStreamEncoderTest, FailingInitEncodeDoesntCauseCrash) {
|
|
|
|
|
TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
AdaptsResolutionOnOveruse_MaintainFramerateMode) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
const int kFrameWidth = 1280;
|
|
|
|
|
const int kFrameHeight = 720;
|
|
|
|
@ -3609,7 +3668,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kFrameHeight = 720;
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
|
&video_source_, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
|
video_source_.set_adaptation_enabled(true);
|
|
|
|
@ -3711,7 +3771,8 @@ TEST_F(VideoStreamEncoderTest, DoesntAdaptDownPastMinFramerate) {
|
|
|
|
|
ResetEncoder("VP8", 1, 2, 1, true);
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
|
&video_source_, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
|
video_source_.set_adaptation_enabled(true);
|
|
|
|
@ -3750,7 +3811,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int64_t kFrameIntervalMs = 150;
|
|
|
|
|
int64_t timestamp_ms = kFrameIntervalMs;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -3931,7 +3993,8 @@ TEST_F(VideoStreamEncoderTest, AdaptWithTwoReasonsAndDifferentOrder_Framerate) {
|
|
|
|
|
const int64_t kFrameIntervalMs = 150;
|
|
|
|
|
int64_t timestamp_ms = kFrameIntervalMs;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -4045,7 +4108,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int64_t kFrameIntervalMs = 150;
|
|
|
|
|
int64_t timestamp_ms = kFrameIntervalMs;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -4134,7 +4198,8 @@ TEST_F(VideoStreamEncoderTest, AcceptsFullHdAdaptedDownSimulcastFrames) {
|
|
|
|
|
const int kFramerate = 24;
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
// Trigger reconfigure encoder (without resetting the entire instance).
|
|
|
|
|
VideoEncoderConfig video_encoder_config;
|
|
|
|
|
video_encoder_config.codec_type = kVideoCodecVP8;
|
|
|
|
@ -4168,7 +4233,8 @@ TEST_F(VideoStreamEncoderTest, PeriodicallyUpdatesChannelParameters) {
|
|
|
|
|
const int kHighFps = 30;
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
|
max_framerate_ = kLowFps;
|
|
|
|
@ -4183,7 +4249,8 @@ TEST_F(VideoStreamEncoderTest, PeriodicallyUpdatesChannelParameters) {
|
|
|
|
|
|
|
|
|
|
// Make sure encoder is updated with new target.
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
|
CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight));
|
|
|
|
|
WaitForEncodedFrame(timestamp_ms);
|
|
|
|
@ -4222,7 +4289,8 @@ TEST_F(VideoStreamEncoderTest, DoesNotUpdateBitrateAllocationWhenSuspended) {
|
|
|
|
|
MockBitrateObserver bitrate_observer;
|
|
|
|
|
video_stream_encoder_->SetBitrateAllocationObserver(&bitrate_observer);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
|
|
|
|
|
|
// Insert a first video frame, causes another bitrate update.
|
|
|
|
@ -4233,8 +4301,8 @@ TEST_F(VideoStreamEncoderTest, DoesNotUpdateBitrateAllocationWhenSuspended) {
|
|
|
|
|
WaitForEncodedFrame(timestamp_ms);
|
|
|
|
|
|
|
|
|
|
// Next, simulate video suspension due to pacer queue overrun.
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(0), DataRate::bps(0), 0,
|
|
|
|
|
1);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(0), DataRate::bps(0),
|
|
|
|
|
DataRate::bps(0), 0, 1);
|
|
|
|
|
|
|
|
|
|
// Skip ahead until a new periodic parameter update should have occured.
|
|
|
|
|
timestamp_ms += vcm::VCMProcessTimer::kDefaultProcessIntervalMs;
|
|
|
|
@ -4256,7 +4324,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
const int kFrameHeight = 720;
|
|
|
|
|
const CpuOveruseOptions default_options;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
|
CreateFrame(1, kFrameWidth, kFrameHeight));
|
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
@ -4279,7 +4348,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
fake_encoder_.SetIsHardwareAccelerated(true);
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
|
CreateFrame(1, kFrameWidth, kFrameHeight));
|
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
@ -4300,7 +4370,8 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenEncoderOvershoots) {
|
|
|
|
|
const int kNumFramesInRun = kFps * 5; // Runs of five seconds.
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
|
max_framerate_ = kFps;
|
|
|
|
@ -4335,6 +4406,7 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenEncoderOvershoots) {
|
|
|
|
|
}
|
|
|
|
|
fake_encoder_.SimulateOvershoot(overshoot_factor);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps + 1000),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps + 1000),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps + 1000), 0, 0);
|
|
|
|
|
num_dropped = 0;
|
|
|
|
@ -4349,7 +4421,8 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenEncoderOvershoots) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Target framerate should be still be near the expected target, despite
|
|
|
|
|
// the frame drops.
|
|
|
|
@ -4372,7 +4445,8 @@ TEST_F(VideoStreamEncoderTest, ConfiguresCorrectFrameRate) {
|
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
|
max_framerate_ = kActualInputFps;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Insert 3 seconds of video, with an input fps lower than configured max.
|
|
|
|
|
for (int i = 0; i < kActualInputFps * 3; ++i) {
|
|
|
|
@ -4391,7 +4465,8 @@ TEST_F(VideoStreamEncoderTest, ConfiguresCorrectFrameRate) {
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, AccumulatesUpdateRectOnDroppedFrames) {
|
|
|
|
|
VideoFrame::UpdateRect rect;
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
fake_encoder_.BlockNextEncode();
|
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
@ -4435,7 +4510,8 @@ TEST_F(VideoStreamEncoderTest, AccumulatesUpdateRectOnDroppedFrames) {
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, SetsFrameTypes) {
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// First frame is always keyframe.
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
@ -4466,6 +4542,7 @@ TEST_F(VideoStreamEncoderTest, SetsFrameTypesSimulcast) {
|
|
|
|
|
// Setup simulcast with three streams.
|
|
|
|
|
ResetEncoder("VP8", 3, 1, 1, false);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kSimulcastTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kSimulcastTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kSimulcastTargetBitrateBps), 0, 0);
|
|
|
|
|
// Wait for all three layers before triggering event.
|
|
|
|
@ -4508,7 +4585,8 @@ TEST_F(VideoStreamEncoderTest, RequestKeyframeInternalSource) {
|
|
|
|
|
encoder_factory_.SetHasInternalSource(true);
|
|
|
|
|
ResetEncoder("VP8", 1, 1, 1, false);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
// Call encoder directly, simulating internal source where encoded frame
|
|
|
|
|
// callback in VideoStreamEncoder is called despite no OnFrame().
|
|
|
|
@ -4545,7 +4623,8 @@ TEST_F(VideoStreamEncoderTest, AdjustsTimestampInternalSource) {
|
|
|
|
|
encoder_factory_.SetHasInternalSource(true);
|
|
|
|
|
ResetEncoder("VP8", 1, 1, 1, false);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
|
|
|
|
|
int64_t timestamp = 1;
|
|
|
|
|
EncodedImage image;
|
|
|
|
@ -4636,7 +4715,8 @@ TEST_F(VideoStreamEncoderTest, CopiesVideoFrameMetadataAfterDownscale) {
|
|
|
|
|
const int kTargetBitrateBps = 300000; // To low for HD resolution.
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
|
|
|
|
|
|
// Insert a first video frame. It should be dropped because of downscale in
|
|
|
|
@ -4676,6 +4756,7 @@ TEST_F(VideoStreamEncoderTest, BandwidthAllocationLowerBound) {
|
|
|
|
|
// Initial rate.
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
/*target_bitrate=*/DataRate::kbps(300),
|
|
|
|
|
/*stable_target_bitrate=*/DataRate::kbps(300),
|
|
|
|
|
/*link_allocation=*/DataRate::kbps(300),
|
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
|
/*rtt_ms=*/0);
|
|
|
|
@ -4693,6 +4774,7 @@ TEST_F(VideoStreamEncoderTest, BandwidthAllocationLowerBound) {
|
|
|
|
|
DataRate target_rate = min_rate - DataRate::kbps(1);
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
/*target_bitrate=*/target_rate,
|
|
|
|
|
/*stable_target_bitrate=*/target_rate,
|
|
|
|
|
/*link_allocation=*/target_rate,
|
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
|
/*rtt_ms=*/0);
|
|
|
|
|