|
|
|
|
@ -126,8 +126,8 @@ TEST_F(TestVp9Impl, DISABLED_EncodeDecode) {
|
|
|
|
|
#else
|
|
|
|
|
TEST_F(TestVp9Impl, EncodeDecode) {
|
|
|
|
|
#endif
|
|
|
|
|
VideoFrame* input_frame = NextInputFrame();
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(*input_frame, nullptr));
|
|
|
|
|
VideoFrame input_frame = NextInputFrame();
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(input_frame, nullptr));
|
|
|
|
|
EncodedImage encoded_frame;
|
|
|
|
|
CodecSpecificInfo codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -138,7 +138,7 @@ TEST_F(TestVp9Impl, EncodeDecode) {
|
|
|
|
|
absl::optional<uint8_t> decoded_qp;
|
|
|
|
|
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
|
|
|
|
|
ASSERT_TRUE(decoded_frame);
|
|
|
|
|
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);
|
|
|
|
|
EXPECT_GT(I420PSNR(&input_frame, decoded_frame.get()), 36);
|
|
|
|
|
|
|
|
|
|
const ColorSpace color_space = *decoded_frame->color_space();
|
|
|
|
|
EXPECT_EQ(ColorSpace::PrimaryID::kUnspecified, color_space.primaries());
|
|
|
|
|
@ -152,8 +152,7 @@ TEST_F(TestVp9Impl, EncodeDecode) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(TestVp9Impl, DecodedColorSpaceFromBitstream) {
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
EncodedImage encoded_frame;
|
|
|
|
|
CodecSpecificInfo codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -171,8 +170,7 @@ TEST_F(TestVp9Impl, DecodedColorSpaceFromBitstream) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(TestVp9Impl, DecodedQpEqualsEncodedQp) {
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
EncodedImage encoded_frame;
|
|
|
|
|
CodecSpecificInfo codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -188,8 +186,7 @@ TEST_F(TestVp9Impl, DecodedQpEqualsEncodedQp) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(TestVp9Impl, ParserQpEqualsEncodedQp) {
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
EncodedImage encoded_frame;
|
|
|
|
|
CodecSpecificInfo codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -208,26 +205,22 @@ TEST_F(TestVp9Impl, EncoderWith2TemporalLayers) {
|
|
|
|
|
encoder_->InitEncode(&codec_settings_, kSettings));
|
|
|
|
|
|
|
|
|
|
// Temporal layer 0.
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
EncodedImage encoded_frame;
|
|
|
|
|
CodecSpecificInfo codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
|
|
|
|
EXPECT_EQ(0, codec_specific_info.codecSpecific.VP9.temporal_idx);
|
|
|
|
|
|
|
|
|
|
// Temporal layer 1.
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ExpectFrameWith(1);
|
|
|
|
|
|
|
|
|
|
// Temporal layer 0.
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ExpectFrameWith(0);
|
|
|
|
|
|
|
|
|
|
// Temporal layer 1.
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ExpectFrameWith(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -237,8 +230,7 @@ TEST_F(TestVp9Impl, EncoderWith2SpatialLayers) {
|
|
|
|
|
encoder_->InitEncode(&codec_settings_, kSettings));
|
|
|
|
|
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_info));
|
|
|
|
|
@ -324,7 +316,7 @@ TEST_F(TestVp9Impl, EnableDisableSpatialLayers) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(sl_idx + 1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -342,7 +334,7 @@ TEST_F(TestVp9Impl, EnableDisableSpatialLayers) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(sl_idx);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -386,7 +378,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrame) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -407,7 +399,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrame) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -431,7 +423,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrame) {
|
|
|
|
|
std::vector<VideoFrameType> frame_types = {VideoFrameType::kVideoFrameKey};
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), &frame_types));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), &frame_types));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -443,7 +435,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrame) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -463,7 +455,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrame) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -492,7 +484,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrame) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -536,7 +528,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrameForScreenshare) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -554,7 +546,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrameForScreenshare) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -570,7 +562,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrameForScreenshare) {
|
|
|
|
|
std::vector<VideoFrameType> frame_types = {VideoFrameType::kVideoFrameKey};
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), &frame_types));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), &frame_types));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -587,7 +579,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrameForScreenshare) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -614,7 +606,7 @@ TEST_F(TestVp9Impl, DisableEnableBaseLayerTriggersKeyFrameForScreenshare) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -647,8 +639,7 @@ TEST_F(TestVp9Impl, EndOfPicture) {
|
|
|
|
|
encoder_->SetRates(VideoEncoder::RateControlParameters(
|
|
|
|
|
bitrate_allocation, codec_settings_.maxFramerate));
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
|
|
|
|
|
std::vector<EncodedImage> frames;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific;
|
|
|
|
|
@ -665,8 +656,7 @@ TEST_F(TestVp9Impl, EndOfPicture) {
|
|
|
|
|
encoder_->InitEncode(&codec_settings_, kSettings));
|
|
|
|
|
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&frames, &codec_specific));
|
|
|
|
|
EXPECT_FALSE(frames[0].SpatialIndex());
|
|
|
|
|
@ -698,7 +688,7 @@ TEST_F(TestVp9Impl, InterLayerPred) {
|
|
|
|
|
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
|
|
|
|
|
std::vector<EncodedImage> frames;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific;
|
|
|
|
|
@ -725,7 +715,7 @@ TEST_F(TestVp9Impl, InterLayerPred) {
|
|
|
|
|
// Delta frame.
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&frames, &codec_specific));
|
|
|
|
|
|
|
|
|
|
ASSERT_EQ(frames[0].SpatialIndex(), 0);
|
|
|
|
|
@ -774,7 +764,7 @@ TEST_F(TestVp9Impl,
|
|
|
|
|
++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(sl_idx + 1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -832,7 +822,7 @@ TEST_F(TestVp9Impl,
|
|
|
|
|
++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(sl_idx + 1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frame;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -891,7 +881,7 @@ TEST_F(TestVp9Impl, EnablingDisablingUpperLayerInTheSameGof) {
|
|
|
|
|
for (int i = 0; i < 3; ++i) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
ASSERT_EQ(codec_specific_info.size(), 2u);
|
|
|
|
|
}
|
|
|
|
|
@ -904,8 +894,7 @@ TEST_F(TestVp9Impl, EnablingDisablingUpperLayerInTheSameGof) {
|
|
|
|
|
|
|
|
|
|
// Encode 1 frame.
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
ASSERT_EQ(codec_specific_info.size(), 1u);
|
|
|
|
|
EXPECT_EQ(encoded_frame[0]._frameType, VideoFrameType::kVideoFrameDelta);
|
|
|
|
|
@ -922,8 +911,7 @@ TEST_F(TestVp9Impl, EnablingDisablingUpperLayerInTheSameGof) {
|
|
|
|
|
|
|
|
|
|
// Encode 1 frame.
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
ASSERT_EQ(codec_specific_info.size(), 2u);
|
|
|
|
|
EXPECT_EQ(encoded_frame[0]._frameType, VideoFrameType::kVideoFrameDelta);
|
|
|
|
|
@ -965,7 +953,7 @@ TEST_F(TestVp9Impl, EnablingDisablingUpperLayerAccrossGof) {
|
|
|
|
|
for (int i = 0; i < 3; ++i) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
ASSERT_EQ(codec_specific_info.size(), 2u);
|
|
|
|
|
}
|
|
|
|
|
@ -980,7 +968,7 @@ TEST_F(TestVp9Impl, EnablingDisablingUpperLayerAccrossGof) {
|
|
|
|
|
for (int i = 0; i < 11; ++i) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
ASSERT_EQ(codec_specific_info.size(), 1u);
|
|
|
|
|
EXPECT_EQ(encoded_frame[0]._frameType, VideoFrameType::kVideoFrameDelta);
|
|
|
|
|
@ -999,8 +987,7 @@ TEST_F(TestVp9Impl, EnablingDisablingUpperLayerAccrossGof) {
|
|
|
|
|
|
|
|
|
|
// Encode 1 frame.
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frame, &codec_specific_info));
|
|
|
|
|
ASSERT_EQ(codec_specific_info.size(), 2u);
|
|
|
|
|
EXPECT_EQ(encoded_frame[0]._frameType, VideoFrameType::kVideoFrameDelta);
|
|
|
|
|
@ -1045,7 +1032,7 @@ TEST_F(TestVp9Impl, EnablingNewLayerInScreenshareForcesAllLayersWithSS) {
|
|
|
|
|
++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers - 1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frames;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific_info));
|
|
|
|
|
@ -1061,8 +1048,7 @@ TEST_F(TestVp9Impl, EnablingNewLayerInScreenshareForcesAllLayersWithSS) {
|
|
|
|
|
|
|
|
|
|
// All layers are encoded, even though frame dropping should happen.
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
// Now all 3 layers should be encoded.
|
|
|
|
|
std::vector<EncodedImage> encoded_frames;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
@ -1107,7 +1093,7 @@ TEST_F(TestVp9Impl, ScreenshareFrameDropping) {
|
|
|
|
|
++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frames;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific_info));
|
|
|
|
|
@ -1127,8 +1113,7 @@ TEST_F(TestVp9Impl, ScreenshareFrameDropping) {
|
|
|
|
|
encoder_->SetRates(VideoEncoder::RateControlParameters(
|
|
|
|
|
bitrate_allocation, codec_settings_.maxFramerate));
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frames;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific_info));
|
|
|
|
|
@ -1142,7 +1127,7 @@ TEST_F(TestVp9Impl, ScreenshareFrameDropping) {
|
|
|
|
|
++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frames;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific_info));
|
|
|
|
|
@ -1196,7 +1181,7 @@ TEST_F(TestVp9Impl, RemovingLayerIsNotDelayedInScreenshareAndAddsSsInfo) {
|
|
|
|
|
++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frames;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific_info));
|
|
|
|
|
@ -1206,7 +1191,7 @@ TEST_F(TestVp9Impl, RemovingLayerIsNotDelayedInScreenshareAndAddsSsInfo) {
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_dropped_frames - 2; ++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
// First layer is dropped due to frame rate cap. The last layer should not
|
|
|
|
|
// be enabled yet.
|
|
|
|
|
std::vector<EncodedImage> encoded_frames;
|
|
|
|
|
@ -1227,7 +1212,7 @@ TEST_F(TestVp9Impl, RemovingLayerIsNotDelayedInScreenshareAndAddsSsInfo) {
|
|
|
|
|
// Expect back one frame.
|
|
|
|
|
SetWaitForEncodedFramesThreshold(1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
// First layer is dropped due to frame rate cap. The last layer should not
|
|
|
|
|
// be enabled yet.
|
|
|
|
|
std::vector<EncodedImage> encoded_frames;
|
|
|
|
|
@ -1240,8 +1225,7 @@ TEST_F(TestVp9Impl, RemovingLayerIsNotDelayedInScreenshareAndAddsSsInfo) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetWaitForEncodedFramesThreshold(2);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
std::vector<EncodedImage> encoded_frames;
|
|
|
|
|
std::vector<CodecSpecificInfo> codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific_info));
|
|
|
|
|
@ -1282,8 +1266,7 @@ TEST_F(TestVp9Impl, DisableNewLayerInVideoDelaysSsInfoTillTL0) {
|
|
|
|
|
|
|
|
|
|
// Encode one TL0 frame
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific_info));
|
|
|
|
|
EXPECT_EQ(codec_specific_info[0].codecSpecific.VP9.temporal_idx, 0u);
|
|
|
|
|
|
|
|
|
|
@ -1297,16 +1280,14 @@ TEST_F(TestVp9Impl, DisableNewLayerInVideoDelaysSsInfoTillTL0) {
|
|
|
|
|
// Next is TL1 frame. The last layer is disabled immediately, but SS structure
|
|
|
|
|
// is not provided here.
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers - 1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific_info));
|
|
|
|
|
EXPECT_EQ(codec_specific_info[0].codecSpecific.VP9.temporal_idx, 1u);
|
|
|
|
|
EXPECT_FALSE(codec_specific_info[0].codecSpecific.VP9.ss_data_available);
|
|
|
|
|
|
|
|
|
|
// Next is TL0 frame, which should have delayed SS structure.
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers - 1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific_info));
|
|
|
|
|
EXPECT_EQ(codec_specific_info[0].codecSpecific.VP9.temporal_idx, 0u);
|
|
|
|
|
EXPECT_TRUE(codec_specific_info[0].codecSpecific.VP9.ss_data_available);
|
|
|
|
|
@ -1330,8 +1311,7 @@ TEST_F(TestVp9Impl,
|
|
|
|
|
0, 0, codec_settings_.spatialLayers[0].targetBitrate * 1000);
|
|
|
|
|
encoder_->SetRates(VideoEncoder::RateControlParameters(
|
|
|
|
|
bitrate_allocation, codec_settings_.maxFramerate));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
EncodedImage encoded_frame;
|
|
|
|
|
CodecSpecificInfo codec_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_info));
|
|
|
|
|
@ -1344,8 +1324,7 @@ TEST_F(TestVp9Impl, ScalabilityStructureIsAvailableInFlexibleMode) {
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->InitEncode(&codec_settings_, kSettings));
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
EncodedImage encoded_frame;
|
|
|
|
|
CodecSpecificInfo codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -1462,7 +1441,7 @@ TEST_P(TestVp9ImplWithLayering, FlexibleMode) {
|
|
|
|
|
++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers_);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
|
|
|
|
|
const bool is_key_frame = frame_num == 0;
|
|
|
|
|
const size_t gof_idx = frame_num % gof.num_frames_in_gof;
|
|
|
|
|
@ -1500,7 +1479,7 @@ TEST_P(TestVp9ImplWithLayering, ExternalRefControl) {
|
|
|
|
|
++frame_num) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers_);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
|
|
|
|
|
const bool is_key_frame = frame_num == 0;
|
|
|
|
|
const size_t gof_idx = frame_num % gof.num_frames_in_gof;
|
|
|
|
|
@ -1541,12 +1520,12 @@ TEST_F(TestVp9ImplFrameDropping, PreEncodeFrameDropping) {
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->InitEncode(&codec_settings_, kSettings));
|
|
|
|
|
|
|
|
|
|
VideoFrame* input_frame = NextInputFrame();
|
|
|
|
|
VideoFrame input_frame = NextInputFrame();
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_frames_to_encode; ++frame_num) {
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(*input_frame, nullptr));
|
|
|
|
|
const size_t timestamp = input_frame->timestamp() +
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(input_frame, nullptr));
|
|
|
|
|
const size_t timestamp = input_frame.timestamp() +
|
|
|
|
|
kVideoPayloadTypeFrequency / input_framerate_fps;
|
|
|
|
|
input_frame->set_timestamp(static_cast<uint32_t>(timestamp));
|
|
|
|
|
input_frame.set_timestamp(static_cast<uint32_t>(timestamp));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const size_t num_encoded_frames = GetNumEncodedFrames();
|
|
|
|
|
@ -1593,12 +1572,12 @@ TEST_F(TestVp9ImplFrameDropping, DifferentFrameratePerSpatialLayer) {
|
|
|
|
|
encoder_->SetRates(VideoEncoder::RateControlParameters(
|
|
|
|
|
bitrate_allocation, codec_settings_.maxFramerate));
|
|
|
|
|
|
|
|
|
|
VideoFrame* input_frame = NextInputFrame();
|
|
|
|
|
VideoFrame input_frame = NextInputFrame();
|
|
|
|
|
for (size_t frame_num = 0; frame_num < num_input_frames; ++frame_num) {
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(*input_frame, nullptr));
|
|
|
|
|
const size_t timestamp = input_frame->timestamp() +
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(input_frame, nullptr));
|
|
|
|
|
const size_t timestamp = input_frame.timestamp() +
|
|
|
|
|
kVideoPayloadTypeFrequency / input_framerate_fps;
|
|
|
|
|
input_frame->set_timestamp(static_cast<uint32_t>(timestamp));
|
|
|
|
|
input_frame.set_timestamp(static_cast<uint32_t>(timestamp));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<EncodedImage> encoded_frames;
|
|
|
|
|
@ -1658,8 +1637,8 @@ TEST_F(TestVp9ImplProfile2, EncodeDecode) {
|
|
|
|
|
if (!encoder_)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
VideoFrame* input_frame = NextInputFrame();
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(*input_frame, nullptr));
|
|
|
|
|
VideoFrame input_frame = NextInputFrame();
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(input_frame, nullptr));
|
|
|
|
|
EncodedImage encoded_frame;
|
|
|
|
|
CodecSpecificInfo codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -1672,7 +1651,7 @@ TEST_F(TestVp9ImplProfile2, EncodeDecode) {
|
|
|
|
|
ASSERT_TRUE(decoded_frame);
|
|
|
|
|
|
|
|
|
|
// TODO(emircan): Add PSNR for different color depths.
|
|
|
|
|
EXPECT_GT(I420PSNR(*input_frame->video_frame_buffer()->ToI420(),
|
|
|
|
|
EXPECT_GT(I420PSNR(*input_frame.video_frame_buffer()->ToI420(),
|
|
|
|
|
*decoded_frame->video_frame_buffer()->ToI420()),
|
|
|
|
|
31);
|
|
|
|
|
}
|
|
|
|
|
@ -1690,8 +1669,7 @@ TEST_F(TestVp9Impl, EncodeWithDynamicRate) {
|
|
|
|
|
params.framerate_fps = 30.0;
|
|
|
|
|
|
|
|
|
|
encoder_->SetRates(params);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
EncodedImage encoded_frame;
|
|
|
|
|
CodecSpecificInfo codec_specific_info;
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
|
|
|
|
@ -1699,8 +1677,7 @@ TEST_F(TestVp9Impl, EncodeWithDynamicRate) {
|
|
|
|
|
// Set no headroom and encode again.
|
|
|
|
|
params.bandwidth_allocation = DataRate::Zero();
|
|
|
|
|
encoder_->SetRates(params);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrame(&encoded_frame, &codec_specific_info));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1734,7 +1711,7 @@ TEST_F(TestVp9Impl, ReenablingUpperLayerAfterKFWithInterlayerPredIsEnabled) {
|
|
|
|
|
for (int i = 0; i < num_frames_to_encode; ++i) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific));
|
|
|
|
|
EXPECT_EQ(encoded_frames.size(), num_spatial_layers);
|
|
|
|
|
}
|
|
|
|
|
@ -1747,7 +1724,7 @@ TEST_F(TestVp9Impl, ReenablingUpperLayerAfterKFWithInterlayerPredIsEnabled) {
|
|
|
|
|
for (int i = 0; i < num_frames_to_encode; ++i) {
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers - 1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific));
|
|
|
|
|
EXPECT_EQ(encoded_frames.size(), num_spatial_layers - 1);
|
|
|
|
|
}
|
|
|
|
|
@ -1757,7 +1734,7 @@ TEST_F(TestVp9Impl, ReenablingUpperLayerAfterKFWithInterlayerPredIsEnabled) {
|
|
|
|
|
// Force a key-frame with the last layer still disabled.
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers - 1);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), &frame_types));
|
|
|
|
|
encoder_->Encode(NextInputFrame(), &frame_types));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific));
|
|
|
|
|
EXPECT_EQ(encoded_frames.size(), num_spatial_layers - 1);
|
|
|
|
|
ASSERT_EQ(encoded_frames[0]._frameType, VideoFrameType::kVideoFrameKey);
|
|
|
|
|
@ -1771,8 +1748,7 @@ TEST_F(TestVp9Impl, ReenablingUpperLayerAfterKFWithInterlayerPredIsEnabled) {
|
|
|
|
|
bitrate_allocation, codec_settings_.maxFramerate));
|
|
|
|
|
|
|
|
|
|
SetWaitForEncodedFramesThreshold(num_spatial_layers);
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
|
|
|
|
encoder_->Encode(*NextInputFrame(), nullptr));
|
|
|
|
|
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Encode(NextInputFrame(), nullptr));
|
|
|
|
|
ASSERT_TRUE(WaitForEncodedFrames(&encoded_frames, &codec_specific));
|
|
|
|
|
EXPECT_EQ(encoded_frames.size(), num_spatial_layers);
|
|
|
|
|
EXPECT_EQ(encoded_frames[0]._frameType, VideoFrameType::kVideoFrameDelta);
|
|
|
|
|
|