Index: webrtc/video/video_encoder_unittest.cc |
diff --git a/webrtc/video/video_encoder_unittest.cc b/webrtc/video/video_encoder_unittest.cc |
index eb2b45026bdcc3242caebb8c859b7abd9a559a93..84ac4fd46699366eaa01ca03825efb5efd29c6a5 100644 |
--- a/webrtc/video/video_encoder_unittest.cc |
+++ b/webrtc/video/video_encoder_unittest.cc |
@@ -116,18 +116,22 @@ |
CountingFakeEncoder fake_encoder_; |
VideoEncoderSoftwareFallbackWrapper fallback_wrapper_; |
VideoCodec codec_ = {}; |
- std::unique_ptr<VideoFrame> frame_; |
+ VideoFrame frame_; |
}; |
void VideoEncoderSoftwareFallbackWrapperTest::EncodeFrame() { |
- rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create( |
- kWidth, kHeight, kWidth, (kWidth + 1) / 2, (kWidth + 1) / 2); |
- buffer->SetToBlack(); |
+ frame_.CreateEmptyFrame(kWidth, kHeight, kWidth, (kWidth + 1) / 2, |
+ (kWidth + 1) / 2); |
+ memset(frame_.video_frame_buffer()->MutableDataY(), 16, |
+ frame_.allocated_size(webrtc::kYPlane)); |
+ memset(frame_.video_frame_buffer()->MutableDataU(), 128, |
+ frame_.allocated_size(webrtc::kUPlane)); |
+ memset(frame_.video_frame_buffer()->MutableDataV(), 128, |
+ frame_.allocated_size(webrtc::kVPlane)); |
+ |
std::vector<FrameType> types(1, kVideoFrameKey); |
- |
- frame_.reset(new VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); |
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
- fallback_wrapper_.Encode(*frame_, nullptr, &types)); |
+ fallback_wrapper_.Encode(frame_, nullptr, &types)); |
} |
void VideoEncoderSoftwareFallbackWrapperTest::UtilizeFallbackEncoder() { |
@@ -221,9 +225,9 @@ |
// Encoding a frame using the fallback should arrive at the new callback. |
std::vector<FrameType> types(1, kVideoFrameKey); |
- frame_->set_timestamp(frame_->timestamp() + 1000); |
+ frame_.set_timestamp(frame_.timestamp() + 1000); |
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, |
- fallback_wrapper_.Encode(*frame_, nullptr, &types)); |
+ fallback_wrapper_.Encode(frame_, nullptr, &types)); |
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release()); |
} |