Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: webrtc/video/video_encoder_unittest.cc

Issue 2278883002: Move MutableDataY{,U,V} methods to I420Buffer only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Update android capture and decoder code. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void EncodeFrame(); 100 void EncodeFrame();
101 101
102 FakeEncodedImageCallback callback_; 102 FakeEncodedImageCallback callback_;
103 CountingFakeEncoder fake_encoder_; 103 CountingFakeEncoder fake_encoder_;
104 VideoEncoderSoftwareFallbackWrapper fallback_wrapper_; 104 VideoEncoderSoftwareFallbackWrapper fallback_wrapper_;
105 VideoCodec codec_ = {}; 105 VideoCodec codec_ = {};
106 VideoFrame frame_; 106 VideoFrame frame_;
107 }; 107 };
108 108
109 void VideoEncoderSoftwareFallbackWrapperTest::EncodeFrame() { 109 void VideoEncoderSoftwareFallbackWrapperTest::EncodeFrame() {
110 frame_.CreateEmptyFrame(kWidth, kHeight, kWidth, (kWidth + 1) / 2, 110 rtc::scoped_refptr<I420Buffer> buffer = I420Buffer::Create(
111 (kWidth + 1) / 2); 111 kWidth, kHeight, kWidth, (kWidth + 1) / 2, (kWidth + 1) / 2);
112 memset(frame_.video_frame_buffer()->MutableDataY(), 16, 112 buffer->SetToBlack();
113 frame_.allocated_size(webrtc::kYPlane));
114 memset(frame_.video_frame_buffer()->MutableDataU(), 128,
115 frame_.allocated_size(webrtc::kUPlane));
116 memset(frame_.video_frame_buffer()->MutableDataV(), 128,
117 frame_.allocated_size(webrtc::kVPlane));
118
119 std::vector<FrameType> types(1, kVideoFrameKey); 113 std::vector<FrameType> types(1, kVideoFrameKey);
120 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, 114 // VideoFrame frame(buffer, 0, 0, webrtc::kVideoRotation_0);
121 fallback_wrapper_.Encode(frame_, nullptr, &types)); 115 EXPECT_EQ(
116 WEBRTC_VIDEO_CODEC_OK,
117 fallback_wrapper_.Encode(
118 VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0), nullptr, &types));
122 } 119 }
123 120
124 void VideoEncoderSoftwareFallbackWrapperTest::UtilizeFallbackEncoder() { 121 void VideoEncoderSoftwareFallbackWrapperTest::UtilizeFallbackEncoder() {
125 fallback_wrapper_.RegisterEncodeCompleteCallback(&callback_); 122 fallback_wrapper_.RegisterEncodeCompleteCallback(&callback_);
126 EXPECT_EQ(&callback_, fake_encoder_.encode_complete_callback_); 123 EXPECT_EQ(&callback_, fake_encoder_.encode_complete_callback_);
127 124
128 // Register with failing fake encoder. Should succeed with VP8 fallback. 125 // Register with failing fake encoder. Should succeed with VP8 fallback.
129 codec_.codecType = kVideoCodecVP8; 126 codec_.codecType = kVideoCodecVP8;
130 codec_.maxFramerate = 30; 127 codec_.maxFramerate = 30;
131 codec_.width = kWidth; 128 codec_.width = kWidth;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 TEST_F(VideoEncoderSoftwareFallbackWrapperTest, 265 TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
269 ReportsFallbackImplementationName) { 266 ReportsFallbackImplementationName) {
270 UtilizeFallbackEncoder(); 267 UtilizeFallbackEncoder();
271 // Hard coded expected value since libvpx is the software implementation name 268 // Hard coded expected value since libvpx is the software implementation name
272 // for VP8. Change accordingly if the underlying implementation does. 269 // for VP8. Change accordingly if the underlying implementation does.
273 EXPECT_STREQ("libvpx (fallback from: fake-encoder)", 270 EXPECT_STREQ("libvpx (fallback from: fake-encoder)",
274 fallback_wrapper_.ImplementationName()); 271 fallback_wrapper_.ImplementationName());
275 } 272 }
276 273
277 } // namespace webrtc 274 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698