| OLD | NEW |
| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 rotated.DataU()[(x / 2) + (y / 2) * rotated.StrideU()]); | 107 rotated.DataU()[(x / 2) + (y / 2) * rotated.StrideU()]); |
| 108 EXPECT_EQ(colors[i].v, | 108 EXPECT_EQ(colors[i].v, |
| 109 rotated.DataV()[(x / 2) + (y / 2) * rotated.StrideV()]); | 109 rotated.DataV()[(x / 2) + (y / 2) * rotated.StrideV()]); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace | 113 } // namespace |
| 114 | 114 |
| 115 TEST(TestVideoFrame, WidthHeightValues) { | 115 TEST(TestVideoFrame, WidthHeightValues) { |
| 116 VideoFrame frame(I420Buffer::Create(10, 10, 10, 14, 90), | 116 VideoFrame frame(I420Buffer::Create(10, 10, 10, 14, 90), |
| 117 webrtc::kVideoRotation_0, | 117 webrtc::kVideoRotation_0, webrtc::VideoContentType::kDefault, |
| 118 789 * rtc::kNumMicrosecsPerMillisec); | 118 789 * rtc::kNumMicrosecsPerMillisec); |
| 119 const int valid_value = 10; | 119 const int valid_value = 10; |
| 120 EXPECT_EQ(valid_value, frame.width()); | 120 EXPECT_EQ(valid_value, frame.width()); |
| 121 EXPECT_EQ(valid_value, frame.height()); | 121 EXPECT_EQ(valid_value, frame.height()); |
| 122 frame.set_timestamp(123u); | 122 frame.set_timestamp(123u); |
| 123 EXPECT_EQ(123u, frame.timestamp()); | 123 EXPECT_EQ(123u, frame.timestamp()); |
| 124 frame.set_ntp_time_ms(456); | 124 frame.set_ntp_time_ms(456); |
| 125 EXPECT_EQ(456, frame.ntp_time_ms()); | 125 EXPECT_EQ(456, frame.ntp_time_ms()); |
| 126 EXPECT_EQ(789, frame.render_time_ms()); | 126 EXPECT_EQ(789, frame.render_time_ms()); |
| 127 } | 127 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 140 const int kSizeU = 100; | 140 const int kSizeU = 100; |
| 141 const int kSizeV = 100; | 141 const int kSizeV = 100; |
| 142 const VideoRotation kRotation = kVideoRotation_270; | 142 const VideoRotation kRotation = kVideoRotation_270; |
| 143 uint8_t buffer_y[kSizeY]; | 143 uint8_t buffer_y[kSizeY]; |
| 144 uint8_t buffer_u[kSizeU]; | 144 uint8_t buffer_u[kSizeU]; |
| 145 uint8_t buffer_v[kSizeV]; | 145 uint8_t buffer_v[kSizeV]; |
| 146 memset(buffer_y, 16, kSizeY); | 146 memset(buffer_y, 16, kSizeY); |
| 147 memset(buffer_u, 8, kSizeU); | 147 memset(buffer_u, 8, kSizeU); |
| 148 memset(buffer_v, 4, kSizeV); | 148 memset(buffer_v, 4, kSizeV); |
| 149 | 149 |
| 150 VideoFrame frame1( | 150 VideoFrame frame1(I420Buffer::Copy(width, height, buffer_y, stride_y, |
| 151 I420Buffer::Copy(width, height, | 151 buffer_u, stride_u, buffer_v, stride_v), |
| 152 buffer_y, stride_y, | 152 kRotation, VideoContentType::kDefault, 0); |
| 153 buffer_u, stride_u, | |
| 154 buffer_v, stride_v), | |
| 155 kRotation, 0); | |
| 156 frame1.set_timestamp(timestamp); | 153 frame1.set_timestamp(timestamp); |
| 157 frame1.set_ntp_time_ms(ntp_time_ms); | 154 frame1.set_ntp_time_ms(ntp_time_ms); |
| 158 frame1.set_timestamp_us(timestamp_us); | 155 frame1.set_timestamp_us(timestamp_us); |
| 159 VideoFrame frame2(frame1); | 156 VideoFrame frame2(frame1); |
| 160 | 157 |
| 161 EXPECT_EQ(frame1.video_frame_buffer(), frame2.video_frame_buffer()); | 158 EXPECT_EQ(frame1.video_frame_buffer(), frame2.video_frame_buffer()); |
| 162 EXPECT_EQ(frame1.video_frame_buffer()->DataY(), | 159 EXPECT_EQ(frame1.video_frame_buffer()->DataY(), |
| 163 frame2.video_frame_buffer()->DataY()); | 160 frame2.video_frame_buffer()->DataY()); |
| 164 EXPECT_EQ(frame1.video_frame_buffer()->DataU(), | 161 EXPECT_EQ(frame1.video_frame_buffer()->DataU(), |
| 165 frame2.video_frame_buffer()->DataU()); | 162 frame2.video_frame_buffer()->DataU()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 CheckRotate(640, 480, GetParam(), *rotated_buffer); | 298 CheckRotate(640, 480, GetParam(), *rotated_buffer); |
| 302 } | 299 } |
| 303 | 300 |
| 304 INSTANTIATE_TEST_CASE_P(Rotate, TestI420BufferRotateOld, | 301 INSTANTIATE_TEST_CASE_P(Rotate, TestI420BufferRotateOld, |
| 305 ::testing::Values(kVideoRotation_0, | 302 ::testing::Values(kVideoRotation_0, |
| 306 kVideoRotation_90, | 303 kVideoRotation_90, |
| 307 kVideoRotation_180, | 304 kVideoRotation_180, |
| 308 kVideoRotation_270)); | 305 kVideoRotation_270)); |
| 309 | 306 |
| 310 } // namespace webrtc | 307 } // namespace webrtc |
| OLD | NEW |