Refactor FrameGenerator to return VideoFrameBuffer with VideoFrame::UpdateRect
Bug: webrtc:10138 Change-Id: I22079e2630bb1f3bb27472795fe923f9143b3401 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161010 Commit-Queue: Artem Titov <titovartem@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29973}
This commit is contained in:
@ -256,12 +256,11 @@ TEST_F(TestVp8Impl, EncodeFrameAndRelease) {
|
||||
|
||||
EncodedImage encoded_frame;
|
||||
CodecSpecificInfo codec_specific_info;
|
||||
EncodeAndWaitForFrame(*NextInputFrame(), &encoded_frame,
|
||||
&codec_specific_info);
|
||||
EncodeAndWaitForFrame(NextInputFrame(), &encoded_frame, &codec_specific_info);
|
||||
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release());
|
||||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_UNINITIALIZED,
|
||||
encoder_->Encode(*NextInputFrame(), nullptr));
|
||||
encoder_->Encode(NextInputFrame(), nullptr));
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, InitDecode) {
|
||||
@ -271,13 +270,13 @@ TEST_F(TestVp8Impl, InitDecode) {
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, OnEncodedImageReportsInfo) {
|
||||
VideoFrame* input_frame = NextInputFrame();
|
||||
input_frame->set_timestamp(kInitialTimestampRtp);
|
||||
input_frame->set_timestamp_us(kInitialTimestampMs *
|
||||
rtc::kNumMicrosecsPerMillisec);
|
||||
VideoFrame input_frame = NextInputFrame();
|
||||
input_frame.set_timestamp(kInitialTimestampRtp);
|
||||
input_frame.set_timestamp_us(kInitialTimestampMs *
|
||||
rtc::kNumMicrosecsPerMillisec);
|
||||
EncodedImage encoded_frame;
|
||||
CodecSpecificInfo codec_specific_info;
|
||||
EncodeAndWaitForFrame(*input_frame, &encoded_frame, &codec_specific_info);
|
||||
EncodeAndWaitForFrame(input_frame, &encoded_frame, &codec_specific_info);
|
||||
|
||||
EXPECT_EQ(kInitialTimestampRtp, encoded_frame.Timestamp());
|
||||
EXPECT_EQ(kWidth, static_cast<int>(encoded_frame._encodedWidth));
|
||||
@ -285,10 +284,10 @@ TEST_F(TestVp8Impl, OnEncodedImageReportsInfo) {
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, DecodedQpEqualsEncodedQp) {
|
||||
VideoFrame* input_frame = NextInputFrame();
|
||||
VideoFrame input_frame = NextInputFrame();
|
||||
EncodedImage encoded_frame;
|
||||
CodecSpecificInfo codec_specific_info;
|
||||
EncodeAndWaitForFrame(*input_frame, &encoded_frame, &codec_specific_info);
|
||||
EncodeAndWaitForFrame(input_frame, &encoded_frame, &codec_specific_info);
|
||||
|
||||
// First frame should be a key frame.
|
||||
encoded_frame._frameType = VideoFrameType::kVideoFrameKey;
|
||||
@ -298,7 +297,7 @@ TEST_F(TestVp8Impl, DecodedQpEqualsEncodedQp) {
|
||||
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
|
||||
ASSERT_TRUE(decoded_frame);
|
||||
ASSERT_TRUE(decoded_qp);
|
||||
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);
|
||||
EXPECT_GT(I420PSNR(&input_frame, decoded_frame.get()), 36);
|
||||
EXPECT_EQ(encoded_frame.qp_, *decoded_qp);
|
||||
}
|
||||
|
||||
@ -376,13 +375,13 @@ TEST_F(TestVp8Impl, ChecksSimulcastSettings) {
|
||||
#define MAYBE_AlignedStrideEncodeDecode AlignedStrideEncodeDecode
|
||||
#endif
|
||||
TEST_F(TestVp8Impl, MAYBE_AlignedStrideEncodeDecode) {
|
||||
VideoFrame* input_frame = NextInputFrame();
|
||||
input_frame->set_timestamp(kInitialTimestampRtp);
|
||||
input_frame->set_timestamp_us(kInitialTimestampMs *
|
||||
rtc::kNumMicrosecsPerMillisec);
|
||||
VideoFrame input_frame = NextInputFrame();
|
||||
input_frame.set_timestamp(kInitialTimestampRtp);
|
||||
input_frame.set_timestamp_us(kInitialTimestampMs *
|
||||
rtc::kNumMicrosecsPerMillisec);
|
||||
EncodedImage encoded_frame;
|
||||
CodecSpecificInfo codec_specific_info;
|
||||
EncodeAndWaitForFrame(*input_frame, &encoded_frame, &codec_specific_info);
|
||||
EncodeAndWaitForFrame(input_frame, &encoded_frame, &codec_specific_info);
|
||||
|
||||
// First frame should be a key frame.
|
||||
encoded_frame._frameType = VideoFrameType::kVideoFrameKey;
|
||||
@ -394,7 +393,7 @@ TEST_F(TestVp8Impl, MAYBE_AlignedStrideEncodeDecode) {
|
||||
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
|
||||
ASSERT_TRUE(decoded_frame);
|
||||
// Compute PSNR on all planes (faster than SSIM).
|
||||
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);
|
||||
EXPECT_GT(I420PSNR(&input_frame, decoded_frame.get()), 36);
|
||||
EXPECT_EQ(kInitialTimestampRtp, decoded_frame->timestamp());
|
||||
}
|
||||
|
||||
@ -404,10 +403,10 @@ TEST_F(TestVp8Impl, MAYBE_AlignedStrideEncodeDecode) {
|
||||
#define MAYBE_DecodeWithACompleteKeyFrame DecodeWithACompleteKeyFrame
|
||||
#endif
|
||||
TEST_F(TestVp8Impl, MAYBE_DecodeWithACompleteKeyFrame) {
|
||||
VideoFrame* input_frame = NextInputFrame();
|
||||
VideoFrame input_frame = NextInputFrame();
|
||||
EncodedImage encoded_frame;
|
||||
CodecSpecificInfo codec_specific_info;
|
||||
EncodeAndWaitForFrame(*input_frame, &encoded_frame, &codec_specific_info);
|
||||
EncodeAndWaitForFrame(input_frame, &encoded_frame, &codec_specific_info);
|
||||
|
||||
// Setting complete to false -> should return an error.
|
||||
encoded_frame._completeFrame = false;
|
||||
@ -425,7 +424,7 @@ TEST_F(TestVp8Impl, MAYBE_DecodeWithACompleteKeyFrame) {
|
||||
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);
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, EncoderWith2TemporalLayers) {
|
||||
@ -436,16 +435,15 @@ TEST_F(TestVp8Impl, EncoderWith2TemporalLayers) {
|
||||
// Temporal layer 0.
|
||||
EncodedImage encoded_frame;
|
||||
CodecSpecificInfo codec_specific_info;
|
||||
EncodeAndWaitForFrame(*NextInputFrame(), &encoded_frame,
|
||||
&codec_specific_info);
|
||||
EncodeAndWaitForFrame(NextInputFrame(), &encoded_frame, &codec_specific_info);
|
||||
|
||||
EXPECT_EQ(0, codec_specific_info.codecSpecific.VP8.temporalIdx);
|
||||
// Temporal layer 1.
|
||||
EncodeAndExpectFrameWith(*NextInputFrame(), 1);
|
||||
EncodeAndExpectFrameWith(NextInputFrame(), 1);
|
||||
// Temporal layer 0.
|
||||
EncodeAndExpectFrameWith(*NextInputFrame(), 0);
|
||||
EncodeAndExpectFrameWith(NextInputFrame(), 0);
|
||||
// Temporal layer 1.
|
||||
EncodeAndExpectFrameWith(*NextInputFrame(), 1);
|
||||
EncodeAndExpectFrameWith(NextInputFrame(), 1);
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, ScalingDisabledIfAutomaticResizeOff) {
|
||||
@ -505,11 +503,11 @@ TEST_F(TestVp8Impl, DontDropKeyframes) {
|
||||
|
||||
EncodedImage encoded_frame;
|
||||
CodecSpecificInfo codec_specific_info;
|
||||
EncodeAndWaitForFrame(*NextInputFrame(), &encoded_frame, &codec_specific_info,
|
||||
EncodeAndWaitForFrame(NextInputFrame(), &encoded_frame, &codec_specific_info,
|
||||
true);
|
||||
EncodeAndExpectFrameWith(*NextInputFrame(), 0, true);
|
||||
EncodeAndExpectFrameWith(*NextInputFrame(), 0, true);
|
||||
EncodeAndExpectFrameWith(*NextInputFrame(), 0, true);
|
||||
EncodeAndExpectFrameWith(NextInputFrame(), 0, true);
|
||||
EncodeAndExpectFrameWith(NextInputFrame(), 0, true);
|
||||
EncodeAndExpectFrameWith(NextInputFrame(), 0, true);
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, KeepsTimestampOnReencode) {
|
||||
@ -547,7 +545,7 @@ TEST_F(TestVp8Impl, KeepsTimestampOnReencode) {
|
||||
|
||||
auto delta_frame =
|
||||
std::vector<VideoFrameType>{VideoFrameType::kVideoFrameDelta};
|
||||
encoder.Encode(*NextInputFrame(), &delta_frame);
|
||||
encoder.Encode(NextInputFrame(), &delta_frame);
|
||||
}
|
||||
|
||||
TEST_F(TestVp8Impl, GetEncoderInfoFpsAllocationNoLayers) {
|
||||
|
||||
Reference in New Issue
Block a user