|
|
|
@ -547,7 +547,7 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
|
|
|
.Times(1);
|
|
|
|
.Times(1);
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
CreateFrame(1, codec_width_, codec_height_));
|
|
|
|
CreateFrame(1, codec_width_, codec_height_));
|
|
|
|
@ -1157,7 +1157,7 @@ class VideoStreamEncoderTest : public ::testing::Test {
|
|
|
|
TEST_F(VideoStreamEncoderTest, EncodeOneFrame) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, EncodeOneFrame) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
rtc::Event frame_destroyed_event;
|
|
|
|
rtc::Event frame_destroyed_event;
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, &frame_destroyed_event));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, &frame_destroyed_event));
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
@ -1177,7 +1177,7 @@ TEST_F(VideoStreamEncoderTest, DropsFramesBeforeFirstOnBitrateUpdated) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// The pending frame should be received.
|
|
|
|
// The pending frame should be received.
|
|
|
|
WaitForEncodedFrame(2);
|
|
|
|
WaitForEncodedFrame(2);
|
|
|
|
@ -1190,12 +1190,12 @@ TEST_F(VideoStreamEncoderTest, DropsFramesBeforeFirstOnBitrateUpdated) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFramesWhenRateSetToZero) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFramesWhenRateSetToZero) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(0), DataRate::bps(0),
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(0), DataRate::bps(0),
|
|
|
|
DataRate::bps(0), 0, 0);
|
|
|
|
DataRate::bps(0), 0, 0, 0);
|
|
|
|
// The encoder will cache up to one frame for a short duration. Adding two
|
|
|
|
// 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
|
|
|
|
// frames means that the first frame will be dropped and the second frame will
|
|
|
|
// be sent when the encoder is resumed.
|
|
|
|
// be sent when the encoder is resumed.
|
|
|
|
@ -1204,7 +1204,7 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenRateSetToZero) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
WaitForEncodedFrame(3);
|
|
|
|
WaitForEncodedFrame(3);
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(4, nullptr));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(4, nullptr));
|
|
|
|
WaitForEncodedFrame(4);
|
|
|
|
WaitForEncodedFrame(4);
|
|
|
|
@ -1214,7 +1214,7 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenRateSetToZero) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFramesWithSameOrOldNtpTimestamp) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFramesWithSameOrOldNtpTimestamp) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
|
|
|
|
|
|
|
|
@ -1229,7 +1229,7 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWithSameOrOldNtpTimestamp) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFrameAfterStop) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFrameAfterStop) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
@ -1244,7 +1244,7 @@ TEST_F(VideoStreamEncoderTest, DropsFrameAfterStop) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsPendingFramesOnSlowEncode) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsPendingFramesOnSlowEncode) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
fake_encoder_.BlockNextEncode();
|
|
|
|
fake_encoder_.BlockNextEncode();
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
@ -1262,7 +1262,7 @@ TEST_F(VideoStreamEncoderTest, DropsPendingFramesOnSlowEncode) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropFrameWithFailedI420Conversion) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropFrameWithFailedI420Conversion) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
rtc::Event frame_destroyed_event;
|
|
|
|
rtc::Event frame_destroyed_event;
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
@ -1283,7 +1283,7 @@ TEST_F(VideoStreamEncoderTest, DropFrameWithFailedI420ConversionWithCrop) {
|
|
|
|
// Capture a frame at codec_width_/codec_height_.
|
|
|
|
// Capture a frame at codec_width_/codec_height_.
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
// The encoder will have been configured once.
|
|
|
|
// The encoder will have been configured once.
|
|
|
|
@ -1301,11 +1301,34 @@ TEST_F(VideoStreamEncoderTest, DropFrameWithFailedI420ConversionWithCrop) {
|
|
|
|
video_stream_encoder_->Stop();
|
|
|
|
video_stream_encoder_->Stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest, DropsFramesWhenCongestionWindowPushbackSet) {
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0.5);
|
|
|
|
|
|
|
|
// The congestion window pushback is set to 0.5, which will drop 1/2 of
|
|
|
|
|
|
|
|
// frames. Adding two frames means that the first frame will be dropped and
|
|
|
|
|
|
|
|
// the second frame will be sent to the encoder.
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(2, nullptr));
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(3, nullptr));
|
|
|
|
|
|
|
|
WaitForEncodedFrame(3);
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(4, nullptr));
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(5, nullptr));
|
|
|
|
|
|
|
|
WaitForEncodedFrame(5);
|
|
|
|
|
|
|
|
EXPECT_EQ(2u, stats_proxy_->GetStats().frames_dropped_by_congestion_window);
|
|
|
|
|
|
|
|
video_stream_encoder_->Stop();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TEST_F(VideoStreamEncoderTest,
|
|
|
|
TEST_F(VideoStreamEncoderTest,
|
|
|
|
ConfigureEncoderTriggersOnEncoderConfigurationChanged) {
|
|
|
|
ConfigureEncoderTriggersOnEncoderConfigurationChanged) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
EXPECT_EQ(0, sink_.number_of_reconfigurations());
|
|
|
|
EXPECT_EQ(0, sink_.number_of_reconfigurations());
|
|
|
|
|
|
|
|
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
@ -1333,7 +1356,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
TEST_F(VideoStreamEncoderTest, FrameResolutionChangeReconfigureEncoder) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, FrameResolutionChangeReconfigureEncoder) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
@ -1360,7 +1383,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
EncoderInstanceDestroyedBeforeAnotherInstanceCreated) {
|
|
|
|
EncoderInstanceDestroyedBeforeAnotherInstanceCreated) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
@ -1383,7 +1406,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
TEST_F(VideoStreamEncoderTest, BitrateLimitsChangeReconfigureRateAllocator) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, BitrateLimitsChangeReconfigureRateAllocator) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
VideoEncoderConfig video_encoder_config;
|
|
|
|
VideoEncoderConfig video_encoder_config;
|
|
|
|
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
|
|
|
|
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
|
|
|
|
@ -1429,7 +1452,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
IntersectionOfEncoderAndAppBitrateLimitsUsedWhenBothProvided) {
|
|
|
|
IntersectionOfEncoderAndAppBitrateLimitsUsedWhenBothProvided) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t kMinEncBitrateKbps = 100;
|
|
|
|
const uint32_t kMinEncBitrateKbps = 100;
|
|
|
|
const uint32_t kMaxEncBitrateKbps = 1000;
|
|
|
|
const uint32_t kMaxEncBitrateKbps = 1000;
|
|
|
|
@ -1476,7 +1499,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
EncoderAndAppLimitsDontIntersectEncoderLimitsIgnored) {
|
|
|
|
EncoderAndAppLimitsDontIntersectEncoderLimitsIgnored) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t kMinAppBitrateKbps = 100;
|
|
|
|
const uint32_t kMinAppBitrateKbps = 100;
|
|
|
|
const uint32_t kMaxAppBitrateKbps = 200;
|
|
|
|
const uint32_t kMaxAppBitrateKbps = 200;
|
|
|
|
@ -1511,7 +1534,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
EncoderRecommendedMaxAndMinBitratesUsedForGivenResolution) {
|
|
|
|
EncoderRecommendedMaxAndMinBitratesUsedForGivenResolution) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
const VideoEncoder::ResolutionBitrateLimits encoder_bitrate_limits_270p(
|
|
|
|
const VideoEncoder::ResolutionBitrateLimits encoder_bitrate_limits_270p(
|
|
|
|
480 * 270, 34 * 1000, 12 * 1000, 1234 * 1000);
|
|
|
|
480 * 270, 34 * 1000, 12 * 1000, 1234 * 1000);
|
|
|
|
@ -1580,7 +1603,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
TEST_F(VideoStreamEncoderTest, EncoderRecommendedMaxBitrateCapsTargetBitrate) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, EncoderRecommendedMaxBitrateCapsTargetBitrate) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
VideoEncoderConfig video_encoder_config;
|
|
|
|
VideoEncoderConfig video_encoder_config;
|
|
|
|
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
|
|
|
|
test::FillEncoderConfiguration(kVideoCodecVP8, 1, &video_encoder_config);
|
|
|
|
@ -1645,7 +1668,7 @@ TEST_F(VideoStreamEncoderTest, SinkWantsResolutionAlignment) {
|
|
|
|
fake_encoder_.SetRequestedResolutionAlignment(kRequestedResolutionAlignment);
|
|
|
|
fake_encoder_.SetRequestedResolutionAlignment(kRequestedResolutionAlignment);
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// On the 1st frame, we should have initialized the encoder and
|
|
|
|
// On the 1st frame, we should have initialized the encoder and
|
|
|
|
// asked for its resolution requirements.
|
|
|
|
// asked for its resolution requirements.
|
|
|
|
@ -1678,7 +1701,7 @@ TEST_F(VideoStreamEncoderTest, TestCpuDowngrades_BalancedMode) {
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_stream_encoder_->SetSource(&video_source_,
|
|
|
|
video_stream_encoder_->SetSource(&video_source_,
|
|
|
|
webrtc::DegradationPreference::BALANCED);
|
|
|
|
webrtc::DegradationPreference::BALANCED);
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
@ -1763,7 +1786,7 @@ TEST_F(VideoStreamEncoderTest, TestCpuDowngrades_BalancedMode) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
|
|
|
|
|
|
|
|
const int kFrameWidth = 1280;
|
|
|
|
const int kFrameWidth = 1280;
|
|
|
|
@ -1876,7 +1899,7 @@ TEST_F(VideoStreamEncoderTest, SinkWantsStoredByDegradationPreference) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, StatsTracksQualityAdaptationStats) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, StatsTracksQualityAdaptationStats) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -1911,7 +1934,7 @@ TEST_F(VideoStreamEncoderTest, StatsTracksQualityAdaptationStats) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, StatsTracksCpuAdaptationStats) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, StatsTracksCpuAdaptationStats) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -1946,7 +1969,7 @@ TEST_F(VideoStreamEncoderTest, StatsTracksCpuAdaptationStats) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, SwitchingSourceKeepsCpuAdaptation) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, SwitchingSourceKeepsCpuAdaptation) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -2016,7 +2039,7 @@ TEST_F(VideoStreamEncoderTest, SwitchingSourceKeepsCpuAdaptation) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, SwitchingSourceKeepsQualityAdaptation) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, SwitchingSourceKeepsQualityAdaptation) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -2078,7 +2101,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
QualityAdaptationStatsAreResetWhenScalerIsDisabled) {
|
|
|
|
QualityAdaptationStatsAreResetWhenScalerIsDisabled) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -2135,7 +2158,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
StatsTracksCpuAdaptationStatsWhenSwitchingSource) {
|
|
|
|
StatsTracksCpuAdaptationStatsWhenSwitchingSource) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
@ -2273,7 +2296,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Expect no scaling to begin with.
|
|
|
|
// Expect no scaling to begin with.
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
@ -2323,7 +2346,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2357,7 +2380,7 @@ TEST_F(VideoStreamEncoderTest, SkipsSameOrLargerAdaptDownRequest_BalancedMode) {
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2399,7 +2422,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2427,7 +2450,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_RESOLUTION preference, no initial limitation.
|
|
|
|
// Enable MAINTAIN_RESOLUTION preference, no initial limitation.
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2454,7 +2477,7 @@ TEST_F(VideoStreamEncoderTest, NoChangeForInitialNormalUsage_BalancedMode) {
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2483,7 +2506,7 @@ TEST_F(VideoStreamEncoderTest, NoChangeForInitialNormalUsage_DisabledMode) {
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable DISABLED preference, no initial limitation.
|
|
|
|
// Enable DISABLED preference, no initial limitation.
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -2513,7 +2536,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2552,7 +2575,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kInputFps = 30;
|
|
|
|
const int kInputFps = 30;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
VideoSendStream::Stats stats = stats_proxy_->GetStats();
|
|
|
|
VideoSendStream::Stats stats = stats_proxy_->GetStats();
|
|
|
|
stats.input_frame_rate = kInputFps;
|
|
|
|
stats.input_frame_rate = kInputFps;
|
|
|
|
@ -2599,7 +2622,7 @@ TEST_F(VideoStreamEncoderTest, DoesNotScaleBelowSetResolutionLimit) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable adapter, expected input resolutions when downscaling:
|
|
|
|
// Enable adapter, expected input resolutions when downscaling:
|
|
|
|
// 1280x720 -> 960x540 -> 640x360 -> 480x270 -> 320x180 (kMinPixelsPerFrame)
|
|
|
|
// 1280x720 -> 960x540 -> 640x360 -> 480x270 -> 320x180 (kMinPixelsPerFrame)
|
|
|
|
@ -2636,7 +2659,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2696,7 +2719,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2757,7 +2780,7 @@ TEST_F(VideoStreamEncoderTest, AdaptUpIfBwEstimateIsHigherThanMinBitrate) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps), 0, 0);
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2774,7 +2797,7 @@ TEST_F(VideoStreamEncoderTest, AdaptUpIfBwEstimateIsHigherThanMinBitrate) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps), 0, 0);
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps), 0, 0, 0);
|
|
|
|
video_stream_encoder_->TriggerQualityLow();
|
|
|
|
video_stream_encoder_->TriggerQualityLow();
|
|
|
|
|
|
|
|
|
|
|
|
// Insert 720p frame. It should be downscaled and encoded.
|
|
|
|
// Insert 720p frame. It should be downscaled and encoded.
|
|
|
|
@ -2791,7 +2814,7 @@ TEST_F(VideoStreamEncoderTest, AdaptUpIfBwEstimateIsHigherThanMinBitrate) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps), 0, 0);
|
|
|
|
DataRate::bps(kEncoderBitrateLimits720p.min_start_bitrate_bps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Trigger adapt up. Higher resolution should be requested.
|
|
|
|
// Trigger adapt up. Higher resolution should be requested.
|
|
|
|
video_stream_encoder_->TriggerQualityHigh();
|
|
|
|
video_stream_encoder_->TriggerQualityHigh();
|
|
|
|
@ -2808,7 +2831,7 @@ TEST_F(VideoStreamEncoderTest, DropFirstFramesIfBwEstimateIsTooLow) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps),
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps), 0, 0);
|
|
|
|
DataRate::bps(kEncoderBitrateLimits540p.min_start_bitrate_bps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -2844,9 +2867,9 @@ class BalancedDegradationTest : public VideoStreamEncoderTest {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OnBitrateUpdated(int bitrate_bps) {
|
|
|
|
void OnBitrateUpdated(int bitrate_bps) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(bitrate_bps),
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(bitrate_bps),
|
|
|
|
DataRate::bps(bitrate_bps), DataRate::bps(bitrate_bps),
|
|
|
|
DataRate::bps(bitrate_bps), 0, 0);
|
|
|
|
DataRate::bps(bitrate_bps), 0, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsertFrame() {
|
|
|
|
void InsertFrame() {
|
|
|
|
@ -3132,7 +3155,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kHeight = 720;
|
|
|
|
const int kHeight = 720;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -3271,7 +3294,7 @@ TEST_F(VideoStreamEncoderTest, CpuLimitedHistogramIsReported) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) {
|
|
|
|
for (int i = 1; i <= SendStatisticsProxy::kMinRequiredMetricsSamples; ++i) {
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(i, kWidth, kHeight));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(i, kWidth, kHeight));
|
|
|
|
@ -3299,7 +3322,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
CpuLimitedHistogramIsNotReportedForDisabledDegradation) {
|
|
|
|
CpuLimitedHistogramIsNotReportedForDisabledDegradation) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
const int kWidth = 640;
|
|
|
|
const int kWidth = 640;
|
|
|
|
const int kHeight = 360;
|
|
|
|
const int kHeight = 360;
|
|
|
|
|
|
|
|
|
|
|
|
@ -3333,7 +3356,7 @@ TEST_F(VideoStreamEncoderTest, CallsBitrateObserver) {
|
|
|
|
.Times(1);
|
|
|
|
.Times(1);
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
CreateFrame(rtc::TimeMillis(), codec_width_, codec_height_));
|
|
|
|
CreateFrame(rtc::TimeMillis(), codec_width_, codec_height_));
|
|
|
|
@ -3441,7 +3464,7 @@ TEST_F(VideoStreamEncoderTest, OveruseDetectorUpdatedOnReconfigureAndAdaption) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
&source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
&source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
@ -3503,7 +3526,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
&source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
&source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
@ -3568,7 +3591,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
&source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
&source, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
@ -3616,7 +3639,7 @@ TEST_F(VideoStreamEncoderTest, DropsFramesAndScalesWhenBitrateIsTooLow) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps), 0, 0);
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps), 0, 0, 0);
|
|
|
|
const int kWidth = 640;
|
|
|
|
const int kWidth = 640;
|
|
|
|
const int kHeight = 360;
|
|
|
|
const int kHeight = 360;
|
|
|
|
|
|
|
|
|
|
|
|
@ -3648,7 +3671,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps), 0, 0);
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps), 0, 0, 0);
|
|
|
|
const int kWidth = 640;
|
|
|
|
const int kWidth = 640;
|
|
|
|
const int kHeight = 360;
|
|
|
|
const int kHeight = 360;
|
|
|
|
|
|
|
|
|
|
|
|
@ -3674,7 +3697,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kHeight = 360;
|
|
|
|
const int kHeight = 360;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Set degradation preference.
|
|
|
|
// Set degradation preference.
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
@ -3700,7 +3723,7 @@ TEST_F(VideoStreamEncoderTest, InitialFrameDropOffWhenEncoderDisabledScaling) {
|
|
|
|
kMaxPayloadLength);
|
|
|
|
kMaxPayloadLength);
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), DataRate::bps(kLowTargetBitrateBps),
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kLowTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Force quality scaler reconfiguration by resetting the source.
|
|
|
|
// Force quality scaler reconfiguration by resetting the source.
|
|
|
|
video_stream_encoder_->SetSource(&video_source_,
|
|
|
|
video_stream_encoder_->SetSource(&video_source_,
|
|
|
|
@ -3727,7 +3750,7 @@ TEST_F(VideoStreamEncoderTest, InitialFrameDropActivatesWhenBweDrops) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
|
|
|
|
// Frame should not be dropped.
|
|
|
|
// Frame should not be dropped.
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
@ -3735,7 +3758,7 @@ TEST_F(VideoStreamEncoderTest, InitialFrameDropActivatesWhenBweDrops) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kNotTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kNotTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kNotTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kNotTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kNotTooLowBitrateForFrameSizeBps), 0, 0);
|
|
|
|
DataRate::bps(kNotTooLowBitrateForFrameSizeBps), 0, 0, 0);
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
|
|
|
|
// Frame should not be dropped.
|
|
|
|
// Frame should not be dropped.
|
|
|
|
WaitForEncodedFrame(2);
|
|
|
|
WaitForEncodedFrame(2);
|
|
|
|
@ -3743,7 +3766,7 @@ TEST_F(VideoStreamEncoderTest, InitialFrameDropActivatesWhenBweDrops) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps),
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps), 0, 0);
|
|
|
|
DataRate::bps(kTooLowBitrateForFrameSizeBps), 0, 0, 0);
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight));
|
|
|
|
// Expect to drop this frame, the wait should time out.
|
|
|
|
// Expect to drop this frame, the wait should time out.
|
|
|
|
ExpectDroppedFrame();
|
|
|
|
ExpectDroppedFrame();
|
|
|
|
@ -3771,9 +3794,9 @@ TEST_F(VideoStreamEncoderTest, RampsUpInQualityWhenBwIsHigh) {
|
|
|
|
|
|
|
|
|
|
|
|
// Start at low bitrate.
|
|
|
|
// Start at low bitrate.
|
|
|
|
const int kLowBitrateBps = 200000;
|
|
|
|
const int kLowBitrateBps = 200000;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(kLowBitrateBps),
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kLowBitrateBps),
|
|
|
|
DataRate::bps(kLowBitrateBps), DataRate::bps(kLowBitrateBps),
|
|
|
|
DataRate::bps(kLowBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kLowBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Expect first frame to be dropped and resolution to be limited.
|
|
|
|
// Expect first frame to be dropped and resolution to be limited.
|
|
|
|
const int kWidth = 1280;
|
|
|
|
const int kWidth = 1280;
|
|
|
|
@ -3788,7 +3811,7 @@ TEST_F(VideoStreamEncoderTest, RampsUpInQualityWhenBwIsHigh) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(config.max_bitrate_bps),
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(config.max_bitrate_bps),
|
|
|
|
DataRate::bps(config.max_bitrate_bps),
|
|
|
|
DataRate::bps(config.max_bitrate_bps),
|
|
|
|
DataRate::bps(config.max_bitrate_bps),
|
|
|
|
DataRate::bps(config.max_bitrate_bps),
|
|
|
|
0, 0);
|
|
|
|
0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Insert frames and advance |min_duration_ms|.
|
|
|
|
// Insert frames and advance |min_duration_ms|.
|
|
|
|
for (size_t i = 1; i <= 10; i++) {
|
|
|
|
for (size_t i = 1; i <= 10; i++) {
|
|
|
|
@ -3822,7 +3845,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kTooSmallHeight = 10;
|
|
|
|
const int kTooSmallHeight = 10;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
// Enable MAINTAIN_FRAMERATE preference, no initial limitation.
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -3849,7 +3872,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const int kFpsLimit = 7;
|
|
|
|
const int kFpsLimit = 7;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
test::FrameForwarder source;
|
|
|
|
test::FrameForwarder source;
|
|
|
|
@ -3884,7 +3907,7 @@ TEST_F(VideoStreamEncoderTest, FailingInitEncodeDoesntCauseCrash) {
|
|
|
|
fake_encoder_.ForceInitEncodeFailure(true);
|
|
|
|
fake_encoder_.ForceInitEncodeFailure(true);
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
ResetEncoder("VP8", 2, 1, 1, false);
|
|
|
|
ResetEncoder("VP8", 2, 1, 1, false);
|
|
|
|
const int kFrameWidth = 1280;
|
|
|
|
const int kFrameWidth = 1280;
|
|
|
|
const int kFrameHeight = 720;
|
|
|
|
const int kFrameHeight = 720;
|
|
|
|
@ -3899,7 +3922,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
AdaptsResolutionOnOveruse_MaintainFramerateMode) {
|
|
|
|
AdaptsResolutionOnOveruse_MaintainFramerateMode) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
const int kFrameWidth = 1280;
|
|
|
|
const int kFrameWidth = 1280;
|
|
|
|
const int kFrameHeight = 720;
|
|
|
|
const int kFrameHeight = 720;
|
|
|
|
@ -3934,7 +3957,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
&video_source_, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
&video_source_, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
video_source_.set_adaptation_enabled(true);
|
|
|
|
video_source_.set_adaptation_enabled(true);
|
|
|
|
@ -4037,7 +4060,7 @@ TEST_F(VideoStreamEncoderTest, DoesntAdaptDownPastMinFramerate) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
video_stream_encoder_->SetSource(
|
|
|
|
&video_source_, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
&video_source_, webrtc::DegradationPreference::MAINTAIN_RESOLUTION);
|
|
|
|
video_source_.set_adaptation_enabled(true);
|
|
|
|
video_source_.set_adaptation_enabled(true);
|
|
|
|
@ -4077,7 +4100,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
int64_t timestamp_ms = kFrameIntervalMs;
|
|
|
|
int64_t timestamp_ms = kFrameIntervalMs;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -4259,7 +4282,7 @@ TEST_F(VideoStreamEncoderTest, AdaptWithTwoReasonsAndDifferentOrder_Framerate) {
|
|
|
|
int64_t timestamp_ms = kFrameIntervalMs;
|
|
|
|
int64_t timestamp_ms = kFrameIntervalMs;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -4374,7 +4397,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
int64_t timestamp_ms = kFrameIntervalMs;
|
|
|
|
int64_t timestamp_ms = kFrameIntervalMs;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
// Enable BALANCED preference, no initial limitation.
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
AdaptingFrameForwarder source;
|
|
|
|
@ -4464,7 +4487,7 @@ TEST_F(VideoStreamEncoderTest, AcceptsFullHdAdaptedDownSimulcastFrames) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
// Trigger reconfigure encoder (without resetting the entire instance).
|
|
|
|
// Trigger reconfigure encoder (without resetting the entire instance).
|
|
|
|
VideoEncoderConfig video_encoder_config;
|
|
|
|
VideoEncoderConfig video_encoder_config;
|
|
|
|
video_encoder_config.codec_type = kVideoCodecVP8;
|
|
|
|
video_encoder_config.codec_type = kVideoCodecVP8;
|
|
|
|
@ -4499,7 +4522,7 @@ TEST_F(VideoStreamEncoderTest, PeriodicallyUpdatesChannelParameters) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
max_framerate_ = kLowFps;
|
|
|
|
max_framerate_ = kLowFps;
|
|
|
|
@ -4515,7 +4538,7 @@ TEST_F(VideoStreamEncoderTest, PeriodicallyUpdatesChannelParameters) {
|
|
|
|
// Make sure encoder is updated with new target.
|
|
|
|
// Make sure encoder is updated with new target.
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight));
|
|
|
|
CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight));
|
|
|
|
WaitForEncodedFrame(timestamp_ms);
|
|
|
|
WaitForEncodedFrame(timestamp_ms);
|
|
|
|
@ -4554,7 +4577,7 @@ TEST_F(VideoStreamEncoderTest, DoesNotUpdateBitrateAllocationWhenSuspended) {
|
|
|
|
video_stream_encoder_->SetBitrateAllocationObserver(&bitrate_observer);
|
|
|
|
video_stream_encoder_->SetBitrateAllocationObserver(&bitrate_observer);
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
|
|
|
|
|
|
|
|
// Insert a first video frame, causes another bitrate update.
|
|
|
|
// Insert a first video frame, causes another bitrate update.
|
|
|
|
@ -4566,7 +4589,7 @@ TEST_F(VideoStreamEncoderTest, DoesNotUpdateBitrateAllocationWhenSuspended) {
|
|
|
|
|
|
|
|
|
|
|
|
// Next, simulate video suspension due to pacer queue overrun.
|
|
|
|
// Next, simulate video suspension due to pacer queue overrun.
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(0), DataRate::bps(0),
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(DataRate::bps(0), DataRate::bps(0),
|
|
|
|
DataRate::bps(0), 0, 1);
|
|
|
|
DataRate::bps(0), 0, 1, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Skip ahead until a new periodic parameter update should have occured.
|
|
|
|
// Skip ahead until a new periodic parameter update should have occured.
|
|
|
|
timestamp_ms += kProcessIntervalMs;
|
|
|
|
timestamp_ms += kProcessIntervalMs;
|
|
|
|
@ -4588,7 +4611,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
const CpuOveruseOptions default_options;
|
|
|
|
const CpuOveruseOptions default_options;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
CreateFrame(1, kFrameWidth, kFrameHeight));
|
|
|
|
CreateFrame(1, kFrameWidth, kFrameHeight));
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
@ -4612,7 +4635,7 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
CreateFrame(1, kFrameWidth, kFrameHeight));
|
|
|
|
CreateFrame(1, kFrameWidth, kFrameHeight));
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
WaitForEncodedFrame(1);
|
|
|
|
@ -4634,7 +4657,7 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenEncoderOvershoots) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
max_framerate_ = kFps;
|
|
|
|
max_framerate_ = kFps;
|
|
|
|
@ -4671,7 +4694,7 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenEncoderOvershoots) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps + 1000),
|
|
|
|
DataRate::bps(kTargetBitrateBps + 1000),
|
|
|
|
DataRate::bps(kTargetBitrateBps + 1000),
|
|
|
|
DataRate::bps(kTargetBitrateBps + 1000),
|
|
|
|
DataRate::bps(kTargetBitrateBps + 1000), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps + 1000), 0, 0, 0);
|
|
|
|
num_dropped = 0;
|
|
|
|
num_dropped = 0;
|
|
|
|
for (int i = 0; i < kNumFramesInRun; ++i) {
|
|
|
|
for (int i = 0; i < kNumFramesInRun; ++i) {
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
@ -4685,7 +4708,7 @@ TEST_F(VideoStreamEncoderTest, DropsFramesWhenEncoderOvershoots) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Target framerate should be still be near the expected target, despite
|
|
|
|
// Target framerate should be still be near the expected target, despite
|
|
|
|
// the frame drops.
|
|
|
|
// the frame drops.
|
|
|
|
@ -4709,7 +4732,7 @@ TEST_F(VideoStreamEncoderTest, ConfiguresCorrectFrameRate) {
|
|
|
|
max_framerate_ = kActualInputFps;
|
|
|
|
max_framerate_ = kActualInputFps;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Insert 3 seconds of video, with an input fps lower than configured max.
|
|
|
|
// Insert 3 seconds of video, with an input fps lower than configured max.
|
|
|
|
for (int i = 0; i < kActualInputFps * 3; ++i) {
|
|
|
|
for (int i = 0; i < kActualInputFps * 3; ++i) {
|
|
|
|
@ -4729,7 +4752,7 @@ TEST_F(VideoStreamEncoderTest, AccumulatesUpdateRectOnDroppedFrames) {
|
|
|
|
VideoFrame::UpdateRect rect;
|
|
|
|
VideoFrame::UpdateRect rect;
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
fake_encoder_.BlockNextEncode();
|
|
|
|
fake_encoder_.BlockNextEncode();
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
video_source_.IncomingCapturedFrame(
|
|
|
|
@ -4774,7 +4797,7 @@ TEST_F(VideoStreamEncoderTest, AccumulatesUpdateRectOnDroppedFrames) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, SetsFrameTypes) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, SetsFrameTypes) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// First frame is always keyframe.
|
|
|
|
// First frame is always keyframe.
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
|
|
|
|
@ -4807,7 +4830,7 @@ TEST_F(VideoStreamEncoderTest, SetsFrameTypesSimulcast) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kSimulcastTargetBitrateBps),
|
|
|
|
DataRate::bps(kSimulcastTargetBitrateBps),
|
|
|
|
DataRate::bps(kSimulcastTargetBitrateBps),
|
|
|
|
DataRate::bps(kSimulcastTargetBitrateBps),
|
|
|
|
DataRate::bps(kSimulcastTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kSimulcastTargetBitrateBps), 0, 0, 0);
|
|
|
|
// Wait for all three layers before triggering event.
|
|
|
|
// Wait for all three layers before triggering event.
|
|
|
|
sink_.SetNumExpectedLayers(3);
|
|
|
|
sink_.SetNumExpectedLayers(3);
|
|
|
|
|
|
|
|
|
|
|
|
@ -4849,7 +4872,7 @@ TEST_F(VideoStreamEncoderTest, RequestKeyframeInternalSource) {
|
|
|
|
ResetEncoder("VP8", 1, 1, 1, false);
|
|
|
|
ResetEncoder("VP8", 1, 1, 1, false);
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// Call encoder directly, simulating internal source where encoded frame
|
|
|
|
// Call encoder directly, simulating internal source where encoded frame
|
|
|
|
// callback in VideoStreamEncoder is called despite no OnFrame().
|
|
|
|
// callback in VideoStreamEncoder is called despite no OnFrame().
|
|
|
|
@ -4887,7 +4910,7 @@ TEST_F(VideoStreamEncoderTest, AdjustsTimestampInternalSource) {
|
|
|
|
ResetEncoder("VP8", 1, 1, 1, false);
|
|
|
|
ResetEncoder("VP8", 1, 1, 1, false);
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
int64_t timestamp = 1;
|
|
|
|
int64_t timestamp = 1;
|
|
|
|
EncodedImage image;
|
|
|
|
EncodedImage image;
|
|
|
|
@ -4979,7 +5002,7 @@ TEST_F(VideoStreamEncoderTest, CopiesVideoFrameMetadataAfterDownscale) {
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
|
|
|
|
|
|
|
|
// Insert a first video frame. It should be dropped because of downscale in
|
|
|
|
// Insert a first video frame. It should be dropped because of downscale in
|
|
|
|
@ -5022,7 +5045,8 @@ TEST_F(VideoStreamEncoderTest, BandwidthAllocationLowerBound) {
|
|
|
|
/*stable_target_bitrate=*/DataRate::kbps(300),
|
|
|
|
/*stable_target_bitrate=*/DataRate::kbps(300),
|
|
|
|
/*link_allocation=*/DataRate::kbps(300),
|
|
|
|
/*link_allocation=*/DataRate::kbps(300),
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*rtt_ms=*/0);
|
|
|
|
/*rtt_ms=*/0,
|
|
|
|
|
|
|
|
/*cwnd_reduce_ratio=*/0);
|
|
|
|
|
|
|
|
|
|
|
|
// Insert a first video frame so that encoder gets configured.
|
|
|
|
// Insert a first video frame so that encoder gets configured.
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
@ -5040,7 +5064,8 @@ TEST_F(VideoStreamEncoderTest, BandwidthAllocationLowerBound) {
|
|
|
|
/*stable_target_bitrate=*/target_rate,
|
|
|
|
/*stable_target_bitrate=*/target_rate,
|
|
|
|
/*link_allocation=*/target_rate,
|
|
|
|
/*link_allocation=*/target_rate,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*rtt_ms=*/0);
|
|
|
|
/*rtt_ms=*/0,
|
|
|
|
|
|
|
|
/*cwnd_reduce_ratio=*/0);
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
|
|
|
|
|
|
|
|
// Target bitrate and bandwidth allocation should both be capped at min_rate.
|
|
|
|
// Target bitrate and bandwidth allocation should both be capped at min_rate.
|
|
|
|
@ -5056,7 +5081,7 @@ TEST_F(VideoStreamEncoderTest, BandwidthAllocationLowerBound) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, EncoderRatesPropagatedOnReconfigure) {
|
|
|
|
TEST_F(VideoStreamEncoderTest, EncoderRatesPropagatedOnReconfigure) {
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
// Capture a frame and wait for it to synchronize with the encoder thread.
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(timestamp_ms, nullptr));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(timestamp_ms, nullptr));
|
|
|
|
@ -5130,7 +5155,8 @@ TEST_F(VideoStreamEncoderTest, BitrateEncoderSwitch) {
|
|
|
|
/*stable_target_bitrate=*/DataRate::kbps(kDontCare),
|
|
|
|
/*stable_target_bitrate=*/DataRate::kbps(kDontCare),
|
|
|
|
/*link_allocation=*/DataRate::kbps(kDontCare),
|
|
|
|
/*link_allocation=*/DataRate::kbps(kDontCare),
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*rtt_ms=*/0);
|
|
|
|
/*rtt_ms=*/0,
|
|
|
|
|
|
|
|
/*cwnd_reduce_ratio=*/0);
|
|
|
|
|
|
|
|
|
|
|
|
video_stream_encoder_->Stop();
|
|
|
|
video_stream_encoder_->Stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -5161,7 +5187,8 @@ TEST_F(VideoStreamEncoderTest, ResolutionEncoderSwitch) {
|
|
|
|
/*stable_target_bitrate=*/DataRate::kbps(kSufficientBitrateToNotDrop),
|
|
|
|
/*stable_target_bitrate=*/DataRate::kbps(kSufficientBitrateToNotDrop),
|
|
|
|
/*link_allocation=*/DataRate::kbps(kSufficientBitrateToNotDrop),
|
|
|
|
/*link_allocation=*/DataRate::kbps(kSufficientBitrateToNotDrop),
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*rtt_ms=*/0);
|
|
|
|
/*rtt_ms=*/0,
|
|
|
|
|
|
|
|
/*cwnd_reduce_ratio=*/0);
|
|
|
|
|
|
|
|
|
|
|
|
// Send one frame to trigger ReconfigureEncoder.
|
|
|
|
// Send one frame to trigger ReconfigureEncoder.
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, kHighRes, kHighRes));
|
|
|
|
video_source_.IncomingCapturedFrame(CreateFrame(1, kHighRes, kHighRes));
|
|
|
|
@ -5191,7 +5218,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
/*stable_target_bitrate=*/rate,
|
|
|
|
/*stable_target_bitrate=*/rate,
|
|
|
|
/*link_allocation=*/rate,
|
|
|
|
/*link_allocation=*/rate,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*rtt_ms=*/0);
|
|
|
|
/*rtt_ms=*/0,
|
|
|
|
|
|
|
|
/*cwnd_reduce_ratio=*/0);
|
|
|
|
|
|
|
|
|
|
|
|
// Insert a first video frame so that encoder gets configured.
|
|
|
|
// Insert a first video frame so that encoder gets configured.
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
@ -5208,7 +5236,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
/*stable_target_bitrate=*/new_stable_rate,
|
|
|
|
/*stable_target_bitrate=*/new_stable_rate,
|
|
|
|
/*link_allocation=*/rate,
|
|
|
|
/*link_allocation=*/rate,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*rtt_ms=*/0);
|
|
|
|
/*rtt_ms=*/0,
|
|
|
|
|
|
|
|
/*cwnd_reduce_ratio=*/0);
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
EXPECT_EQ(2, fake_encoder_.GetNumSetRates());
|
|
|
|
EXPECT_EQ(2, fake_encoder_.GetNumSetRates());
|
|
|
|
video_stream_encoder_->Stop();
|
|
|
|
video_stream_encoder_->Stop();
|
|
|
|
@ -5226,7 +5255,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
/*stable_target_bitrate=*/rate,
|
|
|
|
/*stable_target_bitrate=*/rate,
|
|
|
|
/*link_allocation=*/rate,
|
|
|
|
/*link_allocation=*/rate,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*rtt_ms=*/0);
|
|
|
|
/*rtt_ms=*/0,
|
|
|
|
|
|
|
|
/*cwnd_reduce_ratio=*/0);
|
|
|
|
|
|
|
|
|
|
|
|
// Insert a first video frame so that encoder gets configured.
|
|
|
|
// Insert a first video frame so that encoder gets configured.
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
|
|
|
|
@ -5244,7 +5274,8 @@ TEST_F(VideoStreamEncoderTest,
|
|
|
|
/*stable_target_bitrate=*/new_stable_rate,
|
|
|
|
/*stable_target_bitrate=*/new_stable_rate,
|
|
|
|
/*link_allocation=*/rate,
|
|
|
|
/*link_allocation=*/rate,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*fraction_lost=*/0,
|
|
|
|
/*rtt_ms=*/0);
|
|
|
|
/*rtt_ms=*/0,
|
|
|
|
|
|
|
|
/*cwnd_reduce_ratio=*/0);
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
video_stream_encoder_->WaitUntilTaskQueueIsIdle();
|
|
|
|
EXPECT_EQ(1, fake_encoder_.GetNumSetRates());
|
|
|
|
EXPECT_EQ(1, fake_encoder_.GetNumSetRates());
|
|
|
|
video_stream_encoder_->Stop();
|
|
|
|
video_stream_encoder_->Stop();
|
|
|
|
@ -5267,7 +5298,7 @@ TEST_F(VideoStreamEncoderTest, AutomaticAnimationDetection) {
|
|
|
|
// BALANCED degradation preference is required for this feature.
|
|
|
|
// BALANCED degradation preference is required for this feature.
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
video_stream_encoder_->OnBitrateUpdated(
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), DataRate::bps(kTargetBitrateBps),
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0);
|
|
|
|
DataRate::bps(kTargetBitrateBps), 0, 0, 0);
|
|
|
|
video_stream_encoder_->SetSource(&video_source_,
|
|
|
|
video_stream_encoder_->SetSource(&video_source_,
|
|
|
|
webrtc::DegradationPreference::BALANCED);
|
|
|
|
webrtc::DegradationPreference::BALANCED);
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
VerifyNoLimitation(video_source_.sink_wants());
|
|
|
|
|