| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 frame2.set_ntp_time_ms(ntp_time_ms + 1); | 157 frame2.set_ntp_time_ms(ntp_time_ms + 1); |
| 158 frame2.set_render_time_ms(render_time_ms + 1); | 158 frame2.set_render_time_ms(render_time_ms + 1); |
| 159 frame2.set_rotation(kVideoRotation_90); | 159 frame2.set_rotation(kVideoRotation_90); |
| 160 | 160 |
| 161 EXPECT_NE(frame2.timestamp(), frame1.timestamp()); | 161 EXPECT_NE(frame2.timestamp(), frame1.timestamp()); |
| 162 EXPECT_NE(frame2.ntp_time_ms(), frame1.ntp_time_ms()); | 162 EXPECT_NE(frame2.ntp_time_ms(), frame1.ntp_time_ms()); |
| 163 EXPECT_NE(frame2.render_time_ms(), frame1.render_time_ms()); | 163 EXPECT_NE(frame2.render_time_ms(), frame1.render_time_ms()); |
| 164 EXPECT_NE(frame2.rotation(), frame1.rotation()); | 164 EXPECT_NE(frame2.rotation(), frame1.rotation()); |
| 165 } | 165 } |
| 166 | 166 |
| 167 TEST(TestVideoFrame, Reset) { | |
| 168 VideoFrame frame; | |
| 169 frame.CreateEmptyFrame(5, 5, 5, 5, 5); | |
| 170 frame.set_ntp_time_ms(1); | |
| 171 frame.set_timestamp(2); | |
| 172 frame.set_render_time_ms(3); | |
| 173 ASSERT_TRUE(frame.video_frame_buffer() != NULL); | |
| 174 | |
| 175 frame.Reset(); | |
| 176 EXPECT_EQ(0u, frame.ntp_time_ms()); | |
| 177 EXPECT_EQ(0u, frame.render_time_ms()); | |
| 178 EXPECT_EQ(0u, frame.timestamp()); | |
| 179 EXPECT_TRUE(frame.video_frame_buffer() == NULL); | |
| 180 } | |
| 181 | |
| 182 TEST(TestVideoFrame, CopyBuffer) { | 167 TEST(TestVideoFrame, CopyBuffer) { |
| 183 VideoFrame frame1, frame2; | 168 VideoFrame frame1, frame2; |
| 184 int width = 15; | 169 int width = 15; |
| 185 int height = 15; | 170 int height = 15; |
| 186 int stride_y = 15; | 171 int stride_y = 15; |
| 187 int stride_uv = 10; | 172 int stride_uv = 10; |
| 188 const int kSizeY = 225; | 173 const int kSizeY = 225; |
| 189 const int kSizeUv = 80; | 174 const int kSizeUv = 80; |
| 190 frame2.CreateEmptyFrame(width, height, | 175 frame2.CreateEmptyFrame(width, height, |
| 191 stride_y, stride_uv, stride_uv); | 176 stride_y, stride_uv, stride_uv); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 rtc::scoped_refptr<I420Buffer> buf1( | 243 rtc::scoped_refptr<I420Buffer> buf1( |
| 259 new rtc::RefCountedObject<I420Buffer>(20, 10)); | 244 new rtc::RefCountedObject<I420Buffer>(20, 10)); |
| 260 memset(buf1->MutableData(kYPlane), 1, 200); | 245 memset(buf1->MutableData(kYPlane), 1, 200); |
| 261 memset(buf1->MutableData(kUPlane), 2, 50); | 246 memset(buf1->MutableData(kUPlane), 2, 50); |
| 262 memset(buf1->MutableData(kVPlane), 3, 50); | 247 memset(buf1->MutableData(kVPlane), 3, 50); |
| 263 rtc::scoped_refptr<I420Buffer> buf2 = I420Buffer::Copy(buf1); | 248 rtc::scoped_refptr<I420Buffer> buf2 = I420Buffer::Copy(buf1); |
| 264 EXPECT_TRUE(test::FrameBufsEqual(buf1, buf2)); | 249 EXPECT_TRUE(test::FrameBufsEqual(buf1, buf2)); |
| 265 } | 250 } |
| 266 | 251 |
| 267 } // namespace webrtc | 252 } // namespace webrtc |
| OLD | NEW |