OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 TEST_F(WebRtcVideoFrameTest, InitRotated90DontApplyRotation) { | 179 TEST_F(WebRtcVideoFrameTest, InitRotated90DontApplyRotation) { |
180 TestInit(640, 360, webrtc::kVideoRotation_90, false); | 180 TestInit(640, 360, webrtc::kVideoRotation_90, false); |
181 } | 181 } |
182 | 182 |
183 TEST_F(WebRtcVideoFrameTest, TextureInitialValues) { | 183 TEST_F(WebRtcVideoFrameTest, TextureInitialValues) { |
184 webrtc::test::FakeNativeHandle* dummy_handle = | 184 webrtc::test::FakeNativeHandle* dummy_handle = |
185 new webrtc::test::FakeNativeHandle(); | 185 new webrtc::test::FakeNativeHandle(); |
186 webrtc::NativeHandleBuffer* buffer = | 186 webrtc::NativeHandleBuffer* buffer = |
187 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( | 187 new rtc::RefCountedObject<webrtc::test::FakeNativeHandleBuffer>( |
188 dummy_handle, 640, 480); | 188 dummy_handle, 640, 480); |
189 | 189 // Timestamp is converted from ns to us, so last three digits are lost. |
190 WebRtcVideoFrame frame(buffer, webrtc::kVideoRotation_0, 20); | 190 WebRtcVideoFrame frame(buffer, 20000, webrtc::kVideoRotation_0); |
191 EXPECT_EQ(dummy_handle, frame.video_frame_buffer()->native_handle()); | 191 EXPECT_EQ(dummy_handle, frame.video_frame_buffer()->native_handle()); |
192 EXPECT_EQ(640, frame.width()); | 192 EXPECT_EQ(640, frame.width()); |
193 EXPECT_EQ(480, frame.height()); | 193 EXPECT_EQ(480, frame.height()); |
| 194 EXPECT_EQ(20000, frame.GetTimeStamp()); |
194 EXPECT_EQ(20, frame.timestamp_us()); | 195 EXPECT_EQ(20, frame.timestamp_us()); |
195 frame.set_timestamp_us(40); | 196 frame.set_timestamp_us(40); |
| 197 EXPECT_EQ(40000, frame.GetTimeStamp()); |
196 EXPECT_EQ(40, frame.timestamp_us()); | 198 EXPECT_EQ(40, frame.timestamp_us()); |
197 } | 199 } |
198 | 200 |
199 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { | 201 TEST_F(WebRtcVideoFrameTest, ApplyRotationToFrame) { |
200 WebRtcVideoFrame applied0; | 202 WebRtcVideoFrame applied0; |
201 EXPECT_TRUE(IsNull(applied0)); | 203 EXPECT_TRUE(IsNull(applied0)); |
202 EXPECT_TRUE(LoadFrame(CreateYuvSample(kWidth, kHeight, 12).get(), FOURCC_I420, | 204 EXPECT_TRUE(LoadFrame(CreateYuvSample(kWidth, kHeight, 12).get(), FOURCC_I420, |
203 kWidth, kHeight, &applied0)); | 205 kWidth, kHeight, &applied0)); |
204 | 206 |
205 // Claim that this frame needs to be rotated for 90 degree. | 207 // Claim that this frame needs to be rotated for 90 degree. |
(...skipping 14 matching lines...) Expand all Loading... |
220 SetFrameRotation(&applied90, webrtc::kVideoRotation_270); | 222 SetFrameRotation(&applied90, webrtc::kVideoRotation_270); |
221 WebRtcVideoFrame applied360( | 223 WebRtcVideoFrame applied360( |
222 webrtc::I420Buffer::Rotate(applied90.video_frame_buffer(), | 224 webrtc::I420Buffer::Rotate(applied90.video_frame_buffer(), |
223 applied90.rotation()), | 225 applied90.rotation()), |
224 webrtc::kVideoRotation_0, applied90.timestamp_us()); | 226 webrtc::kVideoRotation_0, applied90.timestamp_us()); |
225 EXPECT_EQ(applied360.rotation(), webrtc::kVideoRotation_0); | 227 EXPECT_EQ(applied360.rotation(), webrtc::kVideoRotation_0); |
226 EXPECT_TRUE(IsEqual(applied0, applied360, 0)); | 228 EXPECT_TRUE(IsEqual(applied0, applied360, 0)); |
227 } | 229 } |
228 | 230 |
229 } // namespace cricket | 231 } // namespace cricket |
OLD | NEW |