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

Side by Side Diff: webrtc/common_video/i420_video_frame_unittest.cc

Issue 2009193002: Delete IsMutable and IsExclusive methods. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Delete redundant RefCountedObject wrapping. Created 4 years, 6 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 stride_uv, 8, 8)); 193 stride_uv, 8, 8));
194 EXPECT_TRUE(test::EqualPlane(buffer_v, frame2.video_frame_buffer()->DataV(), 194 EXPECT_TRUE(test::EqualPlane(buffer_v, frame2.video_frame_buffer()->DataV(),
195 stride_uv, 8, 8)); 195 stride_uv, 8, 8));
196 196
197 // Compare size. 197 // Compare size.
198 EXPECT_LE(kSizeY, frame2.allocated_size(kYPlane)); 198 EXPECT_LE(kSizeY, frame2.allocated_size(kYPlane));
199 EXPECT_LE(kSizeUv, frame2.allocated_size(kUPlane)); 199 EXPECT_LE(kSizeUv, frame2.allocated_size(kUPlane));
200 EXPECT_LE(kSizeUv, frame2.allocated_size(kVPlane)); 200 EXPECT_LE(kSizeUv, frame2.allocated_size(kVPlane));
201 } 201 }
202 202
203 TEST(TestVideoFrame, ReuseAllocation) {
204 VideoFrame frame;
205 frame.CreateEmptyFrame(640, 320, 640, 320, 320);
206 const uint8_t* y = frame.video_frame_buffer()->DataY();
207 const uint8_t* u = frame.video_frame_buffer()->DataU();
208 const uint8_t* v = frame.video_frame_buffer()->DataV();
209 frame.CreateEmptyFrame(640, 320, 640, 320, 320);
210 EXPECT_EQ(y, frame.video_frame_buffer()->DataY());
211 EXPECT_EQ(u, frame.video_frame_buffer()->DataU());
212 EXPECT_EQ(v, frame.video_frame_buffer()->DataV());
213 }
214
215 TEST(TestVideoFrame, FailToReuseAllocation) { 203 TEST(TestVideoFrame, FailToReuseAllocation) {
216 VideoFrame frame1; 204 VideoFrame frame1;
217 frame1.CreateEmptyFrame(640, 320, 640, 320, 320); 205 frame1.CreateEmptyFrame(640, 320, 640, 320, 320);
218 const uint8_t* y = frame1.video_frame_buffer()->DataY(); 206 const uint8_t* y = frame1.video_frame_buffer()->DataY();
219 const uint8_t* u = frame1.video_frame_buffer()->DataU(); 207 const uint8_t* u = frame1.video_frame_buffer()->DataU();
220 const uint8_t* v = frame1.video_frame_buffer()->DataV(); 208 const uint8_t* v = frame1.video_frame_buffer()->DataV();
221 // Make a shallow copy of |frame1|. 209 // Make a shallow copy of |frame1|.
222 VideoFrame frame2(frame1.video_frame_buffer(), 0, 0, kVideoRotation_0); 210 VideoFrame frame2(frame1.video_frame_buffer(), 0, 0, kVideoRotation_0);
223 frame1.CreateEmptyFrame(640, 320, 640, 320, 320); 211 frame1.CreateEmptyFrame(640, 320, 640, 320, 320);
224 EXPECT_NE(y, frame1.video_frame_buffer()->DataY()); 212 EXPECT_NE(y, frame1.video_frame_buffer()->DataY());
(...skipping 22 matching lines...) Expand all
247 rtc::scoped_refptr<I420Buffer> buf1( 235 rtc::scoped_refptr<I420Buffer> buf1(
248 new rtc::RefCountedObject<I420Buffer>(20, 10)); 236 new rtc::RefCountedObject<I420Buffer>(20, 10));
249 memset(buf1->MutableDataY(), 1, 200); 237 memset(buf1->MutableDataY(), 1, 200);
250 memset(buf1->MutableDataU(), 2, 50); 238 memset(buf1->MutableDataU(), 2, 50);
251 memset(buf1->MutableDataV(), 3, 50); 239 memset(buf1->MutableDataV(), 3, 50);
252 rtc::scoped_refptr<I420Buffer> buf2 = I420Buffer::Copy(buf1); 240 rtc::scoped_refptr<I420Buffer> buf2 = I420Buffer::Copy(buf1);
253 EXPECT_TRUE(test::FrameBufsEqual(buf1, buf2)); 241 EXPECT_TRUE(test::FrameBufsEqual(buf1, buf2));
254 } 242 }
255 243
256 } // namespace webrtc 244 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_video/i420_buffer_pool_unittest.cc ('k') | webrtc/common_video/include/i420_buffer_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698