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

Unified Diff: webrtc/common_video/i420_video_frame_unittest.cc

Issue 1900673002: Delete webrtc::VideoFrame methods buffer and stride. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/java/jni/androidmediaencoder_jni.cc ('k') | webrtc/common_video/libyuv/libyuv_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/i420_video_frame_unittest.cc
diff --git a/webrtc/common_video/i420_video_frame_unittest.cc b/webrtc/common_video/i420_video_frame_unittest.cc
index bc2bac920ad7c411e6c85630de21c027be81b7c1..c942e4a80090b7abc9b3f5a931c86638711a392a 100644
--- a/webrtc/common_video/i420_video_frame_unittest.cc
+++ b/webrtc/common_video/i420_video_frame_unittest.cc
@@ -51,9 +51,9 @@ TEST(TestVideoFrame, SizeAllocation) {
VideoFrame frame;
frame. CreateEmptyFrame(10, 10, 12, 14, 220);
int height = frame.height();
- int stride_y = frame.stride(kYPlane);
- int stride_u = frame.stride(kUPlane);
- int stride_v = frame.stride(kVPlane);
+ int stride_y = frame.video_frame_buffer()->StrideY();
+ int stride_u = frame.video_frame_buffer()->StrideU();
+ int stride_v = frame.video_frame_buffer()->StrideV();
// Verify that allocated size was computed correctly.
EXPECT_EQ(ExpectedSize(stride_y, height, kYPlane),
frame.allocated_size(kYPlane));
@@ -101,9 +101,12 @@ TEST(TestVideoFrame, CopyFrame) {
// Frame of larger dimensions.
small_frame.CreateEmptyFrame(width, height,
stride_y, stride_u, stride_v);
- memset(small_frame.buffer(kYPlane), 1, small_frame.allocated_size(kYPlane));
- memset(small_frame.buffer(kUPlane), 2, small_frame.allocated_size(kUPlane));
- memset(small_frame.buffer(kVPlane), 3, small_frame.allocated_size(kVPlane));
+ memset(small_frame.video_frame_buffer()->MutableDataY(), 1,
+ small_frame.allocated_size(kYPlane));
+ memset(small_frame.video_frame_buffer()->MutableDataU(), 2,
+ small_frame.allocated_size(kUPlane));
+ memset(small_frame.video_frame_buffer()->MutableDataV(), 3,
+ small_frame.allocated_size(kVPlane));
big_frame.CopyFrame(small_frame);
EXPECT_TRUE(test::FramesEqual(small_frame, big_frame));
}
@@ -141,12 +144,12 @@ TEST(TestVideoFrame, ShallowCopy) {
const VideoFrame* const_frame1_ptr = &frame1;
const VideoFrame* const_frame2_ptr = &frame2;
- EXPECT_TRUE(const_frame1_ptr->buffer(kYPlane) ==
- const_frame2_ptr->buffer(kYPlane));
- EXPECT_TRUE(const_frame1_ptr->buffer(kUPlane) ==
- const_frame2_ptr->buffer(kUPlane));
- EXPECT_TRUE(const_frame1_ptr->buffer(kVPlane) ==
- const_frame2_ptr->buffer(kVPlane));
+ EXPECT_TRUE(const_frame1_ptr->video_frame_buffer()->DataY() ==
+ const_frame2_ptr->video_frame_buffer()->DataY());
+ EXPECT_TRUE(const_frame1_ptr->video_frame_buffer()->DataU() ==
+ const_frame2_ptr->video_frame_buffer()->DataU());
+ EXPECT_TRUE(const_frame1_ptr->video_frame_buffer()->DataV() ==
+ const_frame2_ptr->video_frame_buffer()->DataV());
EXPECT_EQ(frame2.timestamp(), frame1.timestamp());
EXPECT_EQ(frame2.ntp_time_ms(), frame1.ntp_time_ms());
@@ -184,12 +187,12 @@ TEST(TestVideoFrame, CopyBuffer) {
width, height, stride_y, stride_uv, stride_uv,
kVideoRotation_0);
// Expect exactly the same pixel data.
- EXPECT_TRUE(
- test::EqualPlane(buffer_y, frame2.buffer(kYPlane), stride_y, 15, 15));
- EXPECT_TRUE(
- test::EqualPlane(buffer_u, frame2.buffer(kUPlane), stride_uv, 8, 8));
- EXPECT_TRUE(
- test::EqualPlane(buffer_v, frame2.buffer(kVPlane), stride_uv, 8, 8));
+ EXPECT_TRUE(test::EqualPlane(buffer_y, frame2.video_frame_buffer()->DataY(),
+ stride_y, 15, 15));
+ EXPECT_TRUE(test::EqualPlane(buffer_u, frame2.video_frame_buffer()->DataU(),
+ stride_uv, 8, 8));
+ EXPECT_TRUE(test::EqualPlane(buffer_v, frame2.video_frame_buffer()->DataV(),
+ stride_uv, 8, 8));
// Compare size.
EXPECT_LE(kSizeY, frame2.allocated_size(kYPlane));
@@ -200,27 +203,27 @@ TEST(TestVideoFrame, CopyBuffer) {
TEST(TestVideoFrame, ReuseAllocation) {
VideoFrame frame;
frame.CreateEmptyFrame(640, 320, 640, 320, 320);
- const uint8_t* y = frame.buffer(kYPlane);
- const uint8_t* u = frame.buffer(kUPlane);
- const uint8_t* v = frame.buffer(kVPlane);
+ const uint8_t* y = frame.video_frame_buffer()->DataY();
+ const uint8_t* u = frame.video_frame_buffer()->DataU();
+ const uint8_t* v = frame.video_frame_buffer()->DataV();
frame.CreateEmptyFrame(640, 320, 640, 320, 320);
- EXPECT_EQ(y, frame.buffer(kYPlane));
- EXPECT_EQ(u, frame.buffer(kUPlane));
- EXPECT_EQ(v, frame.buffer(kVPlane));
+ EXPECT_EQ(y, frame.video_frame_buffer()->DataY());
+ EXPECT_EQ(u, frame.video_frame_buffer()->DataU());
+ EXPECT_EQ(v, frame.video_frame_buffer()->DataV());
}
TEST(TestVideoFrame, FailToReuseAllocation) {
VideoFrame frame1;
frame1.CreateEmptyFrame(640, 320, 640, 320, 320);
- const uint8_t* y = frame1.buffer(kYPlane);
- const uint8_t* u = frame1.buffer(kUPlane);
- const uint8_t* v = frame1.buffer(kVPlane);
+ const uint8_t* y = frame1.video_frame_buffer()->DataY();
+ const uint8_t* u = frame1.video_frame_buffer()->DataU();
+ const uint8_t* v = frame1.video_frame_buffer()->DataV();
// Make a shallow copy of |frame1|.
VideoFrame frame2(frame1.video_frame_buffer(), 0, 0, kVideoRotation_0);
frame1.CreateEmptyFrame(640, 320, 640, 320, 320);
- EXPECT_NE(y, frame1.buffer(kYPlane));
- EXPECT_NE(u, frame1.buffer(kUPlane));
- EXPECT_NE(v, frame1.buffer(kVPlane));
+ EXPECT_NE(y, frame1.video_frame_buffer()->DataY());
+ EXPECT_NE(u, frame1.video_frame_buffer()->DataU());
+ EXPECT_NE(v, frame1.video_frame_buffer()->DataV());
}
TEST(TestVideoFrame, TextureInitialValues) {
« no previous file with comments | « webrtc/api/java/jni/androidmediaencoder_jni.cc ('k') | webrtc/common_video/libyuv/libyuv_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698