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 bc58e5b3b942bf9c1feda2b325979a271da36739..1ec451cb7971f8efff47eed9ac6bc4adb6f18d6b 100644 |
--- a/webrtc/common_video/i420_video_frame_unittest.cc |
+++ b/webrtc/common_video/i420_video_frame_unittest.cc |
@@ -15,11 +15,15 @@ |
#include "webrtc/base/bind.h" |
#include "webrtc/base/scoped_ptr.h" |
#include "webrtc/test/fake_texture_frame.h" |
-#include "webrtc/test/frame_utils.h" |
#include "webrtc/video_frame.h" |
namespace webrtc { |
+bool EqualPlane(const uint8_t* data1, |
+ const uint8_t* data2, |
+ int stride, |
+ int width, |
+ int height); |
int ExpectedSize(int plane_stride, int image_height, PlaneType type); |
TEST(TestVideoFrame, InitialValues) { |
@@ -37,7 +41,7 @@ |
TEST(TestVideoFrame, WidthHeightValues) { |
VideoFrame frame; |
const int valid_value = 10; |
- frame.CreateEmptyFrame(10, 10, 10, 14, 90); |
+ EXPECT_EQ(0, frame.CreateEmptyFrame(10, 10, 10, 14, 90)); |
EXPECT_EQ(valid_value, frame.width()); |
EXPECT_EQ(valid_value, frame.height()); |
frame.set_timestamp(123u); |
@@ -50,7 +54,7 @@ |
TEST(TestVideoFrame, SizeAllocation) { |
VideoFrame frame; |
- frame. CreateEmptyFrame(10, 10, 12, 14, 220); |
+ EXPECT_EQ(0, frame. CreateEmptyFrame(10, 10, 12, 14, 220)); |
int height = frame.height(); |
int stride_y = frame.stride(kYPlane); |
int stride_u = frame.stride(kUPlane); |
@@ -75,8 +79,8 @@ |
int height = 15; |
// Copy frame. |
VideoFrame small_frame; |
- small_frame.CreateEmptyFrame(width, height, |
- stride_y, stride_u, stride_v); |
+ EXPECT_EQ(0, small_frame.CreateEmptyFrame(width, height, |
+ stride_y, stride_u, stride_v)); |
small_frame.set_timestamp(timestamp); |
small_frame.set_ntp_time_ms(ntp_time_ms); |
small_frame.set_render_time_ms(render_time_ms); |
@@ -91,22 +95,23 @@ |
memset(buffer_u, 8, kSizeU); |
memset(buffer_v, 4, kSizeV); |
VideoFrame big_frame; |
- big_frame.CreateFrame(buffer_y, buffer_u, buffer_v, |
- width + 5, height + 5, stride_y + 5, |
- stride_u, stride_v, kRotation); |
+ EXPECT_EQ(0, |
+ big_frame.CreateFrame(buffer_y, buffer_u, buffer_v, |
+ width + 5, height + 5, stride_y + 5, |
+ stride_u, stride_v, kRotation)); |
// Frame of smaller dimensions. |
- small_frame.CopyFrame(big_frame); |
- EXPECT_TRUE(test::FramesEqual(small_frame, big_frame)); |
+ EXPECT_EQ(0, small_frame.CopyFrame(big_frame)); |
+ EXPECT_TRUE(small_frame.EqualsFrame(big_frame)); |
EXPECT_EQ(kRotation, small_frame.rotation()); |
// Frame of larger dimensions. |
- small_frame.CreateEmptyFrame(width, height, |
- stride_y, stride_u, stride_v); |
+ EXPECT_EQ(0, 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)); |
- big_frame.CopyFrame(small_frame); |
- EXPECT_TRUE(test::FramesEqual(small_frame, big_frame)); |
+ EXPECT_EQ(0, big_frame.CopyFrame(small_frame)); |
+ EXPECT_TRUE(small_frame.EqualsFrame(big_frame)); |
} |
TEST(TestVideoFrame, ShallowCopy) { |
@@ -130,8 +135,8 @@ |
memset(buffer_u, 8, kSizeU); |
memset(buffer_v, 4, kSizeV); |
VideoFrame frame1; |
- frame1.CreateFrame(buffer_y, buffer_u, buffer_v, width, height, |
- stride_y, stride_u, stride_v, kRotation); |
+ EXPECT_EQ(0, frame1.CreateFrame(buffer_y, buffer_u, buffer_v, width, height, |
+ stride_y, stride_u, stride_v, kRotation)); |
frame1.set_timestamp(timestamp); |
frame1.set_ntp_time_ms(ntp_time_ms); |
frame1.set_render_time_ms(render_time_ms); |
@@ -167,7 +172,7 @@ |
TEST(TestVideoFrame, Reset) { |
VideoFrame frame; |
- frame.CreateEmptyFrame(5, 5, 5, 5, 5); |
+ ASSERT_EQ(frame.CreateEmptyFrame(5, 5, 5, 5, 5), 0); |
frame.set_ntp_time_ms(1); |
frame.set_timestamp(2); |
frame.set_render_time_ms(3); |
@@ -188,8 +193,8 @@ |
int stride_uv = 10; |
const int kSizeY = 225; |
const int kSizeUv = 80; |
- frame2.CreateEmptyFrame(width, height, |
- stride_y, stride_uv, stride_uv); |
+ EXPECT_EQ(0, frame2.CreateEmptyFrame(width, height, |
+ stride_y, stride_uv, stride_uv)); |
uint8_t buffer_y[kSizeY]; |
uint8_t buffer_u[kSizeUv]; |
uint8_t buffer_v[kSizeUv]; |
@@ -197,15 +202,11 @@ |
memset(buffer_u, 8, kSizeUv); |
memset(buffer_v, 4, kSizeUv); |
frame2.CreateFrame(buffer_y, buffer_u, buffer_v, |
- width, height, stride_y, stride_uv, stride_uv, |
- kVideoRotation_0); |
+ width, height, stride_y, stride_uv, stride_uv); |
// 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(EqualPlane(buffer_y, frame2.buffer(kYPlane), stride_y, 15, 15)); |
+ EXPECT_TRUE(EqualPlane(buffer_u, frame2.buffer(kUPlane), stride_uv, 8, 8)); |
+ EXPECT_TRUE(EqualPlane(buffer_v, frame2.buffer(kVPlane), stride_uv, 8, 8)); |
// Compare size. |
EXPECT_LE(kSizeY, frame2.allocated_size(kYPlane)); |