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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 uint8_t buffer_v[kSizeV]; | 150 uint8_t buffer_v[kSizeV]; |
151 memset(buffer_y, 16, kSizeY); | 151 memset(buffer_y, 16, kSizeY); |
152 memset(buffer_u, 8, kSizeU); | 152 memset(buffer_u, 8, kSizeU); |
153 memset(buffer_v, 4, kSizeV); | 153 memset(buffer_v, 4, kSizeV); |
154 VideoFrame frame1; | 154 VideoFrame frame1; |
155 frame1.CreateFrame(buffer_y, buffer_u, buffer_v, width, height, | 155 frame1.CreateFrame(buffer_y, buffer_u, buffer_v, width, height, |
156 stride_y, stride_u, stride_v, kRotation); | 156 stride_y, stride_u, stride_v, kRotation); |
157 frame1.set_timestamp(timestamp); | 157 frame1.set_timestamp(timestamp); |
158 frame1.set_ntp_time_ms(ntp_time_ms); | 158 frame1.set_ntp_time_ms(ntp_time_ms); |
159 frame1.set_render_time_ms(render_time_ms); | 159 frame1.set_render_time_ms(render_time_ms); |
160 VideoFrame frame2; | 160 VideoFrame frame2(frame1); |
161 frame2.ShallowCopy(frame1); | |
162 | 161 |
163 // To be able to access the buffers, we need const pointers to the frames. | 162 EXPECT_TRUE(frame1.video_frame_buffer()->DataY() == |
164 const VideoFrame* const_frame1_ptr = &frame1; | 163 frame2.video_frame_buffer()->DataY()); |
165 const VideoFrame* const_frame2_ptr = &frame2; | 164 EXPECT_TRUE(frame1.video_frame_buffer()->DataU() == |
166 | 165 frame2.video_frame_buffer()->DataU()); |
167 EXPECT_TRUE(const_frame1_ptr->video_frame_buffer()->DataY() == | 166 EXPECT_TRUE(frame1.video_frame_buffer()->DataV() == |
168 const_frame2_ptr->video_frame_buffer()->DataY()); | 167 frame2.video_frame_buffer()->DataV()); |
169 EXPECT_TRUE(const_frame1_ptr->video_frame_buffer()->DataU() == | |
170 const_frame2_ptr->video_frame_buffer()->DataU()); | |
171 EXPECT_TRUE(const_frame1_ptr->video_frame_buffer()->DataV() == | |
172 const_frame2_ptr->video_frame_buffer()->DataV()); | |
173 | 168 |
174 EXPECT_EQ(frame2.timestamp(), frame1.timestamp()); | 169 EXPECT_EQ(frame2.timestamp(), frame1.timestamp()); |
175 EXPECT_EQ(frame2.ntp_time_ms(), frame1.ntp_time_ms()); | 170 EXPECT_EQ(frame2.ntp_time_ms(), frame1.ntp_time_ms()); |
176 EXPECT_EQ(frame2.render_time_ms(), frame1.render_time_ms()); | 171 EXPECT_EQ(frame2.render_time_ms(), frame1.render_time_ms()); |
177 EXPECT_EQ(frame2.rotation(), frame1.rotation()); | 172 EXPECT_EQ(frame2.rotation(), frame1.rotation()); |
178 | 173 |
179 frame2.set_timestamp(timestamp + 1); | 174 frame2.set_timestamp(timestamp + 1); |
180 frame2.set_ntp_time_ms(ntp_time_ms + 1); | 175 frame2.set_ntp_time_ms(ntp_time_ms + 1); |
181 frame2.set_render_time_ms(render_time_ms + 1); | 176 frame2.set_render_time_ms(render_time_ms + 1); |
182 frame2.set_rotation(kVideoRotation_90); | 177 frame2.set_rotation(kVideoRotation_90); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 CheckRotate(640, 480, GetParam(), *rotated_buffer); | 312 CheckRotate(640, 480, GetParam(), *rotated_buffer); |
318 } | 313 } |
319 | 314 |
320 INSTANTIATE_TEST_CASE_P(Rotate, TestI420BufferRotate, | 315 INSTANTIATE_TEST_CASE_P(Rotate, TestI420BufferRotate, |
321 ::testing::Values(kVideoRotation_0, | 316 ::testing::Values(kVideoRotation_0, |
322 kVideoRotation_90, | 317 kVideoRotation_90, |
323 kVideoRotation_180, | 318 kVideoRotation_180, |
324 kVideoRotation_270)); | 319 kVideoRotation_270)); |
325 | 320 |
326 } // namespace webrtc | 321 } // namespace webrtc |
OLD | NEW |